Update README.md
Browse files
README.md
CHANGED
@@ -1,202 +1,131 @@
|
|
1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
library_name: transformers
|
3 |
tags:
|
|
|
4 |
- unsloth
|
5 |
- trl
|
6 |
- grpo
|
|
|
|
|
|
|
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 |
-
- **Repository:** [More Information Needed]
|
36 |
-
- **Paper [optional]:** [More Information Needed]
|
37 |
-
- **Demo [optional]:** [More Information Needed]
|
38 |
-
|
39 |
-
## Uses
|
40 |
-
|
41 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
42 |
-
|
43 |
-
### Direct Use
|
44 |
-
|
45 |
-
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
46 |
-
|
47 |
-
[More Information Needed]
|
48 |
-
|
49 |
-
### Downstream Use [optional]
|
50 |
-
|
51 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
52 |
-
|
53 |
-
[More Information Needed]
|
54 |
-
|
55 |
-
### Out-of-Scope Use
|
56 |
-
|
57 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
58 |
-
|
59 |
-
[More Information Needed]
|
60 |
-
|
61 |
-
## Bias, Risks, and Limitations
|
62 |
-
|
63 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
64 |
-
|
65 |
-
[More Information Needed]
|
66 |
-
|
67 |
-
### Recommendations
|
68 |
-
|
69 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
70 |
-
|
71 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
72 |
-
|
73 |
-
## How to Get Started with the Model
|
74 |
-
|
75 |
-
Use the code below to get started with the model.
|
76 |
-
|
77 |
-
[More Information Needed]
|
78 |
-
|
79 |
-
## Training Details
|
80 |
-
|
81 |
-
### Training Data
|
82 |
-
|
83 |
-
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
84 |
-
|
85 |
-
[More Information Needed]
|
86 |
-
|
87 |
-
### Training Procedure
|
88 |
-
|
89 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
90 |
-
|
91 |
-
#### Preprocessing [optional]
|
92 |
-
|
93 |
-
[More Information Needed]
|
94 |
-
|
95 |
-
|
96 |
-
#### Training Hyperparameters
|
97 |
-
|
98 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
99 |
-
|
100 |
-
#### Speeds, Sizes, Times [optional]
|
101 |
-
|
102 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
103 |
-
|
104 |
-
[More Information Needed]
|
105 |
-
|
106 |
-
## Evaluation
|
107 |
-
|
108 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
109 |
-
|
110 |
-
### Testing Data, Factors & Metrics
|
111 |
-
|
112 |
-
#### Testing Data
|
113 |
-
|
114 |
-
<!-- This should link to a Dataset Card if possible. -->
|
115 |
-
|
116 |
-
[More Information Needed]
|
117 |
-
|
118 |
-
#### Factors
|
119 |
-
|
120 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
121 |
-
|
122 |
-
[More Information Needed]
|
123 |
-
|
124 |
-
#### Metrics
|
125 |
-
|
126 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
127 |
-
|
128 |
-
[More Information Needed]
|
129 |
-
|
130 |
-
### Results
|
131 |
-
|
132 |
-
[More Information Needed]
|
133 |
-
|
134 |
-
#### Summary
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
## Model Examination [optional]
|
139 |
-
|
140 |
-
<!-- Relevant interpretability work for the model goes here -->
|
141 |
-
|
142 |
-
[More Information Needed]
|
143 |
-
|
144 |
-
## Environmental Impact
|
145 |
-
|
146 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
147 |
-
|
148 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
149 |
-
|
150 |
-
- **Hardware Type:** [More Information Needed]
|
151 |
-
- **Hours used:** [More Information Needed]
|
152 |
-
- **Cloud Provider:** [More Information Needed]
|
153 |
-
- **Compute Region:** [More Information Needed]
|
154 |
-
- **Carbon Emitted:** [More Information Needed]
|
155 |
-
|
156 |
-
## Technical Specifications [optional]
|
157 |
|
158 |
-
|
159 |
|
160 |
-
|
|
|
161 |
|
162 |
-
###
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
|
164 |
-
|
165 |
|
166 |
-
|
|
|
|
|
|
|
167 |
|
168 |
-
|
169 |
|
170 |
-
|
|
|
|
|
|
|
171 |
|
172 |
-
|
173 |
|
174 |
-
|
|
|
|
|
|
|
|
|
|
|
175 |
|
176 |
-
|
177 |
|
178 |
-
**
|
|
|
179 |
|
180 |
-
|
|
|
181 |
|
182 |
-
|
183 |
|
184 |
-
|
|
|
185 |
|
186 |
-
|
|
|
|
|
|
|
|
|
187 |
|
188 |
-
|
189 |
|
190 |
-
|
|
|
|
|
|
|
|
|
191 |
|
192 |
-
|
193 |
|
194 |
-
|
|
|
|
|
195 |
|
196 |
-
|
197 |
|
198 |
-
|
199 |
|
200 |
-
|
201 |
|
202 |
-
|
|
|
|
1 |
---
|
2 |
+
license: mit
|
3 |
+
datasets:
|
4 |
+
- eagle0504/openai-gsm8k-enhanced-using-together-ai-deepseek-train8k-test1k-v1
|
5 |
+
language:
|
6 |
+
- en
|
7 |
+
base_model:
|
8 |
+
- deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B
|
9 |
library_name: transformers
|
10 |
tags:
|
11 |
+
- fine-tuned
|
12 |
- unsloth
|
13 |
- trl
|
14 |
- grpo
|
15 |
+
- deepseek
|
16 |
+
- gsm8k
|
17 |
+
- reasoning
|
18 |
---
|
19 |
|
20 |
+
# **DeepSeek-R1-Distill-Qwen-1.5B Fine-Tuned on GSM8K with Chain-of-Thought Augmentation**
|
21 |
|
22 |
+
## **Model Overview**
|
23 |
+
This model is a fine-tuned version of **DeepSeek-R1-Distill-Qwen-1.5B**, trained on the **OpenAI GSM8K dataset**, augmented with **Chain-of-Thought (CoT) reasoning** using **DeepSeek-V3**. The fine-tuning process enhances the modelβs **mathematical problem-solving abilities**, allowing it to provide **step-by-step solutions** with deeper reasoning.
|
24 |
|
25 |
+
### **πΉ Key Features**
|
26 |
+
- **Base Model**: DeepSeek-R1-Distill-Qwen-1.5B
|
27 |
+
- **Fine-Tuned On**: GSM8K dataset with DeepSeek-V3-enhanced reasoning
|
28 |
+
- **Improved Mathematical Reasoning**: Generates detailed step-by-step CoT explanations
|
29 |
+
- **Optimized for GRPO Training**: Trained using `trl` and `unsloth` for efficient fine-tuning
|
30 |
|
31 |
+
---
|
32 |
|
33 |
+
## **π Dataset & Training Details**
|
34 |
+
- **Dataset**: `eagle0504/openai-gsm8k-enhanced-using-together-ai-deepseek-train8k-test1k-v1`
|
35 |
+
- **8K train samples**, **1K test samples**
|
36 |
+
- Contains **question**, **answer**, and **CoT reasoning**
|
37 |
+
- **Training Methodology**:
|
38 |
+
- Used **Guided Reinforcement Policy Optimization (GRPO)** via `trl`
|
39 |
+
- Applied **gradient accumulation** to manage larger batch sizes
|
40 |
+
- Integrated **DeepSeek-V3 augmentation** for enhanced logical reasoning
|
41 |
+
- **Fine-tuning Tools**:
|
42 |
+
- **Unsloth** for memory-efficient Llama-based tuning
|
43 |
+
- **Hugging Face Transformers** for model training
|
44 |
+
|
45 |
+
For those interested in replicating the fine-tuning process, I have shared an **updated Colab notebook** π:
|
46 |
+
π [Colab Notebook](https://colab.research.google.com/drive/1HV0YkyiTD55j1xLRBHwJ_q3ex82W5EXr?usp=sharing)
|
47 |
+
|
48 |
+
You will need:
|
49 |
+
β
Hugging Face Token
|
50 |
+
β
Together.AI API Key
|
51 |
+
β
Unsloth Package
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
+
---
|
54 |
|
55 |
+
## **π How to Run the Model (Mac via `llama.cpp`)**
|
56 |
+
Yes! You can run this model **locally on macOS** using `llama.cpp`.
|
57 |
|
58 |
+
### **1οΈβ£ Install Homebrew (If Not Installed)**
|
59 |
+
```sh
|
60 |
+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
61 |
+
```
|
62 |
+
Then add Homebrew to your PATH:
|
63 |
+
```sh
|
64 |
+
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
|
65 |
+
eval "$(/opt/homebrew/bin/brew shellenv)"
|
66 |
+
```
|
67 |
|
68 |
+
---
|
69 |
|
70 |
+
### **2οΈβ£ Install `llama.cpp`**
|
71 |
+
```sh
|
72 |
+
brew install llama.cpp
|
73 |
+
```
|
74 |
|
75 |
+
---
|
76 |
|
77 |
+
### **3οΈβ£ Run the Model with `llama-cli`**
|
78 |
+
```sh
|
79 |
+
llama-cli -hf eagle0504/deepseek-r1-qwen-1.5b-gsm8k-enhanced-gguf:Q8_0
|
80 |
+
```
|
81 |
|
82 |
+
---
|
83 |
|
84 |
+
### **4οΈβ£ Alternative: Run Locally via GGUF**
|
85 |
+
```sh
|
86 |
+
mkdir -p ~/llama_models && cd ~/llama_models
|
87 |
+
wget https://huggingface.co/eagle0504/deepseek-r1-qwen-1.5b-gsm8k-enhanced-gguf/resolve/main/Q8_0.gguf
|
88 |
+
llama-cli -m ~/llama_models/Q8_0.gguf --interactive
|
89 |
+
```
|
90 |
|
91 |
+
---
|
92 |
|
93 |
+
## **π How to Use Model via Python (`transformers`)**
|
94 |
+
You can load the model with **Hugging Face Transformers**:
|
95 |
|
96 |
+
```python
|
97 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
98 |
|
99 |
+
model_name = "eagle0504/deepseek-r1-qwen-1.5b-gsm8k-enhanced"
|
100 |
|
101 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
102 |
+
model = AutoModelForCausalLM.from_pretrained(model_name)
|
103 |
|
104 |
+
prompt = "A farmer has 24 apples. He gives 6 to each of his 3 children. How many does he have left?"
|
105 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
106 |
+
output = model.generate(**inputs, max_length=200)
|
107 |
+
print(tokenizer.decode(output[0], skip_special_tokens=True))
|
108 |
+
```
|
109 |
|
110 |
+
---
|
111 |
|
112 |
+
## **π¬ Expected Performance**
|
113 |
+
Compared to the base **DeepSeek-R1-Distill-Qwen-1.5B**, this fine-tuned model:
|
114 |
+
- Provides **more detailed Chain-of-Thought (CoT) explanations** for GSM8K problems.
|
115 |
+
- Improves **logical reasoning and step-by-step answer formulation**.
|
116 |
+
- Generates **clearer, more structured solutions**, making it **ideal for educational use**.
|
117 |
|
118 |
+
---
|
119 |
|
120 |
+
## **π Model Hosting & License**
|
121 |
+
π **Model on Hugging Face Hub**:
|
122 |
+
π **[eagle0504/deepseek-r1-qwen-1.5b-gsm8k-enhanced](https://huggingface.co/eagle0504/deepseek-r1-qwen-1.5b-gsm8k-enhanced)**
|
123 |
|
124 |
+
π **License**: MIT License β Open for modification and distribution.
|
125 |
|
126 |
+
---
|
127 |
|
128 |
+
If you have **feedback or ideas for improvement**, feel free to reach out! ππ₯
|
129 |
|
130 |
+
#AI #MachineLearning #DeepSeek #GSM8K #LLM #ChainOfThought #HuggingFace #GRPO #Reasoning
|
131 |
+
```
|