Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,105 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
datasets:
|
4 |
+
- huihui-ai/QWQ-LONGCOT-500K
|
5 |
+
- huihui-ai/LONGCOT-Refine-500K
|
6 |
+
base_model:
|
7 |
+
- huihui-ai/Llama-3.2-3B-Instruct-abliterated
|
8 |
+
|
9 |
+
tags:
|
10 |
+
- llama3.2
|
11 |
+
- abliterated
|
12 |
+
- uncensored
|
13 |
+
---
|
14 |
+
# MicroThinker-3B-Preview
|
15 |
+
|
16 |
+
MicroThinker-3B-Preview, a new model fine-tuned from the [huihui-ai/Llama-3.2-3B-Instruct-abliterated](https://huggingface.co/huihui-ai/Llama-3.2-3B-Instruct-abliterated) model, focused on advancing AI reasoning capabilities.
|
17 |
+
|
18 |
+
## Training Details
|
19 |
+
|
20 |
+
This is just a test, but the performance is quite good.
|
21 |
+
|
22 |
+
The model is still being fine-tuned, but it will be ready very soon.
|
23 |
+
|
24 |
+
Now, I'll introduce the test environment.
|
25 |
+
|
26 |
+
The model was trained using 1 RTX 4090 GPU(24GB) .
|
27 |
+
|
28 |
+
The fine-tuning process used only 20,000 records from each dataset.
|
29 |
+
|
30 |
+
The [SFT (Supervised Fine-Tuning)](https://github.com/modelscope/ms-swift) process is divided into several steps, and no code needs to be written.
|
31 |
+
1. Create the environment.
|
32 |
+
|
33 |
+
```
|
34 |
+
conda create -yn ms-swift python=3.11
|
35 |
+
conda activate ms-swift
|
36 |
+
|
37 |
+
git clone https://github.com/modelscope/ms-swift.git
|
38 |
+
|
39 |
+
cd ms-swift
|
40 |
+
pip install -e .
|
41 |
+
cd ..
|
42 |
+
```
|
43 |
+
|
44 |
+
|
45 |
+
2. Download the model and dataset.
|
46 |
+
|
47 |
+
```
|
48 |
+
huggingface-cli download huihui-ai/Llama-3.2-3B-Instruct-abliterated --local-dir ./huihui-ai/Llama-3.2-3B-Instruct-abliterated
|
49 |
+
huggingface-cli download --repo-type dataset huihui-ai/QWQ-LONGCOT-500K --local-dir ./data/QWQ-LONGCOT-500K
|
50 |
+
huggingface-cli download --repo-type dataset huihui-ai/LONGCOT-Refine-500K --local-dir ./data/LONGCOT-Refine-500K
|
51 |
+
```
|
52 |
+
|
53 |
+
|
54 |
+
3. Used only the huihui-ai/QWQ-LONGCOT-500K dataset (#20000), Trained for 1 epoch:
|
55 |
+
|
56 |
+
```
|
57 |
+
swift sft --model huihui-ai/Llama-3.2-3B-Instruct-abliterated --model_type llama3_2 --train_type lora --dataset "data/QWQ-LONGCOT-500K/qwq_500k.jsonl#20000" --torch_dtype bfloat16 --num_train_epochs 1 --per_device_train_batch_size 1 --per_device_eval_batch_size 1 --learning_rate 1e-4 --lora_rank 8 --lora_alpha 32 --target_modules all-linear --gradient_accumulation_steps 16 --eval_steps 50 --save_steps 50 --save_total_limit 2 --logging_steps 5 --max_length 16384 --output_dir output/Llama-3.2-3B-Instruct-abliterated/lora/sft --system "You are a helpful assistant. You should think step-by-step." --warmup_ratio 0.05 --dataloader_num_workers 4 --model_author "huihui-ai" --model_name "huihui-ai-robot"
|
58 |
+
```
|
59 |
+
|
60 |
+
|
61 |
+
4. Save the fine-tuned model.
|
62 |
+
Replace the directories below with specific ones.
|
63 |
+
|
64 |
+
```
|
65 |
+
swift infer --model huihui-ai/Llama-3.2-3B-Instruct-abliterated --adapters output/Llama-3.2-3B-Instruct-abliterated/lora/sft/v0-20250102-153619/checkpoint-1237 --merge_lora true
|
66 |
+
```
|
67 |
+
|
68 |
+
|
69 |
+
This should create a new model directory: `checkpoint-1237-merged`, Copy or move this directory to the `huihui` directory.
|
70 |
+
|
71 |
+
5. Perform inference on the fine-tuned model.
|
72 |
+
|
73 |
+
```
|
74 |
+
swift infer --model huihui/checkpoint-1237-merged --stream true --infer_backend pt --max_new_tokens 8192
|
75 |
+
```
|
76 |
+
|
77 |
+
|
78 |
+
6. Combined training with huihui-ai/QWQ-LONGCOT-500K (#20000) and huihui-ai/LONGCOT-Refine datasets (#20000), Trained for 1 epoch:
|
79 |
+
|
80 |
+
```
|
81 |
+
swift sft --model huihui-ai/checkpoint-1237-merged --model_type llama3_2 --train_type lora --dataset "data/QWQ-LONGCOT-500K/qwq_500k.jsonl#20000" "data/LONGCOT-Refine-500K/refine_from_qwen2_5.jsonl#20000" --torch_dtype bfloat16 --num_train_epochs 1 --per_device_train_batch_size 1 --per_device_eval_batch_size 1 --learning_rate 1e-4 --lora_rank 8 --lora_alpha 32 --target_modules all-linear --gradient_accumulation_steps 16 --eval_steps 50 --save_steps 50 --save_total_limit 2 --logging_steps 5 --max_length 16384 --output_dir output/Llama-3.2-3B-Instruct-abliterated/lora/sft2 --system "You are a helpful assistant. You should think step-by-step." --warmup_ratio 0.05 --dataloader_num_workers 4 --model_author "huihui-ai" --model_name "huihui-ai-robot"
|
82 |
+
```
|
83 |
+
|
84 |
+
|
85 |
+
7. Save the final fine-tuned model.
|
86 |
+
Replace the directories below with specific ones.
|
87 |
+
|
88 |
+
```
|
89 |
+
swift infer --model huihui-ai/checkpoint-1237-merged --adapters output/Llama-3.2-3B-Instruct-abliterated/lora/sft2/v0-20250103-121319/checkpoint-1237 --merge_lora true
|
90 |
+
```
|
91 |
+
|
92 |
+
|
93 |
+
This should create a new model directory: `checkpoint-1237-merged`, Rename the directory to `MicroThinker-3B-Preview`, Copy or move this directory to the `huihui` directory.
|
94 |
+
|
95 |
+
8. Perform inference on the final fine-tuned model.
|
96 |
+
|
97 |
+
```
|
98 |
+
swift infer --model huihui/MicroThinker-3B-Preview --stream true --infer_backend pt --max_new_tokens 8192
|
99 |
+
```
|
100 |
+
|
101 |
+
9. Test examples.
|
102 |
+
|
103 |
+
```
|
104 |
+
How many 'r' characters are there in the word "strawberry"?
|
105 |
+
```
|