CrystalRaindropsFall commited on
Commit
b8a325e
·
verified ·
1 Parent(s): bca4973

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: HuggingFaceTB/SmolLM2-135M
4
+ tags:
5
+ - peft
6
+ - lora
7
+ - gsm8k
8
+ - math
9
+ - reasoning
10
+ - curriculum-learning
11
+ datasets:
12
+ - gsm8k
13
+ metrics:
14
+ - accuracy
15
+ library_name: peft
16
+ ---
17
+
18
+ # SmolLM2-135M LoRA Adapter for GSM8K
19
+
20
+ This is a LoRA adapter for [HuggingFaceTB/SmolLM2-135M](https://huggingface.co/HuggingFaceTB/SmolLM2-135M) fine-tuned on the [GSM8K dataset](https://huggingface.co/datasets/gsm8k) for mathematical reasoning.
21
+
22
+ ## Model Description
23
+
24
+ - **Base Model:** HuggingFaceTB/SmolLM2-135M
25
+ - **Training Method:** Curriculum learning - Complexity Score
26
+ - **Dataset:** GSM8K (Grade School Math 8K)
27
+ - **Task:** Mathematical word problem solving
28
+ - **Exact Match Accuracy:** 2.93%
29
+
30
+ ## Training Details
31
+
32
+ LoRA adapter for SmolLM2 trained with curriculum learning (complexity score method)
33
+
34
+ ### Training Configuration
35
+ - **Method:** LoRA (Low-Rank Adaptation)
36
+ - **Rank:** 16
37
+ - **Alpha:** 32
38
+ - **Target Modules:** q_proj, k_proj, v_proj, o_proj
39
+ - **Dropout:** 0.1
40
+ - **Epochs:** 3
41
+ - **Batch Size:** 4 (with gradient accumulation of 4)
42
+ - **Learning Rate:** 3e-4
43
+
44
+ ### Curriculum Learning
45
+
46
+ This model was trained using curriculum learning, where the model is exposed to progressively harder problems:
47
+ 1. **Easy Stage:** Simple problems with fewer steps
48
+ 2. **Normal Stage:** Moderate complexity problems
49
+ 3. **Difficult Stage:** Complex multi-step problems
50
+
51
+ The curriculum was determined based on problem complexity (number of solution steps × operation complexity).
52
+
53
+
54
+ ## Usage
55
+
56
+ ### Loading the Adapter
57
+
58
+ ```python
59
+ from transformers import AutoModelForCausalLM, AutoTokenizer
60
+ from peft import PeftModel
61
+
62
+ # Load base model
63
+ base_model = AutoModelForCausalLM.from_pretrained(
64
+ "HuggingFaceTB/SmolLM2-135M",
65
+ device_map="auto",
66
+ torch_dtype="auto"
67
+ )
68
+
69
+ # Load tokenizer
70
+ tokenizer = AutoTokenizer.from_pretrained("HuggingFaceTB/SmolLM2-135M")
71
+
72
+ # Load LoRA adapter
73
+ model = PeftModel.from_pretrained(base_model, "CrystalRaindropsFall/smollm2-gsm8k-curriculum-complexity")
74
+
75
+ # Inference
76
+ prompt = "Question: Janet's ducks lay 16 eggs per day. She eats three for breakfast every morning and bakes muffins for her friends every day with four. She sells the remainder at the farmers' market daily for $2 per fresh duck egg. How much in dollars does she make every day at the farmers' market?\nAnswer:"
77
+
78
+ inputs = tokenizer(prompt, return_tensors="pt")
79
+ outputs = model.generate(**inputs, max_new_tokens=256)
80
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
81
+ ```
82
+
83
+ ### Using with Pipeline
84
+
85
+ ```python
86
+ from transformers import pipeline
87
+ from peft import PeftModel, AutoPeftModelForCausalLM
88
+
89
+ # Load model with adapter
90
+ model = AutoPeftModelForCausalLM.from_pretrained(
91
+ "YOUR_USERNAME/REPO_NAME",
92
+ device_map="auto"
93
+ )
94
+
95
+ # Create pipeline
96
+ pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
97
+
98
+ # Generate
99
+ result = pipe("Question: A robe takes 2 bolts of blue fiber and half that much white fiber. How many bolts in total does it take?\nAnswer:")
100
+ print(result[0]['generated_text'])
101
+ ```
102
+
103
+ ## Performance
104
+
105
+ Evaluated on GSM8K test set (512 samples):
106
+
107
+ | Metric | Score |
108
+ |--------|-------|
109
+ | Exact Match | 2.93% |
110
+ | Format Correct | 100% |
111
+
112
+ ## Limitations
113
+
114
+ - Trained on grade school level math problems
115
+ - May struggle with problems requiring external knowledge
116
+ - Performance depends on problem complexity and wording
117
+ - Best used with base model's standard generation settings
118
+
119
+
120
+ ## Acknowledgments
121
+
122
+ - Base model: HuggingFaceTB/SmolLM2-135M
123
+ - Dataset: GSM8K by Cobbe et al.
124
+ - Training framework: HuggingFace PEFT
125
+
126
+ ## License
127
+
128
+ Apache 2.0 (following base model license)
adapter_config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "experiment_results/curriculum_complexity_score_smolLM2_gsm8k_20251112_222922/stage_2_normal/merged_model",
5
+ "bias": "none",
6
+ "corda_config": null,
7
+ "eva_config": null,
8
+ "exclude_modules": null,
9
+ "fan_in_fan_out": false,
10
+ "inference_mode": true,
11
+ "init_lora_weights": true,
12
+ "layer_replication": null,
13
+ "layers_pattern": null,
14
+ "layers_to_transform": null,
15
+ "loftq_config": {},
16
+ "lora_alpha": 32,
17
+ "lora_bias": false,
18
+ "lora_dropout": 0.1,
19
+ "megatron_config": null,
20
+ "megatron_core": "megatron.core",
21
+ "modules_to_save": null,
22
+ "peft_type": "LORA",
23
+ "qalora_group_size": 16,
24
+ "r": 16,
25
+ "rank_pattern": {},
26
+ "revision": null,
27
+ "target_modules": [
28
+ "o_proj",
29
+ "k_proj",
30
+ "q_proj",
31
+ "v_proj"
32
+ ],
33
+ "target_parameters": null,
34
+ "task_type": "CAUSAL_LM",
35
+ "trainable_token_indices": null,
36
+ "use_dora": false,
37
+ "use_qalora": false,
38
+ "use_rslora": false
39
+ }
adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cdc1fabc1021f6abd0e9577d83db1f8d72b8a226e052e8adda868eb9f8c9982e
3
+ size 7404368
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
special_tokens_map.json ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|endoftext|>",
4
+ "<|im_start|>",
5
+ "<|im_end|>",
6
+ "<repo_name>",
7
+ "<reponame>",
8
+ "<file_sep>",
9
+ "<filename>",
10
+ "<gh_stars>",
11
+ "<issue_start>",
12
+ "<issue_comment>",
13
+ "<issue_closed>",
14
+ "<jupyter_start>",
15
+ "<jupyter_text>",
16
+ "<jupyter_code>",
17
+ "<jupyter_output>",
18
+ "<jupyter_script>",
19
+ "<empty_output>"
20
+ ],
21
+ "bos_token": {
22
+ "content": "<|endoftext|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false
27
+ },
28
+ "eos_token": {
29
+ "content": "<|endoftext|>",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false
34
+ },
35
+ "pad_token": {
36
+ "content": "<|endoftext|>",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false
41
+ },
42
+ "unk_token": {
43
+ "content": "<|endoftext|>",
44
+ "lstrip": false,
45
+ "normalized": false,
46
+ "rstrip": false,
47
+ "single_word": false
48
+ }
49
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "0": {
5
+ "content": "<|endoftext|>",
6
+ "lstrip": false,
7
+ "normalized": false,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "1": {
13
+ "content": "<|im_start|>",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "2": {
21
+ "content": "<|im_end|>",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "3": {
29
+ "content": "<repo_name>",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "4": {
37
+ "content": "<reponame>",
38
+ "lstrip": false,
39
+ "normalized": false,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ },
44
+ "5": {
45
+ "content": "<file_sep>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false,
50
+ "special": true
51
+ },
52
+ "6": {
53
+ "content": "<filename>",
54
+ "lstrip": false,
55
+ "normalized": false,
56
+ "rstrip": false,
57
+ "single_word": false,
58
+ "special": true
59
+ },
60
+ "7": {
61
+ "content": "<gh_stars>",
62
+ "lstrip": false,
63
+ "normalized": false,
64
+ "rstrip": false,
65
+ "single_word": false,
66
+ "special": true
67
+ },
68
+ "8": {
69
+ "content": "<issue_start>",
70
+ "lstrip": false,
71
+ "normalized": false,
72
+ "rstrip": false,
73
+ "single_word": false,
74
+ "special": true
75
+ },
76
+ "9": {
77
+ "content": "<issue_comment>",
78
+ "lstrip": false,
79
+ "normalized": false,
80
+ "rstrip": false,
81
+ "single_word": false,
82
+ "special": true
83
+ },
84
+ "10": {
85
+ "content": "<issue_closed>",
86
+ "lstrip": false,
87
+ "normalized": false,
88
+ "rstrip": false,
89
+ "single_word": false,
90
+ "special": true
91
+ },
92
+ "11": {
93
+ "content": "<jupyter_start>",
94
+ "lstrip": false,
95
+ "normalized": false,
96
+ "rstrip": false,
97
+ "single_word": false,
98
+ "special": true
99
+ },
100
+ "12": {
101
+ "content": "<jupyter_text>",
102
+ "lstrip": false,
103
+ "normalized": false,
104
+ "rstrip": false,
105
+ "single_word": false,
106
+ "special": true
107
+ },
108
+ "13": {
109
+ "content": "<jupyter_code>",
110
+ "lstrip": false,
111
+ "normalized": false,
112
+ "rstrip": false,
113
+ "single_word": false,
114
+ "special": true
115
+ },
116
+ "14": {
117
+ "content": "<jupyter_output>",
118
+ "lstrip": false,
119
+ "normalized": false,
120
+ "rstrip": false,
121
+ "single_word": false,
122
+ "special": true
123
+ },
124
+ "15": {
125
+ "content": "<jupyter_script>",
126
+ "lstrip": false,
127
+ "normalized": false,
128
+ "rstrip": false,
129
+ "single_word": false,
130
+ "special": true
131
+ },
132
+ "16": {
133
+ "content": "<empty_output>",
134
+ "lstrip": false,
135
+ "normalized": false,
136
+ "rstrip": false,
137
+ "single_word": false,
138
+ "special": true
139
+ }
140
+ },
141
+ "additional_special_tokens": [
142
+ "<|endoftext|>",
143
+ "<|im_start|>",
144
+ "<|im_end|>",
145
+ "<repo_name>",
146
+ "<reponame>",
147
+ "<file_sep>",
148
+ "<filename>",
149
+ "<gh_stars>",
150
+ "<issue_start>",
151
+ "<issue_comment>",
152
+ "<issue_closed>",
153
+ "<jupyter_start>",
154
+ "<jupyter_text>",
155
+ "<jupyter_code>",
156
+ "<jupyter_output>",
157
+ "<jupyter_script>",
158
+ "<empty_output>"
159
+ ],
160
+ "bos_token": "<|endoftext|>",
161
+ "clean_up_tokenization_spaces": false,
162
+ "eos_token": "<|endoftext|>",
163
+ "extra_special_tokens": {},
164
+ "model_max_length": 8192,
165
+ "pad_token": "<|endoftext|>",
166
+ "tokenizer_class": "GPT2Tokenizer",
167
+ "unk_token": "<|endoftext|>",
168
+ "vocab_size": 49152
169
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ebe69044be4b205a2fb5fbf1482e23a773dc62ff6a19e21c93d1424c639e56ce
3
+ size 5944
vocab.json ADDED
The diff for this file is too large to render. See raw diff