Eurdem commited on
Commit
948b0e8
1 Parent(s): f1e2486

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +42 -3
README.md CHANGED
@@ -1,3 +1,42 @@
1
- ---
2
- license: llama3
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: llama3
3
+ tags:
4
+ - moe
5
+ - merge
6
+ language:
7
+ - en
8
+ ---
9
+
10
+ # Megatron_llama3_2x8B
11
+
12
+ Megatron_llama3_2x8B is a Mixure of Experts (MoE) (two llama3 models)
13
+
14
+
15
+ ## 💻 Usage
16
+
17
+ ```python
18
+ !pip install -qU transformers bitsandbytes accelerate
19
+
20
+ model_id = "Eurdem/Megatron_llama3_2x8B"
21
+
22
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
23
+ model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto", load_in_4bit= True)
24
+
25
+ messages = [
26
+ {"role": "system", "content": "You are a helpful chatbot who always responds friendly."},
27
+ {"role": "user", "content": "f(x)=3x^2+4x+12 so what is f(3)?"},
28
+ ]
29
+
30
+ input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt").to("cuda")
31
+
32
+ outputs = model.generate(input_ids,
33
+ max_new_tokens=1024,
34
+ do_sample=True,
35
+ temperature=0.7,
36
+ top_p=0.7,
37
+ top_k=500,
38
+ eos_token_id = tokenizer.eos_token_id
39
+ )
40
+ response = outputs[0][input_ids.shape[-1]:]
41
+ print(tokenizer.decode(response, skip_special_tokens=True))
42
+ ```