Update README.md
Browse files
README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# 🧠
|
| 2 |
|
| 3 |
This repository contains a fine-tuned version of
|
| 4 |
**unsloth/phi-4-reasoning**, trained with **LoRA** on the
|
|
@@ -45,13 +45,13 @@ The training format follows:
|
|
| 45 |
Alpha 32
|
| 46 |
Dropout 0.05
|
| 47 |
Target Modules q/k/v/o proj, mlp (up/down/gate)
|
| 48 |
-
Max Length
|
| 49 |
-
Precision 4-bit QLoRA
|
| 50 |
-
Batch Size
|
| 51 |
Grad Accum 8
|
| 52 |
LR 2e-4
|
| 53 |
Scheduler cosine
|
| 54 |
-
Epochs
|
| 55 |
|
| 56 |
## 📚 Dataset
|
| 57 |
|
|
@@ -72,18 +72,35 @@ accurate explanations for Rust programming tasks.
|
|
| 72 |
|
| 73 |
``` python
|
| 74 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
|
|
| 75 |
|
| 76 |
-
model_id = "
|
| 77 |
|
| 78 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 79 |
-
model = AutoModelForCausalLM.from_pretrained(model_id)
|
|
|
|
| 80 |
|
| 81 |
-
prompt = "Explain ownership
|
| 82 |
|
| 83 |
-
|
| 84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
-
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 87 |
```
|
| 88 |
|
| 89 |
## 🔍 Notes on Reasoning Tags
|
|
@@ -96,23 +113,6 @@ This model preserves **hidden reasoning structure**:
|
|
| 96 |
⚠️ Users should NOT expect the `<think>` content to be revealed; the
|
| 97 |
model is aligned to hide reasoning by default.
|
| 98 |
|
| 99 |
-
## 📦 Files Included
|
| 100 |
-
|
| 101 |
-
- `config.json`\
|
| 102 |
-
- `generation_config.json`\
|
| 103 |
-
- `pytorch_model.bin`\
|
| 104 |
-
- `tokenizer.json`
|
| 105 |
-
|
| 106 |
-
If this is a LoRA-only repo (not merged), then the repo contains:
|
| 107 |
-
|
| 108 |
-
- `adapter_config.json`\
|
| 109 |
-
- `adapter_model.bin`
|
| 110 |
-
|
| 111 |
-
## 🔒 License
|
| 112 |
-
|
| 113 |
-
This model inherits the license of the base model:\
|
| 114 |
-
**Microsoft Phi License / Reasoning Model Terms**
|
| 115 |
-
|
| 116 |
## ✨ Acknowledgements
|
| 117 |
|
| 118 |
- **Unsloth** for optimized model training\
|
|
|
|
| 1 |
+
# 🧠 Rust-Master-thinking
|
| 2 |
|
| 3 |
This repository contains a fine-tuned version of
|
| 4 |
**unsloth/phi-4-reasoning**, trained with **LoRA** on the
|
|
|
|
| 45 |
Alpha 32
|
| 46 |
Dropout 0.05
|
| 47 |
Target Modules q/k/v/o proj, mlp (up/down/gate)
|
| 48 |
+
Max Length 512
|
| 49 |
+
Precision 4-bit QLoRA
|
| 50 |
+
Batch Size 16
|
| 51 |
Grad Accum 8
|
| 52 |
LR 2e-4
|
| 53 |
Scheduler cosine
|
| 54 |
+
Epochs 1
|
| 55 |
|
| 56 |
## 📚 Dataset
|
| 57 |
|
|
|
|
| 72 |
|
| 73 |
``` python
|
| 74 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 75 |
+
import torch
|
| 76 |
|
| 77 |
+
model_id = "SkyAsl/Rust-Master-thinking"
|
| 78 |
|
| 79 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 80 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
|
| 81 |
+
model.eval()
|
| 82 |
|
| 83 |
+
prompt = "Explain why Rust ownership prevents data races."
|
| 84 |
|
| 85 |
+
input_text = (
|
| 86 |
+
f"<|user|>\n{test_data[0]['prompt']}\n"
|
| 87 |
+
f"<|assistant|>\n<think>\n"
|
| 88 |
+
)
|
| 89 |
+
|
| 90 |
+
inputs = tokenizer(input_text, return_tensors="pt").to(model.device)
|
| 91 |
+
|
| 92 |
+
with torch.no_grad():
|
| 93 |
+
output = model.generate(
|
| 94 |
+
**inputs,
|
| 95 |
+
max_new_tokens=500,
|
| 96 |
+
temperature=0.7,
|
| 97 |
+
top_p=0.9,
|
| 98 |
+
do_sample=True,
|
| 99 |
+
eos_token_id=tokenizer.convert_tokens_to_ids("</think>")
|
| 100 |
+
)
|
| 101 |
+
|
| 102 |
+
print(tokenizer.decode(output[0], skip_special_tokens=False))
|
| 103 |
|
|
|
|
| 104 |
```
|
| 105 |
|
| 106 |
## 🔍 Notes on Reasoning Tags
|
|
|
|
| 113 |
⚠️ Users should NOT expect the `<think>` content to be revealed; the
|
| 114 |
model is aligned to hide reasoning by default.
|
| 115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
## ✨ Acknowledgements
|
| 117 |
|
| 118 |
- **Unsloth** for optimized model training\
|