ehristoforu
commited on
Commit
•
51fca04
1
Parent(s):
6fc8e6c
Update README.md
Browse files
README.md
CHANGED
@@ -4,10 +4,54 @@ pipeline_tag: text-generation
|
|
4 |
language:
|
5 |
- en
|
6 |
- ru
|
|
|
|
|
|
|
|
|
7 |
---
|
8 |
|
9 |
### theqwenmoe
|
10 |
- 18.3B parametrs
|
11 |
- English & Russian
|
12 |
- Math & Logic
|
13 |
-
- Code: Python, Javascript, Java, PHP, C++, C#, ...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
language:
|
5 |
- en
|
6 |
- ru
|
7 |
+
base_model:
|
8 |
+
- Qwen/Qwen2.5-7B-Instruct
|
9 |
+
tags:
|
10 |
+
- qwen2.5
|
11 |
---
|
12 |
|
13 |
### theqwenmoe
|
14 |
- 18.3B parametrs
|
15 |
- English & Russian
|
16 |
- Math & Logic
|
17 |
+
- Code: Python, Javascript, Java, PHP, C++, C#, ...
|
18 |
+
|
19 |
+
This is experimental model. Can be bugs and various problems.
|
20 |
+
|
21 |
+
Made with mergekit and unsloth apps by ehristoforu.
|
22 |
+
|
23 |
+
Code usage example:
|
24 |
+
```py
|
25 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
26 |
+
|
27 |
+
model_name = "ehristoforu/theqwenmoe"
|
28 |
+
|
29 |
+
model = AutoModelForCausalLM.from_pretrained(
|
30 |
+
model_name,
|
31 |
+
torch_dtype="auto",
|
32 |
+
device_map="auto"
|
33 |
+
)
|
34 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
35 |
+
|
36 |
+
prompt = "Give me a short introduction to large language model."
|
37 |
+
messages = [
|
38 |
+
{"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
|
39 |
+
{"role": "user", "content": prompt}
|
40 |
+
]
|
41 |
+
text = tokenizer.apply_chat_template(
|
42 |
+
messages,
|
43 |
+
tokenize=False,
|
44 |
+
add_generation_prompt=True
|
45 |
+
)
|
46 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
47 |
+
|
48 |
+
generated_ids = model.generate(
|
49 |
+
**model_inputs,
|
50 |
+
max_new_tokens=512
|
51 |
+
)
|
52 |
+
generated_ids = [
|
53 |
+
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
54 |
+
]
|
55 |
+
|
56 |
+
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
57 |
+
```
|