lbourdois commited on
Commit
dab3982
·
verified ·
1 Parent(s): 8c0e6ec

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 +110 -98
README.md CHANGED
@@ -1,99 +1,111 @@
1
- ---
2
- library_name: transformers
3
- tags:
4
- - unsloth
5
- - reasoning
6
- - mathematics
7
- - math
8
- datasets:
9
- - openai/gsm8k
10
- language:
11
- - en
12
- base_model:
13
- - Qwen/Qwen2.5-3B-Instruct
14
- ---
15
-
16
- # Model Card for Model ID
17
-
18
- This is an early experiment using the `GRPOTrainer` and training reasoning models using the Unsloth library. It is not intended for real use, but it should work OK for simple prompt tests and easy mathematics questions.
19
-
20
- (You can run this using the code below on a free Colab/Kaggle basic GPU account for testing.)
21
-
22
- **NOTE:** If you are interested in reasoning models and research in this area, I maintain an up-to-date resource list here : [https://github.com/benjaminzwhite/reasoning-models](https://github.com/benjaminzwhite/reasoning-models)
23
-
24
- - Example query: `"What is the smallest prime number greater than 50 ?"`
25
-
26
- - Example response: `"<reasoning>\nTo find the smallest prime number greater than 50, we can start checking from 51 onwards for primality. A prime number is a number that has no divisors other than 1 and itself. We check each number to see if it's divisible by any number other than 1 and itself.\n</reasoning>\n<answer>\n53\n</answer>"`
27
-
28
-
29
- ## How to Get Started with the Model
30
-
31
- To use this with standard HuggingFace code, I recommend starting with this code (based 95% on the default code shown at the base model page : [https://huggingface.co/Qwen/Qwen2.5-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-3B-Instruct))
32
-
33
- ```python
34
- from transformers import AutoModelForCausalLM, AutoTokenizer
35
-
36
- model_name = "benjaminzwhite/Qwen2.5-3B-Instruct_GSM8K-GRPO_16bit"
37
-
38
- # model loading
39
- model = AutoModelForCausalLM.from_pretrained(
40
- model_name,
41
- torch_dtype="auto",
42
- device_map="auto"
43
- )
44
- tokenizer = AutoTokenizer.from_pretrained(model_name)
45
-
46
- # system prompt used during training
47
- SYSTEM_PROMPT = """
48
- Respond in the following format:
49
- <reasoning>
50
- ...
51
- </reasoning>
52
- <answer>
53
- ...
54
- </answer>
55
- """
56
-
57
- # your query goes here
58
- user_prompt = "What is the smallest prime number greater than 50 ?"
59
-
60
- messages = [
61
- {"role": "system", "content": SYSTEM_PROMPT},
62
- {"role": "user", "content": user_prompt}
63
- ]
64
-
65
- # default Qwen2.5 code from this point ...
66
- text = tokenizer.apply_chat_template(
67
- messages,
68
- tokenize=False,
69
- add_generation_prompt=True
70
- )
71
-
72
- model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
73
-
74
- generated_ids = model.generate(
75
- **model_inputs,
76
- max_new_tokens=512
77
- )
78
- generated_ids = [
79
- output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
80
- ]
81
-
82
- response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
83
-
84
- print(response)
85
-
86
- # sample answer obtained to my query, to show expected format
87
- # (note that the answer, 53, is correct here)
88
- """
89
- "<reasoning>\nTo find the smallest prime number greater than 50, we can start checking from 51 onwards for primality. A prime number is a number that has no divisors other than 1 and itself. We check each number to see if it's divisible by any number other than 1 and itself.\n</reasoning>\n<answer>\n53\n</answer>"
90
- """
91
- ```
92
-
93
- ## Training Details
94
-
95
- ### Training Data
96
-
97
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
98
-
 
 
 
 
 
 
 
 
 
 
 
 
99
  Trained on GSM8K mathematics dataset.
 
1
+ ---
2
+ library_name: transformers
3
+ tags:
4
+ - unsloth
5
+ - reasoning
6
+ - mathematics
7
+ - math
8
+ datasets:
9
+ - openai/gsm8k
10
+ language:
11
+ - zho
12
+ - eng
13
+ - fra
14
+ - spa
15
+ - por
16
+ - deu
17
+ - ita
18
+ - rus
19
+ - jpn
20
+ - kor
21
+ - vie
22
+ - tha
23
+ - ara
24
+ base_model:
25
+ - Qwen/Qwen2.5-3B-Instruct
26
+ ---
27
+
28
+ # Model Card for Model ID
29
+
30
+ This is an early experiment using the `GRPOTrainer` and training reasoning models using the Unsloth library. It is not intended for real use, but it should work OK for simple prompt tests and easy mathematics questions.
31
+
32
+ (You can run this using the code below on a free Colab/Kaggle basic GPU account for testing.)
33
+
34
+ **NOTE:** If you are interested in reasoning models and research in this area, I maintain an up-to-date resource list here : [https://github.com/benjaminzwhite/reasoning-models](https://github.com/benjaminzwhite/reasoning-models)
35
+
36
+ - Example query: `"What is the smallest prime number greater than 50 ?"`
37
+
38
+ - Example response: `"<reasoning>\nTo find the smallest prime number greater than 50, we can start checking from 51 onwards for primality. A prime number is a number that has no divisors other than 1 and itself. We check each number to see if it's divisible by any number other than 1 and itself.\n</reasoning>\n<answer>\n53\n</answer>"`
39
+
40
+
41
+ ## How to Get Started with the Model
42
+
43
+ To use this with standard HuggingFace code, I recommend starting with this code (based 95% on the default code shown at the base model page : [https://huggingface.co/Qwen/Qwen2.5-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-3B-Instruct))
44
+
45
+ ```python
46
+ from transformers import AutoModelForCausalLM, AutoTokenizer
47
+
48
+ model_name = "benjaminzwhite/Qwen2.5-3B-Instruct_GSM8K-GRPO_16bit"
49
+
50
+ # model loading
51
+ model = AutoModelForCausalLM.from_pretrained(
52
+ model_name,
53
+ torch_dtype="auto",
54
+ device_map="auto"
55
+ )
56
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
57
+
58
+ # system prompt used during training
59
+ SYSTEM_PROMPT = """
60
+ Respond in the following format:
61
+ <reasoning>
62
+ ...
63
+ </reasoning>
64
+ <answer>
65
+ ...
66
+ </answer>
67
+ """
68
+
69
+ # your query goes here
70
+ user_prompt = "What is the smallest prime number greater than 50 ?"
71
+
72
+ messages = [
73
+ {"role": "system", "content": SYSTEM_PROMPT},
74
+ {"role": "user", "content": user_prompt}
75
+ ]
76
+
77
+ # default Qwen2.5 code from this point ...
78
+ text = tokenizer.apply_chat_template(
79
+ messages,
80
+ tokenize=False,
81
+ add_generation_prompt=True
82
+ )
83
+
84
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
85
+
86
+ generated_ids = model.generate(
87
+ **model_inputs,
88
+ max_new_tokens=512
89
+ )
90
+ generated_ids = [
91
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
92
+ ]
93
+
94
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
95
+
96
+ print(response)
97
+
98
+ # sample answer obtained to my query, to show expected format
99
+ # (note that the answer, 53, is correct here)
100
+ """
101
+ "<reasoning>\nTo find the smallest prime number greater than 50, we can start checking from 51 onwards for primality. A prime number is a number that has no divisors other than 1 and itself. We check each number to see if it's divisible by any number other than 1 and itself.\n</reasoning>\n<answer>\n53\n</answer>"
102
+ """
103
+ ```
104
+
105
+ ## Training Details
106
+
107
+ ### Training Data
108
+
109
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
110
+
111
  Trained on GSM8K mathematics dataset.