Update README.md
Browse files
README.md
CHANGED
@@ -38,6 +38,31 @@ Derived from [Instella-3B-Instruct](https://huggingface.co/amd/Instella-3B-Instr
|
|
38 |
<em><b>Figure 1:</b> Instella-Math Training Steps</em>
|
39 |
</div>
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
# Supervised Finetuning (SFT)
|
42 |
|
43 |
We perform a two-stage supervised fine-tuning process to gradually enhance the reasoning capabilities of the Instella-3B-Instruct model. The first stage we use instruction tuning for mathematical coverage. The second stage enables the model to generate in-depth analyses and structured reasoning steps, which are crucial for tackling complex problems like Olympiad-level math questions.
|
|
|
38 |
<em><b>Figure 1:</b> Instella-Math Training Steps</em>
|
39 |
</div>
|
40 |
|
41 |
+
## Example Usage
|
42 |
+
```python
|
43 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
44 |
+
checkpoint = "amd/Instella-3B-Math"
|
45 |
+
|
46 |
+
tokenizer = AutoTokenizer.from_pretrained(checkpoint, trust_remote_code=True)
|
47 |
+
model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto", trust_remote_code=True)
|
48 |
+
|
49 |
+
prompt = [{"role": "user", "content": "Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May? Let's think step by step and output the final answer within \\boxed{}."}]
|
50 |
+
inputs = tokenizer.apply_chat_template(
|
51 |
+
prompt,
|
52 |
+
add_generation_prompt=True,
|
53 |
+
return_tensors='pt'
|
54 |
+
)
|
55 |
+
|
56 |
+
tokens = model.generate(
|
57 |
+
inputs.to(model.device),
|
58 |
+
max_new_tokens=1024,
|
59 |
+
temperature=0.8,
|
60 |
+
do_sample=True
|
61 |
+
)
|
62 |
+
|
63 |
+
print(tokenizer.decode(tokens[0], skip_special_tokens=False))
|
64 |
+
```
|
65 |
+
|
66 |
# Supervised Finetuning (SFT)
|
67 |
|
68 |
We perform a two-stage supervised fine-tuning process to gradually enhance the reasoning capabilities of the Instella-3B-Instruct model. The first stage we use instruction tuning for mathematical coverage. The second stage enables the model to generate in-depth analyses and structured reasoning steps, which are crucial for tackling complex problems like Olympiad-level math questions.
|