Update README.md
Browse files
README.md
CHANGED
@@ -11,7 +11,6 @@ pipeline_tag: text-generation
|
|
11 |
library_name: transformers
|
12 |
---
|
13 |
|
14 |
-
|
15 |
## 💻 For English
|
16 |
Megatron_llama3_2x8B is a Mixure of Experts (MoE) (two llama3 models)
|
17 |
|
@@ -28,8 +27,8 @@ tokenizer = AutoTokenizer.from_pretrained(model_id)
|
|
28 |
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto", load_in_8bit= True)
|
29 |
|
30 |
messages = [
|
31 |
-
{"role": "system", "content": "You are a helpful chatbot who always responds friendly."},
|
32 |
-
{"role": "user", "content": "f(x)=3x^2+4x+12 so what is f(3)?"},
|
33 |
]
|
34 |
|
35 |
input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt").to("cuda")
|
@@ -45,12 +44,24 @@ outputs = model.generate(input_ids,
|
|
45 |
response = outputs[0][input_ids.shape[-1]:]
|
46 |
print(tokenizer.decode(response, skip_special_tokens=True))
|
47 |
```
|
|
|
|
|
|
|
48 |
|
49 |
-
|
50 |
|
|
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
## 💻 Türkçe İçin
|
|
|
54 |
|
55 |
```python
|
56 |
!pip install -qU transformers bitsandbytes accelerate
|
@@ -61,7 +72,7 @@ import torch
|
|
61 |
model_id = "Eurdem/Megatron_llama3_2x8B"
|
62 |
|
63 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
64 |
-
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto",
|
65 |
|
66 |
messages = [
|
67 |
{"role": "system", "content": "Sen Defne isimli Türkçe konuşan bir chatbotsun."},
|
@@ -81,9 +92,9 @@ outputs = model.generate(input_ids,
|
|
81 |
response = outputs[0][input_ids.shape[-1]:]
|
82 |
print(tokenizer.decode(response, skip_special_tokens=True))
|
83 |
```
|
84 |
-
|
85 |
### Çıktı
|
86 |
-
```
|
|
|
87 |
|
88 |
Sorunuzun 2. kısmı için, f(x) = 3x^2 + 4x + 12 formülünü ele alalım. f(3)'ün hesabını yapalım:
|
89 |
|
@@ -92,4 +103,5 @@ f(3) = 3(3)^2 + 4(3) + 12
|
|
92 |
= 27 + 24
|
93 |
= 51
|
94 |
|
95 |
-
Bu nedenle, f(3) 51'dir
|
|
|
|
11 |
library_name: transformers
|
12 |
---
|
13 |
|
|
|
14 |
## 💻 For English
|
15 |
Megatron_llama3_2x8B is a Mixure of Experts (MoE) (two llama3 models)
|
16 |
|
|
|
27 |
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto", load_in_8bit= True)
|
28 |
|
29 |
messages = [
|
30 |
+
{"role": "system", "content": "You are a helpful chatbot, named Defne, who always responds friendly."},
|
31 |
+
{"role": "user", "content": "Answer the questions: 1) Who are you? 2) f(x)=3x^2+4x+12 so what is f(3)?"},
|
32 |
]
|
33 |
|
34 |
input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt").to("cuda")
|
|
|
44 |
response = outputs[0][input_ids.shape[-1]:]
|
45 |
print(tokenizer.decode(response, skip_special_tokens=True))
|
46 |
```
|
47 |
+
### Output
|
48 |
+
```
|
49 |
+
Hello there! I'm Defne, a friendly chatbot here to help with any questions you may have.
|
50 |
|
51 |
+
Now, let's get to the math problem!
|
52 |
|
53 |
+
The function is f(x) = 3x^2 + 4x + 12, and we want to find f(3). To do that, we can plug in 3 for x in the function:
|
54 |
|
55 |
+
f(3) = 3(3)^2 + 4(3) + 12
|
56 |
+
f(3) = 3(9) + 12 + 12
|
57 |
+
f(3) = 27 + 24
|
58 |
+
f(3) = 51
|
59 |
+
|
60 |
+
So, f(3) is equal to 51!
|
61 |
+
```
|
62 |
|
63 |
## 💻 Türkçe İçin
|
64 |
+
Megatron_llama3_2x8B, iki llama3 8B modelinin birleşmesi ile oluşturulan MoE yapısında bir modeldir.
|
65 |
|
66 |
```python
|
67 |
!pip install -qU transformers bitsandbytes accelerate
|
|
|
72 |
model_id = "Eurdem/Megatron_llama3_2x8B"
|
73 |
|
74 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
75 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto", load_in_8bit= True)
|
76 |
|
77 |
messages = [
|
78 |
{"role": "system", "content": "Sen Defne isimli Türkçe konuşan bir chatbotsun."},
|
|
|
92 |
response = outputs[0][input_ids.shape[-1]:]
|
93 |
print(tokenizer.decode(response, skip_special_tokens=True))
|
94 |
```
|
|
|
95 |
### Çıktı
|
96 |
+
```
|
97 |
+
Merhaba! Ben Sen Defne, Türkçe konuşan bir chatbotum. Hizmetinizdeyim.
|
98 |
|
99 |
Sorunuzun 2. kısmı için, f(x) = 3x^2 + 4x + 12 formülünü ele alalım. f(3)'ün hesabını yapalım:
|
100 |
|
|
|
103 |
= 27 + 24
|
104 |
= 51
|
105 |
|
106 |
+
Bu nedenle, f(3) 51'dir.
|
107 |
+
```
|