Phi3Mix is a Mixture of Experts (MoE) made with the following models using
Phi3_LazyMergekit:
1base_model: microsoft/Phi-3-small-128k-instruct
2gate_mode: cheap_embed
3experts_per_token: 1
4dtype: float16
5experts:
6 - source_model: microsoft/Phi-3-small-128k-instruct
7 positive_prompts: ["research, logic, math, science"]
8 - source_model: Rakuten/RakutenAI-7B
9 positive_prompts: ["creative, art"]
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model = "fukayatti/Phi3Mix"
5
6tokenizer = AutoTokenizer.from_pretrained(model)
7
8model = AutoModelForCausalLM.from_pretrained(
9 model,
10 trust_remote_code=True,
11)
12
13prompt="How many continents are there?"
14input = f"<|system|>You are a helpful AI assistant.<|end|><|user|>{prompt}<|assistant|>"
15tokenized_input = tokenizer.encode(input, return_tensors="pt")
16
17outputs = model.generate(tokenized_input, max_new_tokens=128, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
18print(tokenizer.decode(outputs[0]))