code: def load_gguf_mixtral(
      loader: GGUFFileLoader, dtype: torch.dtype = torch.float
  ):
      # mixtral enjoys a general architecture of llma
      # e.g. it applies llama tokenizer
      config = loader.config
      num_local_experts = config["llama.expert_count"]
      num_experts_per_tok = config["llama.expert_used_count"]
      n_head = config["llama.attention.head_count"]
      n_head_kv = config["llama.attention.head_count_kv"]
      hidden_size = config["llama.embedding_length"]
  
      mixtral_config = MixtralConfig(
          vocab_size=len(config["tokenizer.ggml.tokens"]),
          hidden_size=hidden_size,
          intermediate_size=config["llama.feed_forward_length"],
          num_hidden_layers=config["llama.block_count"],
          num_attention_heads=config["llama.attention.head_count"],
          num_key_value_heads=config["llama.attention.head_count_kv"],
          max_position_embeddings=config["llama.context_length"],
          rms_norm_eps=config["llama.attention.layer_norm_rms_epsilon"],
          pad_token_id=config["tokenizer.ggml.padding_token_id"],
          bos_token_id=config["tokenizer.ggml.bos_token_id"],
          eos_token_id=config["tokenizer.ggml.eos_token_id"],
          num_local_experts=num_local_experts,
          num_experts_per_tok=num_experts_per_tok,
      )
  
      with init_empty_weights():
          model = MixtralForCausalLM(mixtral_config)
  
      def process_mixtral(name, tensor):
          module_name = get_mixtral_module_name(name)
          if "ffn_gate_inp" in name:
              # gguf weight needs to reshape for ffn_gate_inp
              fill_model(
                  model,
                  module_name,
                  "cpu",
                  tensor.reshape(num_local_experts, hidden_size),
                  dtype=dtype,
              )
          else:
              fill_model(model, module_name, "cpu", tensor, dtype=dtype)
  
      tensor_loader = loader.tensor_loader
      tensor_loader.load_while_process(process_mixtral)
  
      from transformers.convert_slow_tokenizer import import_protobuf
  
      spm_pb2 = import_protobuf("Failed to import protobuf")
  
      tokenizer_pieces = loader.tokenizer_pieces()
      trainer_spec = spm_pb2.TrainerSpec(
          byte_fallback=True,
          model_type=spm_pb2.TrainerSpec.ModelType.BPE,
      )
      proto = spm_pb2.ModelProto(
          pieces=tokenizer_pieces, trainer_spec=trainer_spec
      )
      proto = proto.SerializeToString()
  
      with NamedTemporaryFile(delete=False) as f:
          f.write(proto)
          f.close()
          tokenizer = LlamaTokenizer(f.name)
          os.remove(f.name)
  
      return model, tokenizer
  
file_path: BigDL/python/llm/src/bigdl/llm/transformers/gguf/models/mixtral.py
imports: import os
  import torch
  from accelerate import init_empty_weights
  from accelerate.utils import set_module_tensor_to_device
  from tempfile import NamedTemporaryFile
  from transformers import MixtralConfig, MixtralForCausalLM, LlamaTokenizer
  from ..gguf import GGUFFileLoader
label_desc: Use image node_id 1 for calling a global function with example usage: load_gguf_mixtral(loader, dtype) and returns: model,  tokenizer