Downloads · 30 days
14
5% of all-time downloads
HassanStar/Phi3Mix
Phi3Mix is a text generation model from HassanStar. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
Phi3Mix is a Mixture of Experts (MoE) made with the following models using Phi3LazyMergekit: microsoft/Phi-3-mini-4k-instruct microsoft/Phi-3-mini-4k-instruct
Downloads · 30 days
14
5% of all-time downloads
All-time downloads
277
Public
Repo size
—
Likes
0
Public
Click a slice to open those files.
.py85.3 KB · 95%
From the Hugging Face model README
Phi3Mix is a Mixture of Experts (MoE) made with the following models using Phi3_LazyMergekit:
base_model: microsoft/Phi-3-mini-4k-instruct
gate_mode: cheap_embed
experts_per_token: 1
dtype: float16
experts:
- source_model: microsoft/Phi-3-mini-4k-instruct
positive_prompts: ["research, logic, math, science"]
- source_model: microsoft/Phi-3-mini-4k-instruct
positive_prompts: ["creative, art"]
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model = "HassanStar/Phi3Mix"
tokenizer = AutoTokenizer.from_pretrained(model)
model = AutoModelForCausalLM.from_pretrained(
model,
trust_remote_code=True,
)
prompt="How many continents are there?"
input = f"<|system|>You are a helpful AI assistant.<|end|><|user|>{prompt}<|assistant|>"
tokenized_input = tokenizer.encode(input, return_tensors="pt")
outputs = model.generate(tokenized_input, max_new_tokens=128, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
print(tokenizer.decode(outputs[0]))