cloudyu commited on
Commit
a6af7ed
·
verified ·
1 Parent(s): aaa92ff

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +35 -0
README.md ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: llama3
3
+ ---
4
+ finetuned by simplescaling/s1K
5
+
6
+ example code
7
+
8
+ ```python
9
+
10
+ import torch
11
+ from transformers import AutoTokenizer, AutoModelForCausalLM
12
+ import math
13
+
14
+ ## v2 models
15
+ model_path = "cloudyu/S1-Llama-3.2-3Bx4-MoE"
16
+
17
+ tokenizer = AutoTokenizer.from_pretrained(model_path, use_default_system_prompt=False)
18
+ model = AutoModelForCausalLM.from_pretrained(
19
+ model_path, torch_dtype=torch.float32, trust_remote_code=True,device_map='mps'
20
+ )
21
+ print(model)
22
+ print(model.lm_head.weight)
23
+
24
+ prompt = input("please input prompt:")
25
+ while len(prompt) > 0:
26
+ input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to("mps")
27
+
28
+ generation_output = model.generate(
29
+ input_ids=input_ids, max_new_tokens=500,repetition_penalty=1.2
30
+ )
31
+ print(tokenizer.decode(generation_output[0]))
32
+ prompt = input("please input prompt:")
33
+
34
+
35
+ ```