feihu.hf
commited on
Commit
•
59188fd
1
Parent(s):
92e8388
update README & LICENSE
Browse files
README.md
CHANGED
@@ -9,6 +9,7 @@ base_model: Qwen/Qwen2.5-3B
|
|
9 |
tags:
|
10 |
- chat
|
11 |
---
|
|
|
12 |
# Qwen2.5-3B-Instruct
|
13 |
|
14 |
## Introduction
|
@@ -47,13 +48,16 @@ Here provides a code snippet with `apply_chat_template` to show you how to load
|
|
47 |
|
48 |
```python
|
49 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
|
50 |
model_name = "Qwen/Qwen2.5-3B-Instruct"
|
|
|
51 |
model = AutoModelForCausalLM.from_pretrained(
|
52 |
model_name,
|
53 |
torch_dtype="auto",
|
54 |
device_map="auto"
|
55 |
)
|
56 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
|
|
57 |
prompt = "Give me a short introduction to large language model."
|
58 |
messages = [
|
59 |
{"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
|
@@ -65,6 +69,7 @@ text = tokenizer.apply_chat_template(
|
|
65 |
add_generation_prompt=True
|
66 |
)
|
67 |
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
|
|
68 |
generated_ids = model.generate(
|
69 |
**model_inputs,
|
70 |
max_new_tokens=512
|
@@ -72,9 +77,11 @@ generated_ids = model.generate(
|
|
72 |
generated_ids = [
|
73 |
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
74 |
]
|
|
|
75 |
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
76 |
```
|
77 |
|
|
|
78 |
## Evaluation & Performance
|
79 |
|
80 |
Detailed evaluation results are reported in this [📑 blog](https://qwenlm.github.io/blog/qwen2.5/).
|
@@ -93,6 +100,7 @@ If you find our work helpful, feel free to give us a cite.
|
|
93 |
month = {September},
|
94 |
year = {2024}
|
95 |
}
|
|
|
96 |
@article{qwen2,
|
97 |
title={Qwen2 Technical Report},
|
98 |
author={An Yang and Baosong Yang and Binyuan Hui and Bo Zheng and Bowen Yu and Chang Zhou and Chengpeng Li and Chengyuan Li and Dayiheng Liu and Fei Huang and Guanting Dong and Haoran Wei and Huan Lin and Jialong Tang and Jialin Wang and Jian Yang and Jianhong Tu and Jianwei Zhang and Jianxin Ma and Jin Xu and Jingren Zhou and Jinze Bai and Jinzheng He and Junyang Lin and Kai Dang and Keming Lu and Keqin Chen and Kexin Yang and Mei Li and Mingfeng Xue and Na Ni and Pei Zhang and Peng Wang and Ru Peng and Rui Men and Ruize Gao and Runji Lin and Shijie Wang and Shuai Bai and Sinan Tan and Tianhang Zhu and Tianhao Li and Tianyu Liu and Wenbin Ge and Xiaodong Deng and Xiaohuan Zhou and Xingzhang Ren and Xinyu Zhang and Xipin Wei and Xuancheng Ren and Yang Fan and Yang Yao and Yichang Zhang and Yu Wan and Yunfei Chu and Yuqiong Liu and Zeyu Cui and Zhenru Zhang and Zhihao Fan},
|
|
|
9 |
tags:
|
10 |
- chat
|
11 |
---
|
12 |
+
|
13 |
# Qwen2.5-3B-Instruct
|
14 |
|
15 |
## Introduction
|
|
|
48 |
|
49 |
```python
|
50 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
51 |
+
|
52 |
model_name = "Qwen/Qwen2.5-3B-Instruct"
|
53 |
+
|
54 |
model = AutoModelForCausalLM.from_pretrained(
|
55 |
model_name,
|
56 |
torch_dtype="auto",
|
57 |
device_map="auto"
|
58 |
)
|
59 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
60 |
+
|
61 |
prompt = "Give me a short introduction to large language model."
|
62 |
messages = [
|
63 |
{"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
|
|
|
69 |
add_generation_prompt=True
|
70 |
)
|
71 |
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
72 |
+
|
73 |
generated_ids = model.generate(
|
74 |
**model_inputs,
|
75 |
max_new_tokens=512
|
|
|
77 |
generated_ids = [
|
78 |
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
79 |
]
|
80 |
+
|
81 |
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
82 |
```
|
83 |
|
84 |
+
|
85 |
## Evaluation & Performance
|
86 |
|
87 |
Detailed evaluation results are reported in this [📑 blog](https://qwenlm.github.io/blog/qwen2.5/).
|
|
|
100 |
month = {September},
|
101 |
year = {2024}
|
102 |
}
|
103 |
+
|
104 |
@article{qwen2,
|
105 |
title={Qwen2 Technical Report},
|
106 |
author={An Yang and Baosong Yang and Binyuan Hui and Bo Zheng and Bowen Yu and Chang Zhou and Chengpeng Li and Chengyuan Li and Dayiheng Liu and Fei Huang and Guanting Dong and Haoran Wei and Huan Lin and Jialong Tang and Jialin Wang and Jian Yang and Jianhong Tu and Jianwei Zhang and Jianxin Ma and Jin Xu and Jingren Zhou and Jinze Bai and Jinzheng He and Junyang Lin and Kai Dang and Keming Lu and Keqin Chen and Kexin Yang and Mei Li and Mingfeng Xue and Na Ni and Pei Zhang and Peng Wang and Ru Peng and Rui Men and Ruize Gao and Runji Lin and Shijie Wang and Shuai Bai and Sinan Tan and Tianhang Zhu and Tianhao Li and Tianyu Liu and Wenbin Ge and Xiaodong Deng and Xiaohuan Zhou and Xingzhang Ren and Xinyu Zhang and Xipin Wei and Xuancheng Ren and Yang Fan and Yang Yao and Yichang Zhang and Yu Wan and Yunfei Chu and Yuqiong Liu and Zeyu Cui and Zhenru Zhang and Zhihao Fan},
|