Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
Spico197 committed Dec 24, 2023
1 parent e99558f commit c59526b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions example.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import torch
from transformers import AutoTokenizer
# python>=3.10

from smoe.models.llama_moe import LlamaMoEForCausalLM
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model_dir = "/mnt/petrelfs/share_data/quxiaoye/runs/llama2_random_split_112gpus_16_2/outputs/cpt-llama2_random_split_112gpus_16_2_scale_factor_8-2342244/checkpoint-13600/"
tokenizer = AutoTokenizer.from_pretrained(model_dir)
model = LlamaMoEForCausalLM.from_pretrained(model_dir, torch_dtype=torch.bfloat16)
model_dir = "llama-moe/LLaMA-MoE-v1-3_5B-2_8"
tokenizer = AutoTokenizer.from_pretrained(model_dir, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_dir, torch_dtype=torch.bfloat16, trust_remote_code=True
)
model.eval()
model.to("cuda:0")

input_text = "Suzhou is famous of"
Expand Down

0 comments on commit c59526b

Please sign in to comment.