Views
No views yet

| Model | AGIEval | GPT4All | TruthfulQA | Bigbench | Average |
|---|---|---|---|---|---|
| phixtral-2x2_8 | 34.1 | 70.44 | 48.78 | 37.82 | 47.78 |
| dolphin-2_6-phi-2 | 33.12 | 69.85 | 47.39 | 37.2 | 46.89 |
| phi-2-dpo | 30.39 | 71.68 | 50.75 | 34.9 | 46.93 |
| phi-2 | 27.98 | 70.8 | 44.43 | 35.21 | 44.61 |
1base_model: cognitivecomputations/dolphin-2_6-phi-2
2gate_mode: cheap_embed
3experts:
4 - source_model: cognitivecomputations/dolphin-2_6-phi-2
5 positive_prompts: [""]
6 - source_model: lxuechen/phi-2-dpo
7 positive_prompts: [""]1!pip install -q --upgrade transformers einops accelerate bitsandbytes
2
3import torch
4from transformers import AutoModelForCausalLM, AutoTokenizer
5
6model_name = "phixtral-2x2_8"
7instruction = '''
8 def print_prime(n):
9 """
10 Print all primes between 1 and n
11 """
12'''
13
14torch.set_default_device("cuda")
15
16# Load the model and tokenizer
17model = AutoModelForCausalLM.from_pretrained(
18 f"mlabonne/{model_name}",
19 torch_dtype="auto",
20 load_in_4bit=True,
21 trust_remote_code=True
22)
23tokenizer = AutoTokenizer.from_pretrained(
24 f"mlabonne/{model_name}",
25 trust_remote_code=True
26)
27
28# Tokenize the input string
29inputs = tokenizer(
30 instruction,
31 return_tensors="pt",
32 return_attention_mask=False
33)
34
35# Generate text using the model
36outputs = model.generate(**inputs, max_length=200)
37
38# Decode and print the output
39text = tokenizer.batch_decode(outputs)[0]
40print(text)num_experts_per_tok and num_local_experts in the config.json file (2 for both by default). This configuration is automatically loaded in configuration.py.modeling_phi.py file. In particular, see the MoE class.