mzbac commited on
Commit
ba21751
·
verified ·
1 Parent(s): b8864e9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +36 -1
README.md CHANGED
@@ -1 +1,36 @@
1
- A Moe model built on top of microsoft/phi-2, g-ronimo/phi-2-OpenHermes-2.5 and mlx-community/phi-2-dpo-7k, then qlora on WizardLM_evol_instruct_70k
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ A Moe model built on top of microsoft/phi-2, g-ronimo/phi-2-OpenHermes-2.5 and mlx-community/phi-2-dpo-7k, then qlora on WizardLM_evol_instruct_70k
2
+
3
+
4
+ ## Example
5
+ ```
6
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
7
+ import torch
8
+
9
+ DEV = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
10
+
11
+
12
+ model_name_or_path = "mzbac/phi2-2x3"
13
+
14
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
15
+ trust_remote_code=True,
16
+ torch_dtype=torch.bfloat16,
17
+ )
18
+ model.to(DEV)
19
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
20
+
21
+ prompt = "Instruct: how backpropagation works.\nOutput:"
22
+
23
+ print("\n\n*** Generate:")
24
+
25
+ inputs = tokenizer.encode(prompt, return_tensors="pt").to(DEV)
26
+
27
+ generate_kwargs = dict(
28
+ input_ids=inputs,
29
+ temperature=0.3,
30
+ max_new_tokens=500,
31
+ do_sample=True,
32
+ )
33
+
34
+ outputs = model.generate(**generate_kwargs)
35
+ print(tokenizer.decode(outputs[0]))
36
+ ```