Downloads · 30 days
502
14% of all-time downloads
eagle0504/qwen-2_5-1_5b-instruct-using-openai-gsm8k-data-enhanced-with-deepseek-v2
qwen-2_5-1_5b-instruct-using-openai-gsm8k-data-enhanced-with-deepseek-v2 is a machine learning model from eagle0504. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as mit.
This model is a fine-tuned version of Qwen2.5-1.5B-Instruct, designed for mathematical problem-solving and structured reasoning. It is trained on an enhanced GSM8K dataset incorporating Chain-of-Thought (CoT) reasonin…
Downloads · 30 days
502
14% of all-time downloads
All-time downloads
3.7K
Public
Parameters
1.5B
11.7 GB on disk
Likes
0
Public
Click a slice to open those files.
.gguf6.9 GB · 68%
From the Hugging Face model README
This model is a fine-tuned version of Qwen2.5-1.5B-Instruct, designed for mathematical problem-solving and structured reasoning. It is trained on an enhanced GSM8K dataset incorporating Chain-of-Thought (CoT) reasoning augmented by DeepSeek AI.
llama.cppen)Qwen/Qwen2.5-1.5B-Instructtransformers + unsloth + trlQ4_K_M, Q8_0, Q5_K_M, f16)🔗 Hugging Face Repository:
👉 Fine-tuned Qwen2.5-1.5B-Instruct
transformers in PythonYou may need to install bitsandbytes by using
! pip install -U bitsandbytes
Then you can use the following code to run inference.
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load model and tokenizer
model_name = "eagle0504/qwen-2_5-1_5b-instruct-using-openai-gsm8k-data-enhanced-with-deepseek-v2"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
# Move model to GPU if available
device = "cuda" if torch.cuda.is_available() else "cpu"
model.to(device)
# Example inference
question = "Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May?"
inputs = tokenizer(question, return_tensors="pt").to(device)
output = model.generate(**inputs, max_length=200)
# Decode response
print(tokenizer.decode(output[0], skip_special_tokens=True))
llama.cppllama.cppbrew install llama.cpp
mkdir -p ~/llama_models && cd ~/llama_models
wget https://huggingface.co/eagle0504/qwen-2_5-1_5b-instruct-using-openai-gsm8k-data-enhanced-with-deepseek-v2/resolve/main/q8_0.gguf
llama-cli -m ~/llama_models/q8_0.gguf --interactive
Or you can use the following:
llama-cli -hf eagle0504/qwen-2_5-1_5b-instruct-using-openai-gsm8k-data-enhanced-with-deepseek-v2:Q8_0
llama-cli -m ~/llama_models/q8_0.gguf -p "Explain quantum computing in simple terms."
def count_xml(text: str) -> float:
"""
Calculates a reward based on the occurrence of certain XML tags and subtracts penalties for content after closing tags.
Args:
text (str): The text string to analyze for XML tag consistency.
Returns:
float: Total reward score based on XML tag occurrence and penalties.
"""
count = 0.0
if text.count("<think>\n") == 1:
count += 0.125
if text.count("\n</think>\n") == 1:
count += 0.125
if text.count("\n<answer>\n") == 1:
count += 0.125
count -= len(text.split("\n</answer>\n")[-1])*0.001
if text.count("\n</answer>") == 1:
count += 0.125
count -= (len(text.split("\n</answer>")[-1]) - 1)*0.001
# Ensure `<think>` and `</think>` exist
if "<think>" in text and "</think>" in text:
count += 1.0 # Higher weight to ensure reasoning consistency
else:
count -= 1.0 # Penalize if missing
return count
Each component contributes to the total reward if conditions are met:
| Condition | Reward |
|---|---|
"<think>\n" appears exactly once | +0.125 |
"\n</think>\n" appears exactly once | +0.125 |
"\n<answer>\n" appears exactly once | +0.125 |
"\n</answer>" appears exactly once | +0.125 |
Both <think> and </think> exist anywhere | +1.0 |
No extra text after "</answer>" | No penalty |
Total possible reward before penalties: [ 0.125 + 0.125 + 0.125 + 0.125 + 1.0 = 1.5 ]
Potential Penalties
The function applies penalties for extra content after "</answer>":
[
-\left( \text{length of extra text} \times 0.001 \right)
]
If the best case occurs (i.e., no extra content), then:
Best Possible Input Example This ideal input gives the highest possible reward:
<think>
Valid reasoning goes here.
</think>
<answer>
Correct final answer here.
</answer>
This means we customize the reward function so that we encourage the answer to have reasoning inside. We also know mathematically what the reward should be so we can monitor it during training process.
The model was fine-tuned on:
🔹 eagle0504/openai-gsm8k-enhanced-using-together-ai-deepseek-train8k-test1k-v1
This dataset contains:
question, answer, cot (Chain-of-Thought)transformers + unsloth + trl1e-6bf16 or fp16)81024| Step | XML Count |
|---|---|
| 10 | -1 |
| 100 | -1 |
| 500 | -0.6421 |
| 750 | 0.7611 |
| 1000 | 1.0506 |
As we can see, after 1000 steps, we see the reward of XML Count is above 1, which is getting good. This took about 1h 46min 50s on a T4 GPU in Colab with High RAM.
Estimated Carbon Emissions:
Upcoming
For questions, suggestions, or issues, reach out via Hugging Face Discussions.
🎉 Thank you for using this model! If you find it useful, please ⭐ it on Hugging Face! 🚀🔥