Update README.md
Browse files
README.md
CHANGED
|
@@ -1,23 +1,65 @@
|
|
| 1 |
---
|
| 2 |
-
base_model:
|
|
|
|
| 3 |
tags:
|
| 4 |
- text-generation-inference
|
| 5 |
- transformers
|
| 6 |
-
- unsloth
|
| 7 |
- qwen2
|
| 8 |
- trl
|
| 9 |
- sft
|
| 10 |
license: apache-2.0
|
| 11 |
language:
|
| 12 |
- en
|
|
|
|
|
|
|
|
|
|
| 13 |
---
|
| 14 |
|
| 15 |
# Uploaded model
|
| 16 |
|
| 17 |
- **Developed by:** beyoru
|
| 18 |
- **License:** apache-2.0
|
| 19 |
-
- **Finetuned from model :** unsloth/Qwen2.5-3B-Instruct
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
|
| 22 |
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
base_model:
|
| 3 |
+
- Qwen/Qwen2.5-3B-Instruct
|
| 4 |
tags:
|
| 5 |
- text-generation-inference
|
| 6 |
- transformers
|
|
|
|
| 7 |
- qwen2
|
| 8 |
- trl
|
| 9 |
- sft
|
| 10 |
license: apache-2.0
|
| 11 |
language:
|
| 12 |
- en
|
| 13 |
+
- vi
|
| 14 |
+
datasets:
|
| 15 |
+
- beyoru/Tin_hoc_mcq
|
| 16 |
---
|
| 17 |
|
| 18 |
# Uploaded model
|
| 19 |
|
| 20 |
- **Developed by:** beyoru
|
| 21 |
- **License:** apache-2.0
|
|
|
|
| 22 |
|
| 23 |
+
# Usage
|
| 24 |
+
```
|
| 25 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 26 |
|
| 27 |
+
model_name = "beyoru/MCQ-3B-o1-1"
|
| 28 |
+
|
| 29 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 30 |
+
model_name,
|
| 31 |
+
torch_dtype="auto",
|
| 32 |
+
device_map="auto"
|
| 33 |
+
)
|
| 34 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 35 |
+
|
| 36 |
+
messages = [
|
| 37 |
+
{"role": "system", "content": "Tạo một câu hỏi trắc nghiệm về"},
|
| 38 |
+
{"role": "user", "content": "<YOUR CONTEXT>"}
|
| 39 |
+
]
|
| 40 |
+
text = tokenizer.apply_chat_template(
|
| 41 |
+
messages,
|
| 42 |
+
tokenize=False,
|
| 43 |
+
add_generation_prompt=True
|
| 44 |
+
)
|
| 45 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
| 46 |
+
|
| 47 |
+
generated_ids = model.generate(
|
| 48 |
+
**model_inputs,
|
| 49 |
+
do_sample=True
|
| 50 |
+
)
|
| 51 |
+
generated_ids = [
|
| 52 |
+
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
| 53 |
+
]
|
| 54 |
+
|
| 55 |
+
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
# Notes:
|
| 59 |
+
- 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.
|
| 60 |
+
- Fine-tuned lora with rank = 1 and alpha = 1, epoch = 1, linear (optim)
|
| 61 |
+
- DoRA
|
| 62 |
+
|
| 63 |
+
# Improvement
|
| 64 |
+
- Increasing rank can help the model do better at robust structure.
|
| 65 |
+
- Try more efficient fine-tuning
|