beyoru commited on
Commit
ef076ef
·
verified ·
1 Parent(s): 7c37689

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +46 -5
README.md CHANGED
@@ -1,23 +1,64 @@
1
  ---
2
- base_model: unsloth/Qwen2.5-3B-Instruct
 
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
- This qwen2 model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
 
 
22
 
23
- [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ datasets:
14
+ - beyoru/Tin_hoc_mcq
15
  ---
16
 
17
  # Uploaded model
18
 
19
  - **Developed by:** beyoru
20
  - **License:** apache-2.0
 
21
 
22
+ # Usage
23
+ ```
24
+ from transformers import AutoModelForCausalLM, AutoTokenizer
25
 
26
+ model_name = "beyoru/MCQ_model-3B-qo-16"
27
+
28
+ model = AutoModelForCausalLM.from_pretrained(
29
+ model_name,
30
+ torch_dtype="auto",
31
+ device_map="auto"
32
+ )
33
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
34
+
35
+ messages = [
36
+ {"role": "system", "content": "Tạo câu hỏi trắc nghiệm dựa vào đoạn văn dưới đây"},
37
+ {"role": "user", "content": "<YOUR CONTEXT>"}
38
+ ]
39
+ text = tokenizer.apply_chat_template(
40
+ messages,
41
+ tokenize=False,
42
+ add_generation_prompt=True
43
+ )
44
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
45
+
46
+ generated_ids = model.generate(
47
+ **model_inputs,
48
+ do_sample=True
49
+ )
50
+ generated_ids = [
51
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
52
+ ]
53
+
54
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
55
+ ```
56
+
57
+ # Notes:
58
+ - For small datasets with narrow content which the model already has well, and doesn't want the model to forget the knowledge => Just need to focus on o.
59
+ - Fine-tuned lora with rank = 16 and alpha = 32, epoch = 1, linear (optim)
60
+ - DoRA
61
+
62
+ # Improvement
63
+ - Increasing rank can help the model do better at robust structure.
64
+ - Try more efficient fine-tuning