File size: 2,028 Bytes
b269edc
 
 
 
 
 
 
 
 
 
 
baf0c79
 
 
b269edc
 
 
 
 
 
 
 
 
 
486c539
 
3414714
 
779d267
 
 
 
 
 
3414714
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
70
71
72
73
74
75
76
---
base_model: unsloth/phi-4-unsloth-bnb-4bit
tags:
- text-generation-inference
- transformers
- unsloth
- llama
- trl
license: apache-2.0
language:
- en
- vi
datasets:
- 5CD-AI/Vietnamese-meta-math-MetaMathQA-40K-gg-translated
---

# Uploaded  model

- **Developed by:** vankha
- **License:** apache-2.0
- **Finetuned from model :** unsloth/phi-4-unsloth-bnb-4bit

This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.

[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)

# How to using model 

## Setup Library
```bash
!pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
!pip install --no-deps xformers="trl<0.9.0" peft accelerate bitsandbytes
```

## 🚀 Load the refined 4-bit model with Unsloth

```python
from unsloth import FastLanguageModel

model, tokenizer = FastLanguageModel.from_pretrained(
    model_name = "vankha/vietnamese-phi-4-reasoning", 
    max_seq_length = 2048,
    load_in_4bit = True,
)
```

## 🧠 Send reminder for model inference

```python
messages = [
    {
        "role": "user",
        "content": "Allen và Ben đang sơn hàng rào. Tỷ lệ giữa số lượng công việc Allen làm và số lượng công việc Ben làm là $3:5$. Nếu hàng rào cần sơn tổng cộng X feet vuông thì Ben sơn 150 feet vuông. Giá trị của biến X chưa biết là bao nhiêu?"
    }
]

text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,  # Required for the model to generate responses
    enable_thinking=True,        # Can enable or disable "think" feature
)

from transformers import TextStreamer

_ = model.generate(
    **tokenizer(text, return_tensors="pt").to("cuda"),
    max_new_tokens=1024,       
    temperature=0.6,
    top_p=0.95,
    top_k=20,
    streamer=TextStreamer(tokenizer, skip_prompt=True),
)
```