DeepMount00 commited on
Commit
7602eb8
1 Parent(s): f7e5106

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +31 -0
README.md CHANGED
@@ -33,6 +33,37 @@ The performance of Qwen2 1.5B was evaluated on several benchmarks and compared a
33
  | Qwen2-1.5B-Ita | 1.5B | **43.98** | **51.45** | 32.34 | 48.15 |
34
 
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
  ### Conclusion
38
 
 
33
  | Qwen2-1.5B-Ita | 1.5B | **43.98** | **51.45** | 32.34 | 48.15 |
34
 
35
 
36
+ ## How to Use
37
+
38
+ ```python
39
+ import torch
40
+ from transformers import AutoTokenizer, AutoModelForCausalLM
41
+
42
+ model_name = "DeepMount00/Qwen2-1.5B-Ita"
43
+
44
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
45
+ model = AutoModelForCausalLM.from_pretrained(
46
+ model_name,
47
+ torch_dtype=torch.bfloat16,
48
+ device_map="auto",
49
+ )
50
+
51
+ prompt = [{'role': 'user', 'content': """Marco ha comprato 5 scatole di cioccolatini. Ogni scatola contiene 12 cioccolatini. Ha deciso di dare 3 cioccolatini a ciascuno dei suoi 7 amici. Quanti cioccolatini gli rimarranno dopo averli distribuiti ai suoi amici?"""}]
52
+ inputs = tokenizer.apply_chat_template(
53
+ prompt,
54
+ add_generation_prompt=True,
55
+ return_tensors='pt'
56
+ )
57
+ tokens = model.generate(
58
+ inputs.to(model.device),
59
+ max_new_tokens=1024,
60
+ temperature=0.001,
61
+ do_sample=True
62
+ )
63
+
64
+ print(tokenizer.decode(tokens[0], skip_special_tokens=False))
65
+ ```
66
+
67
 
68
  ### Conclusion
69