lbourdois commited on
Commit
10cb474
·
verified ·
1 Parent(s): 74a3d11

Improve language tag

Browse files

Hi! As the model is multilingual, this is a PR to add other languages than English to the language tag to improve the referencing. Note that 29 languages are announced in the README, but only 13 are explicitly listed. I was therefore only able to add these 13 languages.

Files changed (1) hide show
  1. README.md +149 -135
README.md CHANGED
@@ -1,135 +1,149 @@
1
- ---
2
- license: apache-2.0
3
- datasets:
4
- - HuggingFaceH4/ultrachat_200k
5
- base_model:
6
- - Qwen/Qwen2.5-1.5B
7
- pipeline_tag: text-generation
8
- tags:
9
- - trl
10
- - qwen
11
- - sft
12
- - alignment
13
- - transformers
14
- - custome
15
- - chat
16
- ---
17
- # Qwen2.5-1.5B-ultrachat200k
18
-
19
-
20
- ## Model Details
21
-
22
- - **Model type:** sft model
23
- - **License:** Apache license 2.0
24
- - **Finetuned from model:** [Qwen/Qwen2.5-1.5B](https://huggingface.co/Qwen/Qwen2.5-1.5B)
25
- - **Training data:** [HuggingFaceH4/ultrachat_200k](https://huggingface.co/datasets/HuggingFaceH4/ultrachat_200k)
26
- - **Training framework:** [trl](https://github.com/huggingface/trl)
27
-
28
- ## Training Details
29
-
30
- ### Training Hyperparameters
31
- `attn_implementation`: flash_attention_2 \
32
- `bf16`: True \
33
- `learning_rate`: 5e-5 \
34
- `lr_scheduler_type`: cosine \
35
- `per_device_train_batch_size`: 2 \
36
- `gradient_accumulation_steps`: 16 \
37
- `torch_dtype`: bfloat16 \
38
- `num_train_epochs`: 1 \
39
- `max_seq_length`: 2048 \
40
- `warmup_ratio`: 0.1
41
-
42
- ### Results
43
-
44
- `init_train_loss`: 1.421 \
45
- `final_train_loss`: 1.192 \
46
- `eval_loss`: 1.2003
47
-
48
- ### Training script
49
-
50
- ```python
51
- import multiprocessing
52
-
53
- from datasets import load_dataset
54
- from tqdm.rich import tqdm
55
- from transformers import AutoTokenizer, AutoModelForCausalLM
56
- from trl import (
57
- ModelConfig,
58
- SFTTrainer,
59
- get_peft_config,
60
- get_quantization_config,
61
- get_kbit_device_map,
62
- SFTConfig,
63
- ScriptArguments
64
- )
65
- from trl.commands.cli_utils import TrlParser
66
-
67
- tqdm.pandas()
68
-
69
- if __name__ == "__main__":
70
- parser = TrlParser((ScriptArguments, SFTConfig, ModelConfig))
71
- args, training_args, model_config = parser.parse_args_and_config()
72
-
73
- quantization_config = get_quantization_config(model_config)
74
- model_kwargs = dict(
75
- revision=model_config.model_revision,
76
- trust_remote_code=model_config.trust_remote_code,
77
- attn_implementation=model_config.attn_implementation,
78
- torch_dtype=model_config.torch_dtype,
79
- use_cache=False if training_args.gradient_checkpointing else True,
80
- device_map=get_kbit_device_map() if quantization_config is not None else None,
81
- quantization_config=quantization_config,
82
- )
83
-
84
- model = AutoModelForCausalLM.from_pretrained(model_config.model_name_or_path,
85
- **model_kwargs)
86
- tokenizer = AutoTokenizer.from_pretrained(
87
- model_config.model_name_or_path, trust_remote_code=model_config.trust_remote_code, use_fast=True
88
- )
89
- tokenizer.pad_token = tokenizer.eos_token
90
-
91
- train_dataset = load_dataset(args.dataset_name,
92
- split=args.dataset_train_split,
93
- num_proc=multiprocessing.cpu_count())
94
-
95
- trainer = SFTTrainer(
96
- model=model,
97
- args=training_args,
98
- train_dataset=train_dataset,
99
- processing_class=tokenizer,
100
- peft_config=get_peft_config(model_config),
101
- )
102
-
103
- trainer.train()
104
-
105
- trainer.save_model(training_args.output_dir)
106
- ```
107
-
108
- ### Test Script
109
- ```python
110
- from vllm import LLM
111
- from datasets import load_dataset
112
- from vllm.sampling_params import SamplingParams
113
- from transformers import AutoTokenizer
114
-
115
- MODEL_PATH = "autodl-tmp/saves/Qwen2.5-1.5B-ultrachat200k"
116
-
117
- model = LLM(MODEL_PATH,
118
- tensor_parallel_size=1,
119
- dtype='bfloat16')
120
- tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH)
121
-
122
- input = tokenizer.apply_chat_template([{"role": "user", "content": "Which province is Shenyang in?"}],
123
- tokenize=False,
124
- add_generation_prompt=True)
125
- sampling_params = SamplingParams(max_tokens=1024,
126
- temperature=0.7,
127
- logprobs=1,
128
- stop_token_ids=[tokenizer.eos_token_id])
129
-
130
- vllm_generations = model.generate(input,
131
- sampling_params)
132
-
133
- print(vllm_generations[0].outputs[0].text)
134
- # print result: Shenyang is in Liaoning province, China.
135
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ datasets:
4
+ - HuggingFaceH4/ultrachat_200k
5
+ base_model:
6
+ - Qwen/Qwen2.5-1.5B
7
+ pipeline_tag: text-generation
8
+ tags:
9
+ - trl
10
+ - qwen
11
+ - sft
12
+ - alignment
13
+ - transformers
14
+ - custome
15
+ - chat
16
+ language:
17
+ - zho
18
+ - eng
19
+ - fra
20
+ - spa
21
+ - por
22
+ - deu
23
+ - ita
24
+ - rus
25
+ - jpn
26
+ - kor
27
+ - vie
28
+ - tha
29
+ - ara
30
+ ---
31
+ # Qwen2.5-1.5B-ultrachat200k
32
+
33
+
34
+ ## Model Details
35
+
36
+ - **Model type:** sft model
37
+ - **License:** Apache license 2.0
38
+ - **Finetuned from model:** [Qwen/Qwen2.5-1.5B](https://huggingface.co/Qwen/Qwen2.5-1.5B)
39
+ - **Training data:** [HuggingFaceH4/ultrachat_200k](https://huggingface.co/datasets/HuggingFaceH4/ultrachat_200k)
40
+ - **Training framework:** [trl](https://github.com/huggingface/trl)
41
+
42
+ ## Training Details
43
+
44
+ ### Training Hyperparameters
45
+ `attn_implementation`: flash_attention_2 \
46
+ `bf16`: True \
47
+ `learning_rate`: 5e-5 \
48
+ `lr_scheduler_type`: cosine \
49
+ `per_device_train_batch_size`: 2 \
50
+ `gradient_accumulation_steps`: 16 \
51
+ `torch_dtype`: bfloat16 \
52
+ `num_train_epochs`: 1 \
53
+ `max_seq_length`: 2048 \
54
+ `warmup_ratio`: 0.1
55
+
56
+ ### Results
57
+
58
+ `init_train_loss`: 1.421 \
59
+ `final_train_loss`: 1.192 \
60
+ `eval_loss`: 1.2003
61
+
62
+ ### Training script
63
+
64
+ ```python
65
+ import multiprocessing
66
+
67
+ from datasets import load_dataset
68
+ from tqdm.rich import tqdm
69
+ from transformers import AutoTokenizer, AutoModelForCausalLM
70
+ from trl import (
71
+ ModelConfig,
72
+ SFTTrainer,
73
+ get_peft_config,
74
+ get_quantization_config,
75
+ get_kbit_device_map,
76
+ SFTConfig,
77
+ ScriptArguments
78
+ )
79
+ from trl.commands.cli_utils import TrlParser
80
+
81
+ tqdm.pandas()
82
+
83
+ if __name__ == "__main__":
84
+ parser = TrlParser((ScriptArguments, SFTConfig, ModelConfig))
85
+ args, training_args, model_config = parser.parse_args_and_config()
86
+
87
+ quantization_config = get_quantization_config(model_config)
88
+ model_kwargs = dict(
89
+ revision=model_config.model_revision,
90
+ trust_remote_code=model_config.trust_remote_code,
91
+ attn_implementation=model_config.attn_implementation,
92
+ torch_dtype=model_config.torch_dtype,
93
+ use_cache=False if training_args.gradient_checkpointing else True,
94
+ device_map=get_kbit_device_map() if quantization_config is not None else None,
95
+ quantization_config=quantization_config,
96
+ )
97
+
98
+ model = AutoModelForCausalLM.from_pretrained(model_config.model_name_or_path,
99
+ **model_kwargs)
100
+ tokenizer = AutoTokenizer.from_pretrained(
101
+ model_config.model_name_or_path, trust_remote_code=model_config.trust_remote_code, use_fast=True
102
+ )
103
+ tokenizer.pad_token = tokenizer.eos_token
104
+
105
+ train_dataset = load_dataset(args.dataset_name,
106
+ split=args.dataset_train_split,
107
+ num_proc=multiprocessing.cpu_count())
108
+
109
+ trainer = SFTTrainer(
110
+ model=model,
111
+ args=training_args,
112
+ train_dataset=train_dataset,
113
+ processing_class=tokenizer,
114
+ peft_config=get_peft_config(model_config),
115
+ )
116
+
117
+ trainer.train()
118
+
119
+ trainer.save_model(training_args.output_dir)
120
+ ```
121
+
122
+ ### Test Script
123
+ ```python
124
+ from vllm import LLM
125
+ from datasets import load_dataset
126
+ from vllm.sampling_params import SamplingParams
127
+ from transformers import AutoTokenizer
128
+
129
+ MODEL_PATH = "autodl-tmp/saves/Qwen2.5-1.5B-ultrachat200k"
130
+
131
+ model = LLM(MODEL_PATH,
132
+ tensor_parallel_size=1,
133
+ dtype='bfloat16')
134
+ tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH)
135
+
136
+ input = tokenizer.apply_chat_template([{"role": "user", "content": "Which province is Shenyang in?"}],
137
+ tokenize=False,
138
+ add_generation_prompt=True)
139
+ sampling_params = SamplingParams(max_tokens=1024,
140
+ temperature=0.7,
141
+ logprobs=1,
142
+ stop_token_ids=[tokenizer.eos_token_id])
143
+
144
+ vllm_generations = model.generate(input,
145
+ sampling_params)
146
+
147
+ print(vllm_generations[0].outputs[0].text)
148
+ # print result: Shenyang is in Liaoning province, China.
149
+ ```