jxy
commited on
Commit
·
4795825
1
Parent(s):
fac4d35
add readme
Browse files
README.md
CHANGED
@@ -1,3 +1,43 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
4 |
+
|
5 |
+
|
6 |
+
Homer-v1.0-Qwen2.5-7B is a fine-tuned version of Qwen2.5-7B using a large amount of instruction-based data.
|
7 |
+
We released the math subset of our dataset (https://huggingface.co/datasets/newsbang/homer_math_v0.1), and we also analyzed the data leakage of current open-source math datasets on the benchmark (https://huggingface.co/datasets/newsbang/math_benbench_data_leak_analysis).
|
8 |
+
|
9 |
+
|
10 |
+
### How to use
|
11 |
+
```python
|
12 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
13 |
+
|
14 |
+
model_name = "newsbang/Homer-v1.0-Qwen2.5-7B"
|
15 |
+
|
16 |
+
model = AutoModelForCausalLM.from_pretrained(
|
17 |
+
model_name,
|
18 |
+
torch_dtype="auto",
|
19 |
+
device_map="auto"
|
20 |
+
)
|
21 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
22 |
+
|
23 |
+
messages = [
|
24 |
+
{"role": "system", "content": "You are a very helpful assistant."},
|
25 |
+
{"role": "user", "content": "Hello"}
|
26 |
+
]
|
27 |
+
text = tokenizer.apply_chat_template(
|
28 |
+
messages,
|
29 |
+
tokenize=False,
|
30 |
+
add_generation_prompt=True
|
31 |
+
)
|
32 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
33 |
+
|
34 |
+
generated_ids = model.generate(
|
35 |
+
**model_inputs,
|
36 |
+
max_new_tokens=512
|
37 |
+
)
|
38 |
+
generated_ids = [
|
39 |
+
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
40 |
+
]
|
41 |
+
|
42 |
+
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
43 |
+
```
|