|
|
--- |
|
|
license: mit |
|
|
base_model: |
|
|
- Qwen/Qwen2.5-3B-Instruct |
|
|
--- |
|
|
--- |
|
|
|
|
|
# Emo-v1 |
|
|
|
|
|
**A lightweight 3B parameter model fine-tuned for Reasoning.** |
|
|
*Specialized in Algebra, Logic Puzzles, and Step-by-Step Reasoning.* |
|
|
|
|
|
</div> |
|
|
|
|
|
## 📖 Model Description |
|
|
|
|
|
**Emo-v1** is a fine-tuned version of [Qwen/Qwen2.5-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-3B-Instruct), optimized for mathematical reasoning and logic. |
|
|
|
|
|
Unlike standard chat models that often guess answers, Emo-Qwen is trained to **decompose problems into explicit steps** before providing a final solution. It mimics the "Chain of Thought" (CoT) process found in larger reasoning models (like OpenAI's o1), making it surprisingly capable for its small size. |
|
|
|
|
|
### Key Features |
|
|
* **Step-by-Step Reasoning:** Forces a "Let's break this down" approach to minimize logic errors. |
|
|
* **Math Specialist:** Trained on the `nvidia/OpenMathInstruct-2` dataset, covering algebra, calculus, and probability. |
|
|
* **LaTeX Support:** Optimized to output mathematical formulas in clean LaTeX format (e.g., $x^2 + y^2$). |
|
|
* **Efficient:** At only 3 Billion parameters, it runs on consumer hardware (even free Kaggle/Colab T4 GPUs) with low latency. |
|
|
|
|
|
## How to Use |
|
|
|
|
|
|
|
|
### Python Inference Code |
|
|
|
|
|
```python |
|
|
import torch |
|
|
from transformers import AutoModelForCausalLM, AutoTokenizer |
|
|
|
|
|
# 1. Load Model |
|
|
model_id = "PrimeTJ/Emo-v1" |
|
|
tokenizer = AutoTokenizer.from_pretrained(model_id) |
|
|
model = AutoModelForCausalLM.from_pretrained( |
|
|
model_id, |
|
|
torch_dtype=torch.float16, |
|
|
device_map="auto" |
|
|
) |
|
|
|
|
|
# 2. Define the Prompt |
|
|
system_prompt = "You are a helpful math assistant. Think step by step." |
|
|
user_prompt = "A bat and a ball cost $1.10 in total. The bat costs $1.00 more than the ball. How much does the ball cost?" |
|
|
|
|
|
messages = [ |
|
|
{"role": "system", "content": system_prompt}, |
|
|
{"role": "user", "content": user_prompt} |
|
|
] |
|
|
|
|
|
# 3. Generate |
|
|
text = tokenizer.apply_chat_template( |
|
|
messages, |
|
|
tokenize=False, |
|
|
add_generation_prompt=True |
|
|
) |
|
|
model_inputs = tokenizer([text], return_tensors="pt").to(model.device) |
|
|
|
|
|
generated_ids = model.generate( |
|
|
**model_inputs, |
|
|
max_new_tokens=1024, |
|
|
temperature=0.6 # Low temperature for logic |
|
|
) |
|
|
|
|
|
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0] |
|
|
print(response) |