File size: 2,279 Bytes
f4513dc
 
262be5a
 
f4513dc
 
 
 
 
044f1be
f4513dc
 
 
 
 
 
044f1be
f4513dc
 
 
044f1be
f4513dc
 
 
 
 
044f1be
f4513dc
 
 
 
 
 
 
 
 
dc72e3a
f4513dc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
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)