Update README.md
Browse files
README.md
CHANGED
@@ -22,25 +22,46 @@ tags:
|
|
22 |
|
23 |
# **QwQ-LCoT-7B-Instruct Model File**
|
24 |
|
25 |
-
The
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
### **Sample Long CoT:**
|
46 |
|
|
|
22 |
|
23 |
# **QwQ-LCoT-7B-Instruct Model File**
|
24 |
|
25 |
+
The QwQ-LCoT-7B-Instruct is a fine-tuned language model designed for advanced reasoning and instruction-following tasks. It leverages the Qwen2.5-7B base model and has been fine-tuned on the amphora/QwQ-LongCoT-130K dataset, focusing on chain-of-thought (CoT) reasoning. This model is optimized for tasks requiring logical reasoning, detailed explanations, and multi-step problem-solving, making it ideal for applications such as instruction-following, text generation, and complex reasoning tasks.
|
26 |
+
|
27 |
+
## Quickstart with Transformers
|
28 |
+
|
29 |
+
Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
|
30 |
+
|
31 |
+
```python
|
32 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
33 |
+
|
34 |
+
model_name = "prithivMLmods/QwQ-LCoT-7B-Instruct"
|
35 |
+
|
36 |
+
model = AutoModelForCausalLM.from_pretrained(
|
37 |
+
model_name,
|
38 |
+
torch_dtype="auto",
|
39 |
+
device_map="auto"
|
40 |
+
)
|
41 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
42 |
+
|
43 |
+
prompt = "How many r in strawberry."
|
44 |
+
messages = [
|
45 |
+
{"role": "system", "content": "You are a helpful and harmless assistant. You are Qwen developed by Alibaba. You should think step-by-step."},
|
46 |
+
{"role": "user", "content": prompt}
|
47 |
+
]
|
48 |
+
text = tokenizer.apply_chat_template(
|
49 |
+
messages,
|
50 |
+
tokenize=False,
|
51 |
+
add_generation_prompt=True
|
52 |
+
)
|
53 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
54 |
+
|
55 |
+
generated_ids = model.generate(
|
56 |
+
**model_inputs,
|
57 |
+
max_new_tokens=512
|
58 |
+
)
|
59 |
+
generated_ids = [
|
60 |
+
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
61 |
+
]
|
62 |
+
|
63 |
+
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
64 |
+
```
|
65 |
|
66 |
### **Sample Long CoT:**
|
67 |
|