File size: 1,602 Bytes
8d032b4
eb7f0e7
 
8d032b4
 
 
 
 
5f121a8
8d032b4
 
 
eb7f0e7
 
 
8d032b4
 
 
 
 
 
 
eb7f0e7
 
 
8d032b4
eb7f0e7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16e35e5
eb7f0e7
 
 
 
 
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
---
base_model:
- Qwen/Qwen2.5-3B-Instruct
tags:
- text-generation-inference
- transformers
- qwen2
- trl
- sft
license: apache-2.0
language:
- en
- vi
datasets:
- beyoru/Tin_hoc_mcq
---

# Uploaded  model

- **Developed by:** beyoru
- **License:** apache-2.0

# Usage
```
from transformers import AutoModelForCausalLM, AutoTokenizer

model_name = "beyoru/MCQ-o1-512"

model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype="auto",
    device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)

messages = [
    {"role": "system", "content": "Bạn là một trợ lý thông minh có khả năng tạo ra một câu hỏi trắc nghiệm từ bất kỳ ngữ cảnh"},
    {"role": "user", "content": "<YOUR CONTEXT>"}
]
text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)

generated_ids = model.generate(
    **model_inputs,
    do_sample=True
)
generated_ids = [
    output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]

response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
```

# Notes:
- For small datasets with narrow content which the model has already done well on our domain, and doesn't want the model to forget the knowledge => Just need to focus on o. 
- Fine-tuned lora with rank = 1 and alpha = 512, epoch = 1, linear (optim)
- DoRA
  
# Improvement
- Increasing rank can help the model do better at robust structure.
- Try more efficient fine-tuning