Update README.md
Browse files
README.md
CHANGED
@@ -5,4 +5,27 @@ language:
|
|
5 |
pipeline_tag: text-generation
|
6 |
tags:
|
7 |
- chat
|
8 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
pipeline_tag: text-generation
|
6 |
tags:
|
7 |
- chat
|
8 |
+
---
|
9 |
+
|
10 |
+
This is the LLaMAfied version of [Qwen2-7B-Instruct](https://huggingface.co/Qwen/Qwen2-7B-Instruct) model by Alibaba Cloud.
|
11 |
+
The original codebase can be found at: (https://github.com/hiyouga/LLaMA-Factory/blob/main/tests/llamafy_qwen.py).
|
12 |
+
I have made modifications to make it compatible with qwen2.
|
13 |
+
This model is converted with https://github.com/Minami-su/character_AI_open/tree/main/Qwen2_llamafy_Mistralfy
|
14 |
+
|
15 |
+
Usage:
|
16 |
+
|
17 |
+
```python
|
18 |
+
|
19 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
|
20 |
+
tokenizer = AutoTokenizer.from_pretrained("Minami-su/Qwen2-7B-Instruct-llama")
|
21 |
+
model = AutoModelForCausalLM.from_pretrained("Minami-su/Qwen2-7B-Instruct-llama", torch_dtype="auto", device_map="auto")
|
22 |
+
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
|
23 |
+
|
24 |
+
messages = [
|
25 |
+
{"role": "user", "content": "Who are you?"}
|
26 |
+
]
|
27 |
+
inputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
|
28 |
+
inputs = inputs.to("cuda")
|
29 |
+
generate_ids = model.generate(inputs,max_length=2048, streamer=streamer)
|
30 |
+
|
31 |
+
```
|