Downloads · 30 days
20
26% of all-time downloads
mzbac/phi-2-2x3
phi-2-2x3 is a text generation model from mzbac. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as mit.
A Moe model built on top of microsoft/phi-2, g-ronimo/phi-2-OpenHermes-2.5 and mlx-community/phi-2-dpo-7k, random init gates weights
Downloads · 30 days
20
26% of all-time downloads
All-time downloads
77
Public
Parameters
6.1B
24.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors12.3 GB · 100%
From the Hugging Face model README
A Moe model built on top of microsoft/phi-2, g-ronimo/phi-2-OpenHermes-2.5 and mlx-community/phi-2-dpo-7k, random init gates weights
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
import torch
DEV = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model_name_or_path = "mzbac/phi2-2x3"
model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
trust_remote_code=True,
torch_dtype=torch.bfloat16,
)
model.to(DEV)
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
prompt = "Instruct: how backpropagation works.\nOutput:"
print("\n\n*** Generate:")
inputs = tokenizer.encode(prompt, return_tensors="pt").to(DEV)
generate_kwargs = dict(
input_ids=inputs,
temperature=0.3,
max_new_tokens=500,
do_sample=True,
)
outputs = model.generate(**generate_kwargs)
print(tokenizer.decode(outputs[0]))