Timonafri commited on
Commit
65f521e
·
verified ·
1 Parent(s): 333291e

Full backup of working directory

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +8 -0
  2. data/merged.jsonl +3 -0
  3. gemma-4-e2b-it.F16.gguf +0 -0
  4. gemma4_e2b_out/README.md +59 -0
  5. gemma4_e2b_out/checkpoint-1000/README.md +210 -0
  6. gemma4_e2b_out/checkpoint-1000/adapter_config.json +44 -0
  7. gemma4_e2b_out/checkpoint-1000/adapter_model.safetensors +3 -0
  8. gemma4_e2b_out/checkpoint-1000/chat_template.jinja +70 -0
  9. gemma4_e2b_out/checkpoint-1000/optimizer.pt +3 -0
  10. gemma4_e2b_out/checkpoint-1000/rng_state.pth +3 -0
  11. gemma4_e2b_out/checkpoint-1000/scaler.pt +3 -0
  12. gemma4_e2b_out/checkpoint-1000/scheduler.pt +3 -0
  13. gemma4_e2b_out/checkpoint-1000/tokenizer.json +3 -0
  14. gemma4_e2b_out/checkpoint-1000/tokenizer_config.json +289 -0
  15. gemma4_e2b_out/checkpoint-1000/trainer_state.json +734 -0
  16. gemma4_e2b_out/checkpoint-1000/training_args.bin +3 -0
  17. gemma4_gguf/chat_template.jinja +70 -0
  18. gemma4_gguf/config.json +193 -0
  19. gemma4_gguf/generation_config.json +14 -0
  20. gemma4_gguf/model.safetensors +3 -0
  21. gemma4_gguf/temp_split_0de139d7_000.safetensors +3 -0
  22. gemma4_gguf/temp_split_0de139d7_001.safetensors +3 -0
  23. gemma4_gguf/temp_split_0de139d7_002.safetensors +3 -0
  24. gemma4_gguf/temp_split_0de139d7_003.safetensors +3 -0
  25. gemma4_gguf/tokenizer.json +3 -0
  26. gemma4_gguf/tokenizer_config.json +290 -0
  27. lora_weights_final/README.md +210 -0
  28. lora_weights_final/adapter_config.json +44 -0
  29. lora_weights_final/adapter_model.safetensors +3 -0
  30. lora_weights_final/chat_template.jinja +70 -0
  31. lora_weights_final/tokenizer.json +3 -0
  32. lora_weights_final/tokenizer_config.json +289 -0
  33. unsloth_compiled_cache/AqlmLoraLinear_peft_forward.py +89 -0
  34. unsloth_compiled_cache/AwqLoraLinear_peft_forward.py +88 -0
  35. unsloth_compiled_cache/BatchNorm1d.py +121 -0
  36. unsloth_compiled_cache/BatchNorm2d.py +121 -0
  37. unsloth_compiled_cache/BatchNorm3d.py +121 -0
  38. unsloth_compiled_cache/BlockDiagonalLinear_peft_forward.py +75 -0
  39. unsloth_compiled_cache/Conv1d.py +78 -0
  40. unsloth_compiled_cache/Conv2d.py +78 -0
  41. unsloth_compiled_cache/Conv3d.py +78 -0
  42. unsloth_compiled_cache/ConvTranspose1d.py +105 -0
  43. unsloth_compiled_cache/ConvTranspose2d.py +114 -0
  44. unsloth_compiled_cache/ConvTranspose3d.py +106 -0
  45. unsloth_compiled_cache/GPTQLoraLinear_peft_forward.py +96 -0
  46. unsloth_compiled_cache/GroupNorm.py +74 -0
  47. unsloth_compiled_cache/LayerNorm.py +76 -0
  48. unsloth_compiled_cache/Linear4bit_peft_forward.py +126 -0
  49. unsloth_compiled_cache/Linear8bitLt_peft_forward.py +118 -0
  50. unsloth_compiled_cache/Linear_peft_forward.py +115 -0
.gitattributes CHANGED
@@ -33,3 +33,11 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ data/merged.jsonl filter=lfs diff=lfs merge=lfs -text
37
+ gemma4_e2b_out/checkpoint-1000/tokenizer.json filter=lfs diff=lfs merge=lfs -text
38
+ gemma4_gguf/tokenizer.json filter=lfs diff=lfs merge=lfs -text
39
+ lora_weights_final/tokenizer.json filter=lfs diff=lfs merge=lfs -text
40
+ unsloth_compiled_cache/__pycache__/UnslothDPOTrainer.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
41
+ unsloth_compiled_cache/__pycache__/UnslothGRPOTrainer.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
42
+ unsloth_compiled_cache/__pycache__/UnslothKTOTrainer.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
43
+ unsloth_compiled_cache/__pycache__/UnslothRLOOTrainer.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
data/merged.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8c41510b2b0f6b95e6ae376da19a095eb2d034c1455b2e3d609d9a8f194e3c27
3
+ size 1141102581
gemma-4-e2b-it.F16.gguf ADDED
File without changes
gemma4_e2b_out/README.md ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: unsloth/gemma-4-e2b-it-unsloth-bnb-4bit
3
+ library_name: transformers
4
+ model_name: gemma4_e2b_out
5
+ tags:
6
+ - generated_from_trainer
7
+ - trl
8
+ - unsloth
9
+ - sft
10
+ licence: license
11
+ ---
12
+
13
+ # Model Card for gemma4_e2b_out
14
+
15
+ This model is a fine-tuned version of [unsloth/gemma-4-e2b-it-unsloth-bnb-4bit](https://huggingface.co/unsloth/gemma-4-e2b-it-unsloth-bnb-4bit).
16
+ It has been trained using [TRL](https://github.com/huggingface/trl).
17
+
18
+ ## Quick start
19
+
20
+ ```python
21
+ from transformers import pipeline
22
+
23
+ question = "If you had a time machine, but could only go to the past or the future once and never return, which would you choose and why?"
24
+ generator = pipeline("text-generation", model="None", device="cuda")
25
+ output = generator([{"role": "user", "content": question}], max_new_tokens=128, return_full_text=False)[0]
26
+ print(output["generated_text"])
27
+ ```
28
+
29
+ ## Training procedure
30
+
31
+
32
+
33
+
34
+
35
+ This model was trained with SFT.
36
+
37
+ ### Framework versions
38
+
39
+ - TRL: 1.7.0
40
+ - Transformers: 5.5.0
41
+ - Pytorch: 2.10.0+cu128
42
+ - Datasets: 5.0.0
43
+ - Tokenizers: 0.22.2
44
+
45
+ ## Citations
46
+
47
+
48
+
49
+ Cite TRL as:
50
+
51
+ ```bibtex
52
+ @software{vonwerra2020trl,
53
+ title = {{TRL: Transformers Reinforcement Learning}},
54
+ author = {von Werra, Leandro and Belkada, Younes and Tunstall, Lewis and Beeching, Edward and Thrush, Tristan and Lambert, Nathan and Huang, Shengyi and Rasul, Kashif and Gallouédec, Quentin},
55
+ license = {Apache-2.0},
56
+ url = {https://github.com/huggingface/trl},
57
+ year = {2020}
58
+ }
59
+ ```
gemma4_e2b_out/checkpoint-1000/README.md ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: unsloth/gemma-4-e2b-it-unsloth-bnb-4bit
3
+ library_name: peft
4
+ pipeline_tag: text-generation
5
+ tags:
6
+ - base_model:adapter:unsloth/gemma-4-e2b-it-unsloth-bnb-4bit
7
+ - lora
8
+ - sft
9
+ - transformers
10
+ - trl
11
+ - unsloth
12
+ ---
13
+
14
+ # Model Card for Model ID
15
+
16
+ <!-- Provide a quick summary of what the model is/does. -->
17
+
18
+
19
+
20
+ ## Model Details
21
+
22
+ ### Model Description
23
+
24
+ <!-- Provide a longer summary of what this model is. -->
25
+
26
+
27
+
28
+ - **Developed by:** [More Information Needed]
29
+ - **Funded by [optional]:** [More Information Needed]
30
+ - **Shared by [optional]:** [More Information Needed]
31
+ - **Model type:** [More Information Needed]
32
+ - **Language(s) (NLP):** [More Information Needed]
33
+ - **License:** [More Information Needed]
34
+ - **Finetuned from model [optional]:** [More Information Needed]
35
+
36
+ ### Model Sources [optional]
37
+
38
+ <!-- Provide the basic links for the model. -->
39
+
40
+ - **Repository:** [More Information Needed]
41
+ - **Paper [optional]:** [More Information Needed]
42
+ - **Demo [optional]:** [More Information Needed]
43
+
44
+ ## Uses
45
+
46
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
47
+
48
+ ### Direct Use
49
+
50
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
51
+
52
+ [More Information Needed]
53
+
54
+ ### Downstream Use [optional]
55
+
56
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
57
+
58
+ [More Information Needed]
59
+
60
+ ### Out-of-Scope Use
61
+
62
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
63
+
64
+ [More Information Needed]
65
+
66
+ ## Bias, Risks, and Limitations
67
+
68
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
69
+
70
+ [More Information Needed]
71
+
72
+ ### Recommendations
73
+
74
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
75
+
76
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
77
+
78
+ ## How to Get Started with the Model
79
+
80
+ Use the code below to get started with the model.
81
+
82
+ [More Information Needed]
83
+
84
+ ## Training Details
85
+
86
+ ### Training Data
87
+
88
+ <!-- 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. -->
89
+
90
+ [More Information Needed]
91
+
92
+ ### Training Procedure
93
+
94
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
95
+
96
+ #### Preprocessing [optional]
97
+
98
+ [More Information Needed]
99
+
100
+
101
+ #### Training Hyperparameters
102
+
103
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
104
+
105
+ #### Speeds, Sizes, Times [optional]
106
+
107
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
108
+
109
+ [More Information Needed]
110
+
111
+ ## Evaluation
112
+
113
+ <!-- This section describes the evaluation protocols and provides the results. -->
114
+
115
+ ### Testing Data, Factors & Metrics
116
+
117
+ #### Testing Data
118
+
119
+ <!-- This should link to a Dataset Card if possible. -->
120
+
121
+ [More Information Needed]
122
+
123
+ #### Factors
124
+
125
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
126
+
127
+ [More Information Needed]
128
+
129
+ #### Metrics
130
+
131
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
132
+
133
+ [More Information Needed]
134
+
135
+ ### Results
136
+
137
+ [More Information Needed]
138
+
139
+ #### Summary
140
+
141
+
142
+
143
+ ## Model Examination [optional]
144
+
145
+ <!-- Relevant interpretability work for the model goes here -->
146
+
147
+ [More Information Needed]
148
+
149
+ ## Environmental Impact
150
+
151
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
152
+
153
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
154
+
155
+ - **Hardware Type:** [More Information Needed]
156
+ - **Hours used:** [More Information Needed]
157
+ - **Cloud Provider:** [More Information Needed]
158
+ - **Compute Region:** [More Information Needed]
159
+ - **Carbon Emitted:** [More Information Needed]
160
+
161
+ ## Technical Specifications [optional]
162
+
163
+ ### Model Architecture and Objective
164
+
165
+ [More Information Needed]
166
+
167
+ ### Compute Infrastructure
168
+
169
+ [More Information Needed]
170
+
171
+ #### Hardware
172
+
173
+ [More Information Needed]
174
+
175
+ #### Software
176
+
177
+ [More Information Needed]
178
+
179
+ ## Citation [optional]
180
+
181
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
182
+
183
+ **BibTeX:**
184
+
185
+ [More Information Needed]
186
+
187
+ **APA:**
188
+
189
+ [More Information Needed]
190
+
191
+ ## Glossary [optional]
192
+
193
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
194
+
195
+ [More Information Needed]
196
+
197
+ ## More Information [optional]
198
+
199
+ [More Information Needed]
200
+
201
+ ## Model Card Authors [optional]
202
+
203
+ [More Information Needed]
204
+
205
+ ## Model Card Contact
206
+
207
+ [More Information Needed]
208
+ ### Framework versions
209
+
210
+ - PEFT 0.19.1
gemma4_e2b_out/checkpoint-1000/adapter_config.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": {
6
+ "base_model_class": "Gemma4ForConditionalGeneration",
7
+ "parent_library": "transformers.models.gemma4.modeling_gemma4",
8
+ "unsloth_fixed": true
9
+ },
10
+ "base_model_name_or_path": "unsloth/gemma-4-e2b-it-unsloth-bnb-4bit",
11
+ "bias": "none",
12
+ "corda_config": null,
13
+ "ensure_weight_tying": false,
14
+ "eva_config": null,
15
+ "exclude_modules": null,
16
+ "fan_in_fan_out": false,
17
+ "inference_mode": true,
18
+ "init_lora_weights": true,
19
+ "layer_replication": null,
20
+ "layers_pattern": null,
21
+ "layers_to_transform": null,
22
+ "loftq_config": {},
23
+ "lora_alpha": 32,
24
+ "lora_bias": false,
25
+ "lora_dropout": 0,
26
+ "lora_ga_config": null,
27
+ "megatron_config": null,
28
+ "megatron_core": "megatron.core",
29
+ "modules_to_save": null,
30
+ "peft_type": "LORA",
31
+ "peft_version": "0.19.1",
32
+ "qalora_group_size": 16,
33
+ "r": 32,
34
+ "rank_pattern": {},
35
+ "revision": null,
36
+ "target_modules": "(?:.*?(?:language|text).*?(?:self_attn|attention|attn|mixer|mlp|feed_forward|ffn|dense|mixer).*?(?:q_proj|k_proj|v_proj|o_proj|gate_proj|up_proj|down_proj))|(?:\\bmodel\\.layers\\.[\\d]{1,}\\.(?:self_attn|attention|attn|mixer|mlp|feed_forward|ffn|dense|mixer)\\.(?:(?:q_proj|k_proj|v_proj|o_proj|gate_proj|up_proj|down_proj)))",
37
+ "target_parameters": null,
38
+ "task_type": "CAUSAL_LM",
39
+ "trainable_token_indices": null,
40
+ "use_bdlora": null,
41
+ "use_dora": false,
42
+ "use_qalora": false,
43
+ "use_rslora": false
44
+ }
gemma4_e2b_out/checkpoint-1000/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f14e7d5c4c6cfe03e5f99ffea455059061c7edc6b443e909b0c236b0bc8913cb
3
+ size 101424416
gemma4_e2b_out/checkpoint-1000/chat_template.jinja ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{ bos_token }}{%- macro strip_thinking(text) -%}
2
+ {%- set ns = namespace(result='') -%}
3
+ {%- for part in text.split('<channel|>') -%}
4
+ {%- if '<|channel>' in part -%}
5
+ {%- set ns.result = ns.result + part.split('<|channel>')[0] -%}
6
+ {%- else -%}
7
+ {%- set ns.result = ns.result + part -%}
8
+ {%- endif -%}
9
+ {%- endfor -%}
10
+ {{- ns.result | trim -}}
11
+ {%- endmacro -%}
12
+ {%- set thinking = enable_thinking is defined and enable_thinking -%}
13
+ {%- set loop_messages = messages -%}
14
+ {%- if messages[0]['role'] in ['system', 'developer'] or thinking -%}
15
+ {{ '<|turn>system
16
+ ' }}
17
+ {%- if thinking -%}
18
+ {{ '<|think|>
19
+ ' }}
20
+ {%- endif -%}
21
+ {%- if messages[0]['role'] in ['system', 'developer'] -%}
22
+ {{ messages[0]['content'] | trim }}
23
+ {%- set loop_messages = messages[1:] -%}
24
+ {%- endif -%}
25
+ {{ '<turn|>
26
+ ' }}
27
+ {%- endif -%}
28
+ {%- for message in loop_messages -%}
29
+ {%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) -%}
30
+ {{ raise_exception("Conversation roles must alternate user/assistant/user/assistant/...") }}
31
+ {%- endif -%}
32
+ {%- if (message['role'] == 'assistant') -%}
33
+ {%- set role = "model" -%}
34
+ {%- else -%}
35
+ {%- set role = message['role'] -%}
36
+ {%- endif -%}
37
+ {{ '<|turn>' + role + '
38
+ ' }}
39
+ {%- if message['content'] is string -%}
40
+ {%- if role == "model" -%}
41
+ {{ strip_thinking(message['content']) }}
42
+ {%- else -%}
43
+ {{ message['content'] | trim }}
44
+ {%- endif -%}
45
+ {%- elif message['content'] is iterable -%}
46
+ {%- for item in message['content'] -%}
47
+ {%- if item['type'] == 'audio' -%}
48
+ {{ '<|audio|>' }}
49
+ {%- elif item['type'] == 'image' -%}
50
+ {{ '<|image|>' }}
51
+ {%- elif item['type'] == 'video' -%}
52
+ {{ '<|video|>' }}
53
+ {%- elif item['type'] == 'text' -%}
54
+ {%- if role == "model" -%}
55
+ {{ strip_thinking(item['text']) }}
56
+ {%- else -%}
57
+ {{ item['text'] | trim }}
58
+ {%- endif -%}
59
+ {%- endif -%}
60
+ {%- endfor -%}
61
+ {%- else -%}
62
+ {{ raise_exception("Invalid content type") }}
63
+ {%- endif -%}
64
+ {{ '<turn|>
65
+ ' }}
66
+ {%- endfor -%}
67
+ {%- if add_generation_prompt -%}
68
+ {{'<|turn>model
69
+ '}}
70
+ {%- endif -%}
gemma4_e2b_out/checkpoint-1000/optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a2575ed92e8989cf22e760c7aeb0346eb2d9dcbca70e4e57e5e7dd63ffb23173
3
+ size 98628429
gemma4_e2b_out/checkpoint-1000/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f1d565802a8e26c4e8a31328752b7a7fdc186d9401aa008e65697d0ad8c22e33
3
+ size 14645
gemma4_e2b_out/checkpoint-1000/scaler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:14ae2a2128444abab378aa06c09a61a84665f758fcc19fc46f5789b0bc1b5665
3
+ size 1383
gemma4_e2b_out/checkpoint-1000/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ada16671df03ce2c4c7b2196578593f96e5a9638c91cc68f984858ec0e816498
3
+ size 1465
gemma4_e2b_out/checkpoint-1000/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cc8d3a0ce36466ccc1278bf987df5f71db1719b9ca6b4118264f45cb627bfe0f
3
+ size 32169626
gemma4_e2b_out/checkpoint-1000/tokenizer_config.json ADDED
@@ -0,0 +1,289 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "audio_token": "<|audio|>",
3
+ "backend": "tokenizers",
4
+ "boa_token": "<|audio>",
5
+ "boi_token": "<|image>",
6
+ "bos_token": "<bos>",
7
+ "eoa_token": "<audio|>",
8
+ "eoc_token": "<channel|>",
9
+ "eoi_token": "<image|>",
10
+ "eos_token": "<eos>",
11
+ "eot_token": "<turn|>",
12
+ "escape_token": "<|\"|>",
13
+ "etc_token": "<tool_call|>",
14
+ "etd_token": "<tool|>",
15
+ "etr_token": "<tool_response|>",
16
+ "extra_special_tokens": [
17
+ "<|video|>"
18
+ ],
19
+ "image_token": "<|image|>",
20
+ "is_local": false,
21
+ "mask_token": "<mask>",
22
+ "model_max_length": 131072,
23
+ "model_specific_special_tokens": {
24
+ "audio_token": "<|audio|>",
25
+ "boa_token": "<|audio>",
26
+ "boi_token": "<|image>",
27
+ "eoa_token": "<audio|>",
28
+ "eoc_token": "<channel|>",
29
+ "eoi_token": "<image|>",
30
+ "eot_token": "<turn|>",
31
+ "escape_token": "<|\"|>",
32
+ "etc_token": "<tool_call|>",
33
+ "etd_token": "<tool|>",
34
+ "etr_token": "<tool_response|>",
35
+ "image_token": "<|image|>",
36
+ "soc_token": "<|channel>",
37
+ "sot_token": "<|turn>",
38
+ "stc_token": "<|tool_call>",
39
+ "std_token": "<|tool>",
40
+ "str_token": "<|tool_response>",
41
+ "think_token": "<|think|>"
42
+ },
43
+ "pad_token": "<pad>",
44
+ "padding_side": "right",
45
+ "processor_class": "Gemma4Processor",
46
+ "response_schema": {
47
+ "properties": {
48
+ "content": {
49
+ "type": "string"
50
+ },
51
+ "role": {
52
+ "const": "assistant"
53
+ },
54
+ "thinking": {
55
+ "type": "string"
56
+ },
57
+ "tool_calls": {
58
+ "items": {
59
+ "properties": {
60
+ "function": {
61
+ "properties": {
62
+ "arguments": {
63
+ "additionalProperties": {},
64
+ "type": "object",
65
+ "x-parser": "gemma4-tool-call"
66
+ },
67
+ "name": {
68
+ "type": "string"
69
+ }
70
+ },
71
+ "type": "object",
72
+ "x-regex": "call\\:(?P<name>\\w+)(?P<arguments>\\{.*\\})"
73
+ },
74
+ "type": {
75
+ "const": "function"
76
+ }
77
+ },
78
+ "type": "object"
79
+ },
80
+ "type": "array",
81
+ "x-regex-iterator": "<\\|tool_call>(.*?)<tool_call\\|>"
82
+ }
83
+ },
84
+ "type": "object",
85
+ "x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?P<content>(?:(?!\\<turn\\|\\>)(?!\\<\\|tool_response\\>).)+)?(?:\\<turn\\|\\>|\\<\\|tool_response\\>)?"
86
+ },
87
+ "soc_token": "<|channel>",
88
+ "sot_token": "<|turn>",
89
+ "stc_token": "<|tool_call>",
90
+ "std_token": "<|tool>",
91
+ "str_token": "<|tool_response>",
92
+ "think_token": "<|think|>",
93
+ "tokenizer_class": "GemmaTokenizer",
94
+ "unk_token": "<unk>",
95
+ "added_tokens_decoder": {
96
+ "0": {
97
+ "content": "<pad>",
98
+ "single_word": false,
99
+ "lstrip": false,
100
+ "rstrip": false,
101
+ "normalized": false,
102
+ "special": true
103
+ },
104
+ "1": {
105
+ "content": "<eos>",
106
+ "single_word": false,
107
+ "lstrip": false,
108
+ "rstrip": false,
109
+ "normalized": false,
110
+ "special": true
111
+ },
112
+ "2": {
113
+ "content": "<bos>",
114
+ "single_word": false,
115
+ "lstrip": false,
116
+ "rstrip": false,
117
+ "normalized": false,
118
+ "special": true
119
+ },
120
+ "3": {
121
+ "content": "<unk>",
122
+ "single_word": false,
123
+ "lstrip": false,
124
+ "rstrip": false,
125
+ "normalized": false,
126
+ "special": true
127
+ },
128
+ "4": {
129
+ "content": "<mask>",
130
+ "single_word": false,
131
+ "lstrip": false,
132
+ "rstrip": false,
133
+ "normalized": false,
134
+ "special": true
135
+ },
136
+ "46": {
137
+ "content": "<|tool>",
138
+ "single_word": false,
139
+ "lstrip": false,
140
+ "rstrip": false,
141
+ "normalized": false,
142
+ "special": true
143
+ },
144
+ "47": {
145
+ "content": "<tool|>",
146
+ "single_word": false,
147
+ "lstrip": false,
148
+ "rstrip": false,
149
+ "normalized": false,
150
+ "special": true
151
+ },
152
+ "48": {
153
+ "content": "<|tool_call>",
154
+ "single_word": false,
155
+ "lstrip": false,
156
+ "rstrip": false,
157
+ "normalized": false,
158
+ "special": true
159
+ },
160
+ "49": {
161
+ "content": "<tool_call|>",
162
+ "single_word": false,
163
+ "lstrip": false,
164
+ "rstrip": false,
165
+ "normalized": false,
166
+ "special": true
167
+ },
168
+ "50": {
169
+ "content": "<|tool_response>",
170
+ "single_word": false,
171
+ "lstrip": false,
172
+ "rstrip": false,
173
+ "normalized": false,
174
+ "special": true
175
+ },
176
+ "51": {
177
+ "content": "<tool_response|>",
178
+ "single_word": false,
179
+ "lstrip": false,
180
+ "rstrip": false,
181
+ "normalized": false,
182
+ "special": true
183
+ },
184
+ "52": {
185
+ "content": "<|\"|>",
186
+ "single_word": false,
187
+ "lstrip": false,
188
+ "rstrip": false,
189
+ "normalized": false,
190
+ "special": true
191
+ },
192
+ "98": {
193
+ "content": "<|think|>",
194
+ "single_word": false,
195
+ "lstrip": false,
196
+ "rstrip": false,
197
+ "normalized": false,
198
+ "special": true
199
+ },
200
+ "100": {
201
+ "content": "<|channel>",
202
+ "single_word": false,
203
+ "lstrip": false,
204
+ "rstrip": false,
205
+ "normalized": false,
206
+ "special": true
207
+ },
208
+ "101": {
209
+ "content": "<channel|>",
210
+ "single_word": false,
211
+ "lstrip": false,
212
+ "rstrip": false,
213
+ "normalized": false,
214
+ "special": true
215
+ },
216
+ "105": {
217
+ "content": "<|turn>",
218
+ "single_word": false,
219
+ "lstrip": false,
220
+ "rstrip": false,
221
+ "normalized": false,
222
+ "special": true
223
+ },
224
+ "106": {
225
+ "content": "<turn|>",
226
+ "single_word": false,
227
+ "lstrip": false,
228
+ "rstrip": false,
229
+ "normalized": false,
230
+ "special": true
231
+ },
232
+ "255999": {
233
+ "content": "<|image>",
234
+ "single_word": false,
235
+ "lstrip": false,
236
+ "rstrip": false,
237
+ "normalized": false,
238
+ "special": true
239
+ },
240
+ "256000": {
241
+ "content": "<|audio>",
242
+ "single_word": false,
243
+ "lstrip": false,
244
+ "rstrip": false,
245
+ "normalized": false,
246
+ "special": true
247
+ },
248
+ "258880": {
249
+ "content": "<|image|>",
250
+ "single_word": false,
251
+ "lstrip": false,
252
+ "rstrip": false,
253
+ "normalized": false,
254
+ "special": true
255
+ },
256
+ "258881": {
257
+ "content": "<|audio|>",
258
+ "single_word": false,
259
+ "lstrip": false,
260
+ "rstrip": false,
261
+ "normalized": false,
262
+ "special": true
263
+ },
264
+ "258882": {
265
+ "content": "<image|>",
266
+ "single_word": false,
267
+ "lstrip": false,
268
+ "rstrip": false,
269
+ "normalized": false,
270
+ "special": true
271
+ },
272
+ "258883": {
273
+ "content": "<audio|>",
274
+ "single_word": false,
275
+ "lstrip": false,
276
+ "rstrip": false,
277
+ "normalized": false,
278
+ "special": true
279
+ },
280
+ "258884": {
281
+ "content": "<|video|>",
282
+ "single_word": false,
283
+ "lstrip": false,
284
+ "rstrip": false,
285
+ "normalized": false,
286
+ "special": true
287
+ }
288
+ }
289
+ }
gemma4_e2b_out/checkpoint-1000/trainer_state.json ADDED
@@ -0,0 +1,734 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_global_step": null,
3
+ "best_metric": null,
4
+ "best_model_checkpoint": null,
5
+ "epoch": 0.024417639302632223,
6
+ "eval_steps": 500,
7
+ "global_step": 1000,
8
+ "is_hyper_param_search": false,
9
+ "is_local_process_zero": true,
10
+ "is_world_process_zero": true,
11
+ "log_history": [
12
+ {
13
+ "epoch": 0.00024417639302632224,
14
+ "grad_norm": 0.48828125,
15
+ "learning_rate": 1.8e-05,
16
+ "loss": 1.1311161994934082,
17
+ "step": 10
18
+ },
19
+ {
20
+ "epoch": 0.0004883527860526445,
21
+ "grad_norm": 1.046875,
22
+ "learning_rate": 3.8e-05,
23
+ "loss": 1.2175333976745606,
24
+ "step": 20
25
+ },
26
+ {
27
+ "epoch": 0.0007325291790789666,
28
+ "grad_norm": 0.55859375,
29
+ "learning_rate": 5.8e-05,
30
+ "loss": 0.8916121482849121,
31
+ "step": 30
32
+ },
33
+ {
34
+ "epoch": 0.000976705572105289,
35
+ "grad_norm": 0.349609375,
36
+ "learning_rate": 7.800000000000001e-05,
37
+ "loss": 0.588713550567627,
38
+ "step": 40
39
+ },
40
+ {
41
+ "epoch": 0.0012208819651316112,
42
+ "grad_norm": 0.2431640625,
43
+ "learning_rate": 9.8e-05,
44
+ "loss": 0.5149059772491456,
45
+ "step": 50
46
+ },
47
+ {
48
+ "epoch": 0.0014650583581579332,
49
+ "grad_norm": 0.1484375,
50
+ "learning_rate": 0.000118,
51
+ "loss": 0.4876229286193848,
52
+ "step": 60
53
+ },
54
+ {
55
+ "epoch": 0.0017092347511842554,
56
+ "grad_norm": 0.10400390625,
57
+ "learning_rate": 0.000138,
58
+ "loss": 0.4492696762084961,
59
+ "step": 70
60
+ },
61
+ {
62
+ "epoch": 0.001953411144210578,
63
+ "grad_norm": 0.0966796875,
64
+ "learning_rate": 0.00015800000000000002,
65
+ "loss": 0.4119694232940674,
66
+ "step": 80
67
+ },
68
+ {
69
+ "epoch": 0.0021975875372369,
70
+ "grad_norm": 0.1025390625,
71
+ "learning_rate": 0.00017800000000000002,
72
+ "loss": 0.42351255416870115,
73
+ "step": 90
74
+ },
75
+ {
76
+ "epoch": 0.0024417639302632224,
77
+ "grad_norm": 0.73828125,
78
+ "learning_rate": 0.00019800000000000002,
79
+ "loss": 0.413313627243042,
80
+ "step": 100
81
+ },
82
+ {
83
+ "epoch": 0.0026859403232895444,
84
+ "grad_norm": 0.11376953125,
85
+ "learning_rate": 0.00019995065603657316,
86
+ "loss": 0.4356351852416992,
87
+ "step": 110
88
+ },
89
+ {
90
+ "epoch": 0.0029301167163158664,
91
+ "grad_norm": 0.1376953125,
92
+ "learning_rate": 0.000199780146829205,
93
+ "loss": 0.3644850492477417,
94
+ "step": 120
95
+ },
96
+ {
97
+ "epoch": 0.003174293109342189,
98
+ "grad_norm": 0.07421875,
99
+ "learning_rate": 0.00019948807088287883,
100
+ "loss": 0.392529559135437,
101
+ "step": 130
102
+ },
103
+ {
104
+ "epoch": 0.003418469502368511,
105
+ "grad_norm": 0.11279296875,
106
+ "learning_rate": 0.00019907478404714436,
107
+ "loss": 0.42130446434020996,
108
+ "step": 140
109
+ },
110
+ {
111
+ "epoch": 0.0036626458953948333,
112
+ "grad_norm": 0.12109375,
113
+ "learning_rate": 0.00019854078984834903,
114
+ "loss": 0.4250969409942627,
115
+ "step": 150
116
+ },
117
+ {
118
+ "epoch": 0.003906822288421156,
119
+ "grad_norm": 0.10693359375,
120
+ "learning_rate": 0.0001978867388761685,
121
+ "loss": 0.3913136005401611,
122
+ "step": 160
123
+ },
124
+ {
125
+ "epoch": 0.004150998681447478,
126
+ "grad_norm": 0.08984375,
127
+ "learning_rate": 0.00019711342799096361,
128
+ "loss": 0.40640673637390134,
129
+ "step": 170
130
+ },
131
+ {
132
+ "epoch": 0.0043951750744738,
133
+ "grad_norm": 0.1005859375,
134
+ "learning_rate": 0.00019622179935292855,
135
+ "loss": 0.3612894773483276,
136
+ "step": 180
137
+ },
138
+ {
139
+ "epoch": 0.004639351467500122,
140
+ "grad_norm": 0.10302734375,
141
+ "learning_rate": 0.00019521293927421388,
142
+ "loss": 0.3791630268096924,
143
+ "step": 190
144
+ },
145
+ {
146
+ "epoch": 0.004883527860526445,
147
+ "grad_norm": 0.05712890625,
148
+ "learning_rate": 0.00019408807689542257,
149
+ "loss": 0.3566859245300293,
150
+ "step": 200
151
+ },
152
+ {
153
+ "epoch": 0.005127704253552767,
154
+ "grad_norm": 0.0830078125,
155
+ "learning_rate": 0.00019284858268809137,
156
+ "loss": 0.3679236888885498,
157
+ "step": 210
158
+ },
159
+ {
160
+ "epoch": 0.005371880646579089,
161
+ "grad_norm": 0.10888671875,
162
+ "learning_rate": 0.0001914959667849825,
163
+ "loss": 0.38951241970062256,
164
+ "step": 220
165
+ },
166
+ {
167
+ "epoch": 0.005616057039605411,
168
+ "grad_norm": 0.087890625,
169
+ "learning_rate": 0.00019003187714021938,
170
+ "loss": 0.380203104019165,
171
+ "step": 230
172
+ },
173
+ {
174
+ "epoch": 0.005860233432631733,
175
+ "grad_norm": 0.11767578125,
176
+ "learning_rate": 0.0001884580975215084,
177
+ "loss": 0.3717670202255249,
178
+ "step": 240
179
+ },
180
+ {
181
+ "epoch": 0.006104409825658056,
182
+ "grad_norm": 0.07275390625,
183
+ "learning_rate": 0.00018677654533689287,
184
+ "loss": 0.3654949426651001,
185
+ "step": 250
186
+ },
187
+ {
188
+ "epoch": 0.006348586218684378,
189
+ "grad_norm": 0.11572265625,
190
+ "learning_rate": 0.00018498926929868642,
191
+ "loss": 0.32950897216796876,
192
+ "step": 260
193
+ },
194
+ {
195
+ "epoch": 0.0065927626117107,
196
+ "grad_norm": 0.08984375,
197
+ "learning_rate": 0.00018309844692743283,
198
+ "loss": 0.35263752937316895,
199
+ "step": 270
200
+ },
201
+ {
202
+ "epoch": 0.006836939004737022,
203
+ "grad_norm": 0.111328125,
204
+ "learning_rate": 0.00018110638189893267,
205
+ "loss": 0.37081763744354246,
206
+ "step": 280
207
+ },
208
+ {
209
+ "epoch": 0.007081115397763345,
210
+ "grad_norm": 0.0625,
211
+ "learning_rate": 0.00017901550123756906,
212
+ "loss": 0.34837267398834226,
213
+ "step": 290
214
+ },
215
+ {
216
+ "epoch": 0.007325291790789667,
217
+ "grad_norm": 0.078125,
218
+ "learning_rate": 0.00017682835235935236,
219
+ "loss": 0.37078888416290284,
220
+ "step": 300
221
+ },
222
+ {
223
+ "epoch": 0.007569468183815989,
224
+ "grad_norm": 0.08447265625,
225
+ "learning_rate": 0.00017454759996828623,
226
+ "loss": 0.3861753702163696,
227
+ "step": 310
228
+ },
229
+ {
230
+ "epoch": 0.007813644576842312,
231
+ "grad_norm": 0.10498046875,
232
+ "learning_rate": 0.00017217602280983623,
233
+ "loss": 0.32866339683532714,
234
+ "step": 320
235
+ },
236
+ {
237
+ "epoch": 0.008057820969868634,
238
+ "grad_norm": 0.07568359375,
239
+ "learning_rate": 0.00016971651028545648,
240
+ "loss": 0.4176007270812988,
241
+ "step": 330
242
+ },
243
+ {
244
+ "epoch": 0.008301997362894956,
245
+ "grad_norm": 0.07666015625,
246
+ "learning_rate": 0.00016717205893229903,
247
+ "loss": 0.32620184421539306,
248
+ "step": 340
249
+ },
250
+ {
251
+ "epoch": 0.008546173755921278,
252
+ "grad_norm": 0.0732421875,
253
+ "learning_rate": 0.00016454576877239507,
254
+ "loss": 0.36540043354034424,
255
+ "step": 350
256
+ },
257
+ {
258
+ "epoch": 0.0087903501489476,
259
+ "grad_norm": 0.057861328125,
260
+ "learning_rate": 0.0001618408395357554,
261
+ "loss": 0.3834134578704834,
262
+ "step": 360
263
+ },
264
+ {
265
+ "epoch": 0.009034526541973922,
266
+ "grad_norm": 0.0771484375,
267
+ "learning_rate": 0.00015906056676199255,
268
+ "loss": 0.3537560701370239,
269
+ "step": 370
270
+ },
271
+ {
272
+ "epoch": 0.009278702935000244,
273
+ "grad_norm": 0.1044921875,
274
+ "learning_rate": 0.00015620833778521307,
275
+ "loss": 0.39911091327667236,
276
+ "step": 380
277
+ },
278
+ {
279
+ "epoch": 0.009522879328026566,
280
+ "grad_norm": 0.0830078125,
281
+ "learning_rate": 0.000153287627607073,
282
+ "loss": 0.3524473667144775,
283
+ "step": 390
284
+ },
285
+ {
286
+ "epoch": 0.00976705572105289,
287
+ "grad_norm": 0.09619140625,
288
+ "learning_rate": 0.00015030199466302353,
289
+ "loss": 0.37404372692108157,
290
+ "step": 400
291
+ },
292
+ {
293
+ "epoch": 0.010011232114079211,
294
+ "grad_norm": 0.0859375,
295
+ "learning_rate": 0.00014725507648690543,
296
+ "loss": 0.3956392765045166,
297
+ "step": 410
298
+ },
299
+ {
300
+ "epoch": 0.010255408507105533,
301
+ "grad_norm": 0.06787109375,
302
+ "learning_rate": 0.00014415058527917452,
303
+ "loss": 0.375267767906189,
304
+ "step": 420
305
+ },
306
+ {
307
+ "epoch": 0.010499584900131856,
308
+ "grad_norm": 0.1181640625,
309
+ "learning_rate": 0.00014099230338415728,
310
+ "loss": 0.3407683610916138,
311
+ "step": 430
312
+ },
313
+ {
314
+ "epoch": 0.010743761293158178,
315
+ "grad_norm": 0.068359375,
316
+ "learning_rate": 0.00013778407868184672,
317
+ "loss": 0.3405567407608032,
318
+ "step": 440
319
+ },
320
+ {
321
+ "epoch": 0.0109879376861845,
322
+ "grad_norm": 0.0810546875,
323
+ "learning_rate": 0.00013452981989985348,
324
+ "loss": 0.3458467960357666,
325
+ "step": 450
326
+ },
327
+ {
328
+ "epoch": 0.011232114079210822,
329
+ "grad_norm": 0.0732421875,
330
+ "learning_rate": 0.00013123349185122327,
331
+ "loss": 0.37671115398406985,
332
+ "step": 460
333
+ },
334
+ {
335
+ "epoch": 0.011476290472237144,
336
+ "grad_norm": 0.07275390625,
337
+ "learning_rate": 0.00012789911060392294,
338
+ "loss": 0.3458314180374146,
339
+ "step": 470
340
+ },
341
+ {
342
+ "epoch": 0.011720466865263466,
343
+ "grad_norm": 0.091796875,
344
+ "learning_rate": 0.00012453073858788026,
345
+ "loss": 0.3307004690170288,
346
+ "step": 480
347
+ },
348
+ {
349
+ "epoch": 0.01196464325828979,
350
+ "grad_norm": 0.0791015625,
351
+ "learning_rate": 0.00012113247964553888,
352
+ "loss": 0.333436393737793,
353
+ "step": 490
354
+ },
355
+ {
356
+ "epoch": 0.012208819651316111,
357
+ "grad_norm": 0.09814453125,
358
+ "learning_rate": 0.00011770847403195834,
359
+ "loss": 0.3636301517486572,
360
+ "step": 500
361
+ },
362
+ {
363
+ "epoch": 0.012452996044342433,
364
+ "grad_norm": 0.181640625,
365
+ "learning_rate": 0.00011426289337055119,
366
+ "loss": 0.3728192329406738,
367
+ "step": 510
368
+ },
369
+ {
370
+ "epoch": 0.012697172437368755,
371
+ "grad_norm": 0.134765625,
372
+ "learning_rate": 0.0001107999355706023,
373
+ "loss": 0.3645843505859375,
374
+ "step": 520
375
+ },
376
+ {
377
+ "epoch": 0.012941348830395077,
378
+ "grad_norm": 0.1201171875,
379
+ "learning_rate": 0.00010732381971276318,
380
+ "loss": 0.3898338556289673,
381
+ "step": 530
382
+ },
383
+ {
384
+ "epoch": 0.0131855252234214,
385
+ "grad_norm": 0.09375,
386
+ "learning_rate": 0.00010383878090875201,
387
+ "loss": 0.36258883476257325,
388
+ "step": 540
389
+ },
390
+ {
391
+ "epoch": 0.013429701616447721,
392
+ "grad_norm": 0.08740234375,
393
+ "learning_rate": 0.00010034906514152238,
394
+ "loss": 0.35727477073669434,
395
+ "step": 550
396
+ },
397
+ {
398
+ "epoch": 0.013673878009474043,
399
+ "grad_norm": 0.0732421875,
400
+ "learning_rate": 9.685892409218717e-05,
401
+ "loss": 0.3593540906906128,
402
+ "step": 560
403
+ },
404
+ {
405
+ "epoch": 0.013918054402500366,
406
+ "grad_norm": 0.10595703125,
407
+ "learning_rate": 9.337260996000002e-05,
408
+ "loss": 0.3762841701507568,
409
+ "step": 570
410
+ },
411
+ {
412
+ "epoch": 0.01416223079552669,
413
+ "grad_norm": 0.08984375,
414
+ "learning_rate": 8.989437028170537e-05,
415
+ "loss": 0.336023736000061,
416
+ "step": 580
417
+ },
418
+ {
419
+ "epoch": 0.014406407188553011,
420
+ "grad_norm": 0.09814453125,
421
+ "learning_rate": 8.642844275656957e-05,
422
+ "loss": 0.33524041175842284,
423
+ "step": 590
424
+ },
425
+ {
426
+ "epoch": 0.014650583581579333,
427
+ "grad_norm": 0.09228515625,
428
+ "learning_rate": 8.297905008339677e-05,
429
+ "loss": 0.392057204246521,
430
+ "step": 600
431
+ },
432
+ {
433
+ "epoch": 0.014894759974605655,
434
+ "grad_norm": 0.111328125,
435
+ "learning_rate": 7.955039481582097e-05,
436
+ "loss": 0.3882176399230957,
437
+ "step": 610
438
+ },
439
+ {
440
+ "epoch": 0.015138936367631977,
441
+ "grad_norm": 0.06640625,
442
+ "learning_rate": 7.614665424214193e-05,
443
+ "loss": 0.38143367767333985,
444
+ "step": 620
445
+ },
446
+ {
447
+ "epoch": 0.0153831127606583,
448
+ "grad_norm": 0.0859375,
449
+ "learning_rate": 7.277197529594257e-05,
450
+ "loss": 0.352864146232605,
451
+ "step": 630
452
+ },
453
+ {
454
+ "epoch": 0.015627289153684623,
455
+ "grad_norm": 0.07666015625,
456
+ "learning_rate": 6.943046950368944e-05,
457
+ "loss": 0.35377163887023927,
458
+ "step": 640
459
+ },
460
+ {
461
+ "epoch": 0.015871465546710945,
462
+ "grad_norm": 0.076171875,
463
+ "learning_rate": 6.612620797547087e-05,
464
+ "loss": 0.36560447216033937,
465
+ "step": 650
466
+ },
467
+ {
468
+ "epoch": 0.016115641939737267,
469
+ "grad_norm": 0.1142578125,
470
+ "learning_rate": 6.286321644497655e-05,
471
+ "loss": 0.3602383375167847,
472
+ "step": 660
473
+ },
474
+ {
475
+ "epoch": 0.01635981833276359,
476
+ "grad_norm": 0.0654296875,
477
+ "learning_rate": 5.964547036476099e-05,
478
+ "loss": 0.3708587646484375,
479
+ "step": 670
480
+ },
481
+ {
482
+ "epoch": 0.01660399472578991,
483
+ "grad_norm": 0.07080078125,
484
+ "learning_rate": 5.647689006276726e-05,
485
+ "loss": 0.33884291648864745,
486
+ "step": 680
487
+ },
488
+ {
489
+ "epoch": 0.016848171118816233,
490
+ "grad_norm": 0.072265625,
491
+ "learning_rate": 5.33613359660109e-05,
492
+ "loss": 0.3408441781997681,
493
+ "step": 690
494
+ },
495
+ {
496
+ "epoch": 0.017092347511842555,
497
+ "grad_norm": 0.11572265625,
498
+ "learning_rate": 5.0302603897244474e-05,
499
+ "loss": 0.3734944581985474,
500
+ "step": 700
501
+ },
502
+ {
503
+ "epoch": 0.017336523904868877,
504
+ "grad_norm": 0.07080078125,
505
+ "learning_rate": 4.7304420450332244e-05,
506
+ "loss": 0.33618974685668945,
507
+ "step": 710
508
+ },
509
+ {
510
+ "epoch": 0.0175807002978952,
511
+ "grad_norm": 0.08349609375,
512
+ "learning_rate": 4.437043844996952e-05,
513
+ "loss": 0.3502551794052124,
514
+ "step": 720
515
+ },
516
+ {
517
+ "epoch": 0.01782487669092152,
518
+ "grad_norm": 0.076171875,
519
+ "learning_rate": 4.150423250127845e-05,
520
+ "loss": 0.3836493492126465,
521
+ "step": 730
522
+ },
523
+ {
524
+ "epoch": 0.018069053083947843,
525
+ "grad_norm": 0.1064453125,
526
+ "learning_rate": 3.8709294634702376e-05,
527
+ "loss": 0.33480191230773926,
528
+ "step": 740
529
+ },
530
+ {
531
+ "epoch": 0.018313229476974165,
532
+ "grad_norm": 0.0693359375,
533
+ "learning_rate": 3.5989030051504434e-05,
534
+ "loss": 0.3809062480926514,
535
+ "step": 750
536
+ },
537
+ {
538
+ "epoch": 0.018557405870000487,
539
+ "grad_norm": 0.1064453125,
540
+ "learning_rate": 3.334675297505476e-05,
541
+ "loss": 0.3911257266998291,
542
+ "step": 760
543
+ },
544
+ {
545
+ "epoch": 0.01880158226302681,
546
+ "grad_norm": 0.11083984375,
547
+ "learning_rate": 3.078568261295933e-05,
548
+ "loss": 0.38447113037109376,
549
+ "step": 770
550
+ },
551
+ {
552
+ "epoch": 0.01904575865605313,
553
+ "grad_norm": 0.10693359375,
554
+ "learning_rate": 2.8308939234951726e-05,
555
+ "loss": 0.3653350830078125,
556
+ "step": 780
557
+ },
558
+ {
559
+ "epoch": 0.019289935049079453,
560
+ "grad_norm": 0.078125,
561
+ "learning_rate": 2.5919540371325e-05,
562
+ "loss": 0.3945863485336304,
563
+ "step": 790
564
+ },
565
+ {
566
+ "epoch": 0.01953411144210578,
567
+ "grad_norm": 0.11376953125,
568
+ "learning_rate": 2.362039713653581e-05,
569
+ "loss": 0.39480888843536377,
570
+ "step": 800
571
+ },
572
+ {
573
+ "epoch": 0.0197782878351321,
574
+ "grad_norm": 0.0771484375,
575
+ "learning_rate": 2.1414310682459802e-05,
576
+ "loss": 0.289493727684021,
577
+ "step": 810
578
+ },
579
+ {
580
+ "epoch": 0.020022464228158423,
581
+ "grad_norm": 0.0849609375,
582
+ "learning_rate": 1.930396878561983e-05,
583
+ "loss": 0.3639736890792847,
584
+ "step": 820
585
+ },
586
+ {
587
+ "epoch": 0.020266640621184745,
588
+ "grad_norm": 0.1005859375,
589
+ "learning_rate": 1.7291942572543807e-05,
590
+ "loss": 0.36269190311431887,
591
+ "step": 830
592
+ },
593
+ {
594
+ "epoch": 0.020510817014211067,
595
+ "grad_norm": 0.10009765625,
596
+ "learning_rate": 1.538068338724361e-05,
597
+ "loss": 0.3807779312133789,
598
+ "step": 840
599
+ },
600
+ {
601
+ "epoch": 0.02075499340723739,
602
+ "grad_norm": 0.10205078125,
603
+ "learning_rate": 1.3572519804629536e-05,
604
+ "loss": 0.39589340686798097,
605
+ "step": 850
606
+ },
607
+ {
608
+ "epoch": 0.02099916980026371,
609
+ "grad_norm": 0.09521484375,
610
+ "learning_rate": 1.1869654793500784e-05,
611
+ "loss": 0.393012261390686,
612
+ "step": 860
613
+ },
614
+ {
615
+ "epoch": 0.021243346193290033,
616
+ "grad_norm": 0.07470703125,
617
+ "learning_rate": 1.0274163032567163e-05,
618
+ "loss": 0.3827983379364014,
619
+ "step": 870
620
+ },
621
+ {
622
+ "epoch": 0.021487522586316355,
623
+ "grad_norm": 0.08251953125,
624
+ "learning_rate": 8.787988382772705e-06,
625
+ "loss": 0.3293968915939331,
626
+ "step": 880
627
+ },
628
+ {
629
+ "epoch": 0.021731698979342677,
630
+ "grad_norm": 0.0693359375,
631
+ "learning_rate": 7.412941519000527e-06,
632
+ "loss": 0.3682440519332886,
633
+ "step": 890
634
+ },
635
+ {
636
+ "epoch": 0.021975875372369,
637
+ "grad_norm": 0.09228515625,
638
+ "learning_rate": 6.1506977240444074e-06,
639
+ "loss": 0.3646101474761963,
640
+ "step": 900
641
+ },
642
+ {
643
+ "epoch": 0.02222005176539532,
644
+ "grad_norm": 0.11669921875,
645
+ "learning_rate": 5.002794847534764e-06,
646
+ "loss": 0.38763275146484377,
647
+ "step": 910
648
+ },
649
+ {
650
+ "epoch": 0.022464228158421643,
651
+ "grad_norm": 0.1142578125,
652
+ "learning_rate": 3.970631432305694e-06,
653
+ "loss": 0.34759066104888914,
654
+ "step": 920
655
+ },
656
+ {
657
+ "epoch": 0.022708404551447965,
658
+ "grad_norm": 0.07177734375,
659
+ "learning_rate": 3.0554650104861136e-06,
660
+ "loss": 0.35361154079437257,
661
+ "step": 930
662
+ },
663
+ {
664
+ "epoch": 0.022952580944474287,
665
+ "grad_norm": 0.1259765625,
666
+ "learning_rate": 2.2584105713904125e-06,
667
+ "loss": 0.36288425922393797,
668
+ "step": 940
669
+ },
670
+ {
671
+ "epoch": 0.02319675733750061,
672
+ "grad_norm": 0.099609375,
673
+ "learning_rate": 1.580439203075812e-06,
674
+ "loss": 0.3696069002151489,
675
+ "step": 950
676
+ },
677
+ {
678
+ "epoch": 0.02344093373052693,
679
+ "grad_norm": 0.06982421875,
680
+ "learning_rate": 1.0223769092211012e-06,
681
+ "loss": 0.3502499103546143,
682
+ "step": 960
683
+ },
684
+ {
685
+ "epoch": 0.023685110123553253,
686
+ "grad_norm": 0.072265625,
687
+ "learning_rate": 5.849036027684606e-07,
688
+ "loss": 0.3617737293243408,
689
+ "step": 970
690
+ },
691
+ {
692
+ "epoch": 0.02392928651657958,
693
+ "grad_norm": 0.12109375,
694
+ "learning_rate": 2.685522775541904e-07,
695
+ "loss": 0.38356838226318357,
696
+ "step": 980
697
+ },
698
+ {
699
+ "epoch": 0.0241734629096059,
700
+ "grad_norm": 0.09130859375,
701
+ "learning_rate": 7.370835893788508e-08,
702
+ "loss": 0.38213505744934084,
703
+ "step": 990
704
+ },
705
+ {
706
+ "epoch": 0.024417639302632223,
707
+ "grad_norm": 0.07568359375,
708
+ "learning_rate": 6.092342209607083e-10,
709
+ "loss": 0.3387150287628174,
710
+ "step": 1000
711
+ }
712
+ ],
713
+ "logging_steps": 10,
714
+ "max_steps": 1000,
715
+ "num_input_tokens_seen": 0,
716
+ "num_train_epochs": 1,
717
+ "save_steps": 500,
718
+ "stateful_callbacks": {
719
+ "TrainerControl": {
720
+ "args": {
721
+ "should_epoch_stop": false,
722
+ "should_evaluate": false,
723
+ "should_log": false,
724
+ "should_save": true,
725
+ "should_training_stop": true
726
+ },
727
+ "attributes": {}
728
+ }
729
+ },
730
+ "total_flos": 9.089382042631987e+16,
731
+ "train_batch_size": 2,
732
+ "trial_name": null,
733
+ "trial_params": null
734
+ }
gemma4_e2b_out/checkpoint-1000/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:01c81c440c08fc4b233b9ce62ac6c2e3f9a0369823edad1a08fde166c4472b8d
3
+ size 5841
gemma4_gguf/chat_template.jinja ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{ bos_token }}{%- macro strip_thinking(text) -%}
2
+ {%- set ns = namespace(result='') -%}
3
+ {%- for part in text.split('<channel|>') -%}
4
+ {%- if '<|channel>' in part -%}
5
+ {%- set ns.result = ns.result + part.split('<|channel>')[0] -%}
6
+ {%- else -%}
7
+ {%- set ns.result = ns.result + part -%}
8
+ {%- endif -%}
9
+ {%- endfor -%}
10
+ {{- ns.result | trim -}}
11
+ {%- endmacro -%}
12
+ {%- set thinking = enable_thinking is defined and enable_thinking -%}
13
+ {%- set loop_messages = messages -%}
14
+ {%- if messages[0]['role'] in ['system', 'developer'] or thinking -%}
15
+ {{ '<|turn>system
16
+ ' }}
17
+ {%- if thinking -%}
18
+ {{ '<|think|>
19
+ ' }}
20
+ {%- endif -%}
21
+ {%- if messages[0]['role'] in ['system', 'developer'] -%}
22
+ {{ messages[0]['content'] | trim }}
23
+ {%- set loop_messages = messages[1:] -%}
24
+ {%- endif -%}
25
+ {{ '<turn|>
26
+ ' }}
27
+ {%- endif -%}
28
+ {%- for message in loop_messages -%}
29
+ {%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) -%}
30
+ {{ raise_exception("Conversation roles must alternate user/assistant/user/assistant/...") }}
31
+ {%- endif -%}
32
+ {%- if (message['role'] == 'assistant') -%}
33
+ {%- set role = "model" -%}
34
+ {%- else -%}
35
+ {%- set role = message['role'] -%}
36
+ {%- endif -%}
37
+ {{ '<|turn>' + role + '
38
+ ' }}
39
+ {%- if message['content'] is string -%}
40
+ {%- if role == "model" -%}
41
+ {{ strip_thinking(message['content']) }}
42
+ {%- else -%}
43
+ {{ message['content'] | trim }}
44
+ {%- endif -%}
45
+ {%- elif message['content'] is iterable -%}
46
+ {%- for item in message['content'] -%}
47
+ {%- if item['type'] == 'audio' -%}
48
+ {{ '<|audio|>' }}
49
+ {%- elif item['type'] == 'image' -%}
50
+ {{ '<|image|>' }}
51
+ {%- elif item['type'] == 'video' -%}
52
+ {{ '<|video|>' }}
53
+ {%- elif item['type'] == 'text' -%}
54
+ {%- if role == "model" -%}
55
+ {{ strip_thinking(item['text']) }}
56
+ {%- else -%}
57
+ {{ item['text'] | trim }}
58
+ {%- endif -%}
59
+ {%- endif -%}
60
+ {%- endfor -%}
61
+ {%- else -%}
62
+ {{ raise_exception("Invalid content type") }}
63
+ {%- endif -%}
64
+ {{ '<turn|>
65
+ ' }}
66
+ {%- endfor -%}
67
+ {%- if add_generation_prompt -%}
68
+ {{'<|turn>model
69
+ '}}
70
+ {%- endif -%}
gemma4_gguf/config.json ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Gemma4ForConditionalGeneration"
4
+ ],
5
+ "audio_config": {
6
+ "_name_or_path": "",
7
+ "architectures": null,
8
+ "attention_chunk_size": 12,
9
+ "attention_context_left": 13,
10
+ "attention_context_right": 0,
11
+ "attention_invalid_logits_value": -1000000000.0,
12
+ "attention_logit_cap": 50.0,
13
+ "chunk_size_feed_forward": 0,
14
+ "conv_kernel_size": 5,
15
+ "torch_dtype": "float16",
16
+ "gradient_clipping": 10000000000.0,
17
+ "hidden_act": "silu",
18
+ "hidden_size": 1024,
19
+ "id2label": {
20
+ "0": "LABEL_0",
21
+ "1": "LABEL_1"
22
+ },
23
+ "initializer_range": 0.02,
24
+ "is_encoder_decoder": false,
25
+ "label2id": {
26
+ "LABEL_0": 0,
27
+ "LABEL_1": 1
28
+ },
29
+ "model_type": "gemma4_audio",
30
+ "num_attention_heads": 8,
31
+ "num_hidden_layers": 12,
32
+ "output_attentions": false,
33
+ "output_hidden_states": false,
34
+ "output_proj_dims": 1536,
35
+ "problem_type": null,
36
+ "residual_weight": 0.5,
37
+ "return_dict": true,
38
+ "rms_norm_eps": 1e-06,
39
+ "subsampling_conv_channels": [
40
+ 128,
41
+ 32
42
+ ],
43
+ "use_clipped_linears": true
44
+ },
45
+ "audio_token_id": 258881,
46
+ "boa_token_id": 256000,
47
+ "boi_token_id": 255999,
48
+ "bos_token_id": 2,
49
+ "torch_dtype": "float16",
50
+ "eoa_token_id": 258883,
51
+ "eoa_token_index": 258883,
52
+ "eoi_token_id": 258882,
53
+ "eos_token_id": 1,
54
+ "image_token_id": 258880,
55
+ "initializer_range": 0.02,
56
+ "model_name": "unsloth/gemma-4-e2b-it-unsloth-bnb-4bit",
57
+ "model_type": "gemma4",
58
+ "pad_token_id": 0,
59
+ "text_config": {
60
+ "attention_bias": false,
61
+ "attention_dropout": 0.0,
62
+ "attention_k_eq_v": false,
63
+ "bos_token_id": 2,
64
+ "torch_dtype": "float16",
65
+ "enable_moe_block": false,
66
+ "eos_token_id": 1,
67
+ "expert_intermediate_size": null,
68
+ "final_logit_softcapping": 30.0,
69
+ "global_head_dim": 512,
70
+ "head_dim": 256,
71
+ "hidden_activation": "gelu_pytorch_tanh",
72
+ "hidden_size": 1536,
73
+ "hidden_size_per_layer_input": 256,
74
+ "initializer_range": 0.02,
75
+ "intermediate_size": 6144,
76
+ "layer_types": [
77
+ "sliding_attention",
78
+ "sliding_attention",
79
+ "sliding_attention",
80
+ "sliding_attention",
81
+ "full_attention",
82
+ "sliding_attention",
83
+ "sliding_attention",
84
+ "sliding_attention",
85
+ "sliding_attention",
86
+ "full_attention",
87
+ "sliding_attention",
88
+ "sliding_attention",
89
+ "sliding_attention",
90
+ "sliding_attention",
91
+ "full_attention",
92
+ "sliding_attention",
93
+ "sliding_attention",
94
+ "sliding_attention",
95
+ "sliding_attention",
96
+ "full_attention",
97
+ "sliding_attention",
98
+ "sliding_attention",
99
+ "sliding_attention",
100
+ "sliding_attention",
101
+ "full_attention",
102
+ "sliding_attention",
103
+ "sliding_attention",
104
+ "sliding_attention",
105
+ "sliding_attention",
106
+ "full_attention",
107
+ "sliding_attention",
108
+ "sliding_attention",
109
+ "sliding_attention",
110
+ "sliding_attention",
111
+ "full_attention"
112
+ ],
113
+ "max_position_embeddings": 131072,
114
+ "model_type": "gemma4_text",
115
+ "moe_intermediate_size": null,
116
+ "num_attention_heads": 8,
117
+ "num_experts": null,
118
+ "num_global_key_value_heads": null,
119
+ "num_hidden_layers": 35,
120
+ "num_key_value_heads": 1,
121
+ "num_kv_shared_layers": 20,
122
+ "pad_token_id": 0,
123
+ "rms_norm_eps": 1e-06,
124
+ "rope_parameters": {
125
+ "full_attention": {
126
+ "partial_rotary_factor": 0.25,
127
+ "rope_theta": 1000000.0,
128
+ "rope_type": "proportional"
129
+ },
130
+ "sliding_attention": {
131
+ "rope_theta": 10000.0,
132
+ "rope_type": "default"
133
+ }
134
+ },
135
+ "sliding_window": 512,
136
+ "tie_word_embeddings": true,
137
+ "top_k_experts": null,
138
+ "use_bidirectional_attention": null,
139
+ "use_cache": true,
140
+ "use_double_wide_mlp": true,
141
+ "vocab_size": 262144,
142
+ "vocab_size_per_layer_input": 262144
143
+ },
144
+ "tie_word_embeddings": true,
145
+ "unsloth_fixed": true,
146
+ "unsloth_version": "2026.6.9",
147
+ "use_cache": false,
148
+ "video_token_id": 258884,
149
+ "vision_config": {
150
+ "_name_or_path": "",
151
+ "architectures": null,
152
+ "attention_bias": false,
153
+ "attention_dropout": 0.0,
154
+ "chunk_size_feed_forward": 0,
155
+ "default_output_length": 280,
156
+ "torch_dtype": "float16",
157
+ "global_head_dim": 64,
158
+ "head_dim": 64,
159
+ "hidden_activation": "gelu_pytorch_tanh",
160
+ "hidden_size": 768,
161
+ "id2label": {
162
+ "0": "LABEL_0",
163
+ "1": "LABEL_1"
164
+ },
165
+ "initializer_range": 0.02,
166
+ "intermediate_size": 3072,
167
+ "is_encoder_decoder": false,
168
+ "label2id": {
169
+ "LABEL_0": 0,
170
+ "LABEL_1": 1
171
+ },
172
+ "max_position_embeddings": 131072,
173
+ "model_type": "gemma4_vision",
174
+ "num_attention_heads": 12,
175
+ "num_hidden_layers": 16,
176
+ "num_key_value_heads": 12,
177
+ "output_attentions": false,
178
+ "output_hidden_states": false,
179
+ "patch_size": 16,
180
+ "pooling_kernel_size": 3,
181
+ "position_embedding_size": 10240,
182
+ "problem_type": null,
183
+ "return_dict": true,
184
+ "rms_norm_eps": 1e-06,
185
+ "rope_parameters": {
186
+ "rope_theta": 100.0,
187
+ "rope_type": "default"
188
+ },
189
+ "standardize": false,
190
+ "use_clipped_linears": true
191
+ },
192
+ "vision_soft_tokens_per_image": 280
193
+ }
gemma4_gguf/generation_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 2,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 1,
6
+ 106,
7
+ 50
8
+ ],
9
+ "pad_token_id": 0,
10
+ "temperature": 1.0,
11
+ "top_k": 64,
12
+ "top_p": 0.95,
13
+ "transformers_version": "5.5.0"
14
+ }
gemma4_gguf/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:440203cafd5bac689bae28d22382b2bc67d5a39849b590cd88e862c191185d5c
3
+ size 10246621918
gemma4_gguf/temp_split_0de139d7_000.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ebcea1985a201703cd702b4bb5e3cfc4efddaa4e2b4c58fce3703baa456a11e
3
+ size 1422130776
gemma4_gguf/temp_split_0de139d7_001.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2ea02bad44856b48a53786446e9d32217ea9c377b26d16032919b8785c2b87be
3
+ size 4697620648
gemma4_gguf/temp_split_0de139d7_002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:85cebd4f098a5d61a725613814958869c645b022e6a7c083e69404732cd541b4
3
+ size 1585731424
gemma4_gguf/temp_split_0de139d7_003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e169e6e4b22e2ab8787a697a0cb82391d5cd15dccdc183ee0053976a4bbf2375
3
+ size 1446899712
gemma4_gguf/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cc8d3a0ce36466ccc1278bf987df5f71db1719b9ca6b4118264f45cb627bfe0f
3
+ size 32169626
gemma4_gguf/tokenizer_config.json ADDED
@@ -0,0 +1,290 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "audio_token": "<|audio|>",
3
+ "backend": "tokenizers",
4
+ "boa_token": "<|audio>",
5
+ "boi_token": "<|image>",
6
+ "bos_token": "<bos>",
7
+ "eoa_token": "<audio|>",
8
+ "eoc_token": "<channel|>",
9
+ "eoi_token": "<image|>",
10
+ "eos_token": "<eos>",
11
+ "eot_token": "<turn|>",
12
+ "escape_token": "<|\"|>",
13
+ "etc_token": "<tool_call|>",
14
+ "etd_token": "<tool|>",
15
+ "etr_token": "<tool_response|>",
16
+ "extra_special_tokens": [
17
+ "<|video|>"
18
+ ],
19
+ "image_token": "<|image|>",
20
+ "is_local": false,
21
+ "mask_token": "<mask>",
22
+ "model_max_length": 131072,
23
+ "model_specific_special_tokens": {
24
+ "audio_token": "<|audio|>",
25
+ "boa_token": "<|audio>",
26
+ "boi_token": "<|image>",
27
+ "eoa_token": "<audio|>",
28
+ "eoc_token": "<channel|>",
29
+ "eoi_token": "<image|>",
30
+ "eot_token": "<turn|>",
31
+ "escape_token": "<|\"|>",
32
+ "etc_token": "<tool_call|>",
33
+ "etd_token": "<tool|>",
34
+ "etr_token": "<tool_response|>",
35
+ "image_token": "<|image|>",
36
+ "soc_token": "<|channel>",
37
+ "sot_token": "<|turn>",
38
+ "stc_token": "<|tool_call>",
39
+ "std_token": "<|tool>",
40
+ "str_token": "<|tool_response>",
41
+ "think_token": "<|think|>"
42
+ },
43
+ "pad_token": "<pad>",
44
+ "padding_side": "right",
45
+ "processor_class": "Gemma4Processor",
46
+ "response_schema": {
47
+ "properties": {
48
+ "content": {
49
+ "type": "string"
50
+ },
51
+ "role": {
52
+ "const": "assistant"
53
+ },
54
+ "thinking": {
55
+ "type": "string"
56
+ },
57
+ "tool_calls": {
58
+ "items": {
59
+ "properties": {
60
+ "function": {
61
+ "properties": {
62
+ "arguments": {
63
+ "additionalProperties": {},
64
+ "type": "object",
65
+ "x-parser": "gemma4-tool-call"
66
+ },
67
+ "name": {
68
+ "type": "string"
69
+ }
70
+ },
71
+ "type": "object",
72
+ "x-regex": "call\\:(?P<name>\\w+)(?P<arguments>\\{.*\\})"
73
+ },
74
+ "type": {
75
+ "const": "function"
76
+ }
77
+ },
78
+ "type": "object"
79
+ },
80
+ "type": "array",
81
+ "x-regex-iterator": "<\\|tool_call>(.*?)<tool_call\\|>"
82
+ }
83
+ },
84
+ "type": "object",
85
+ "x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?P<content>(?:(?!\\<turn\\|\\>)(?!\\<\\|tool_response\\>).)+)?(?:\\<turn\\|\\>|\\<\\|tool_response\\>)?"
86
+ },
87
+ "soc_token": "<|channel>",
88
+ "sot_token": "<|turn>",
89
+ "stc_token": "<|tool_call>",
90
+ "std_token": "<|tool>",
91
+ "str_token": "<|tool_response>",
92
+ "think_token": "<|think|>",
93
+ "tokenizer_class": "GemmaTokenizer",
94
+ "unk_token": "<unk>",
95
+ "added_tokens_decoder": {
96
+ "0": {
97
+ "content": "<pad>",
98
+ "single_word": false,
99
+ "lstrip": false,
100
+ "rstrip": false,
101
+ "normalized": false,
102
+ "special": true
103
+ },
104
+ "1": {
105
+ "content": "<eos>",
106
+ "single_word": false,
107
+ "lstrip": false,
108
+ "rstrip": false,
109
+ "normalized": false,
110
+ "special": true
111
+ },
112
+ "2": {
113
+ "content": "<bos>",
114
+ "single_word": false,
115
+ "lstrip": false,
116
+ "rstrip": false,
117
+ "normalized": false,
118
+ "special": true
119
+ },
120
+ "3": {
121
+ "content": "<unk>",
122
+ "single_word": false,
123
+ "lstrip": false,
124
+ "rstrip": false,
125
+ "normalized": false,
126
+ "special": true
127
+ },
128
+ "4": {
129
+ "content": "<mask>",
130
+ "single_word": false,
131
+ "lstrip": false,
132
+ "rstrip": false,
133
+ "normalized": false,
134
+ "special": true
135
+ },
136
+ "46": {
137
+ "content": "<|tool>",
138
+ "single_word": false,
139
+ "lstrip": false,
140
+ "rstrip": false,
141
+ "normalized": false,
142
+ "special": true
143
+ },
144
+ "47": {
145
+ "content": "<tool|>",
146
+ "single_word": false,
147
+ "lstrip": false,
148
+ "rstrip": false,
149
+ "normalized": false,
150
+ "special": true
151
+ },
152
+ "48": {
153
+ "content": "<|tool_call>",
154
+ "single_word": false,
155
+ "lstrip": false,
156
+ "rstrip": false,
157
+ "normalized": false,
158
+ "special": true
159
+ },
160
+ "49": {
161
+ "content": "<tool_call|>",
162
+ "single_word": false,
163
+ "lstrip": false,
164
+ "rstrip": false,
165
+ "normalized": false,
166
+ "special": true
167
+ },
168
+ "50": {
169
+ "content": "<|tool_response>",
170
+ "single_word": false,
171
+ "lstrip": false,
172
+ "rstrip": false,
173
+ "normalized": false,
174
+ "special": true
175
+ },
176
+ "51": {
177
+ "content": "<tool_response|>",
178
+ "single_word": false,
179
+ "lstrip": false,
180
+ "rstrip": false,
181
+ "normalized": false,
182
+ "special": true
183
+ },
184
+ "52": {
185
+ "content": "<|\"|>",
186
+ "single_word": false,
187
+ "lstrip": false,
188
+ "rstrip": false,
189
+ "normalized": false,
190
+ "special": true
191
+ },
192
+ "98": {
193
+ "content": "<|think|>",
194
+ "single_word": false,
195
+ "lstrip": false,
196
+ "rstrip": false,
197
+ "normalized": false,
198
+ "special": true
199
+ },
200
+ "100": {
201
+ "content": "<|channel>",
202
+ "single_word": false,
203
+ "lstrip": false,
204
+ "rstrip": false,
205
+ "normalized": false,
206
+ "special": true
207
+ },
208
+ "101": {
209
+ "content": "<channel|>",
210
+ "single_word": false,
211
+ "lstrip": false,
212
+ "rstrip": false,
213
+ "normalized": false,
214
+ "special": true
215
+ },
216
+ "105": {
217
+ "content": "<|turn>",
218
+ "single_word": false,
219
+ "lstrip": false,
220
+ "rstrip": false,
221
+ "normalized": false,
222
+ "special": true
223
+ },
224
+ "106": {
225
+ "content": "<turn|>",
226
+ "single_word": false,
227
+ "lstrip": false,
228
+ "rstrip": false,
229
+ "normalized": false,
230
+ "special": true
231
+ },
232
+ "255999": {
233
+ "content": "<|image>",
234
+ "single_word": false,
235
+ "lstrip": false,
236
+ "rstrip": false,
237
+ "normalized": false,
238
+ "special": true
239
+ },
240
+ "256000": {
241
+ "content": "<|audio>",
242
+ "single_word": false,
243
+ "lstrip": false,
244
+ "rstrip": false,
245
+ "normalized": false,
246
+ "special": true
247
+ },
248
+ "258880": {
249
+ "content": "<|image|>",
250
+ "single_word": false,
251
+ "lstrip": false,
252
+ "rstrip": false,
253
+ "normalized": false,
254
+ "special": true
255
+ },
256
+ "258881": {
257
+ "content": "<|audio|>",
258
+ "single_word": false,
259
+ "lstrip": false,
260
+ "rstrip": false,
261
+ "normalized": false,
262
+ "special": true
263
+ },
264
+ "258882": {
265
+ "content": "<image|>",
266
+ "single_word": false,
267
+ "lstrip": false,
268
+ "rstrip": false,
269
+ "normalized": false,
270
+ "special": true
271
+ },
272
+ "258883": {
273
+ "content": "<audio|>",
274
+ "single_word": false,
275
+ "lstrip": false,
276
+ "rstrip": false,
277
+ "normalized": false,
278
+ "special": true
279
+ },
280
+ "258884": {
281
+ "content": "<|video|>",
282
+ "single_word": false,
283
+ "lstrip": false,
284
+ "rstrip": false,
285
+ "normalized": false,
286
+ "special": true
287
+ }
288
+ },
289
+ "chat_template": "{{ bos_token }}{%- macro strip_thinking(text) -%}\n {%- set ns = namespace(result='') -%}\n {%- for part in text.split('<channel|>') -%}\n {%- if '<|channel>' in part -%}\n {%- set ns.result = ns.result + part.split('<|channel>')[0] -%}\n {%- else -%}\n {%- set ns.result = ns.result + part -%}\n {%- endif -%}\n {%- endfor -%}\n {{- ns.result | trim -}}\n{%- endmacro -%}\n{%- set thinking = enable_thinking is defined and enable_thinking -%}\n{%- set loop_messages = messages -%}\n{%- if messages[0]['role'] in ['system', 'developer'] or thinking -%}\n {{ '<|turn>system\n' }}\n {%- if thinking -%}\n {{ '<|think|>\n' }}\n {%- endif -%}\n {%- if messages[0]['role'] in ['system', 'developer'] -%}\n {{ messages[0]['content'] | trim }}\n {%- set loop_messages = messages[1:] -%}\n {%- endif -%}\n {{ '<turn|>\n' }}\n{%- endif -%}\n{%- for message in loop_messages -%}\n {%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) -%}\n {{ raise_exception(\"Conversation roles must alternate user/assistant/user/assistant/...\") }}\n {%- endif -%}\n {%- if (message['role'] == 'assistant') -%}\n {%- set role = \"model\" -%}\n {%- else -%}\n {%- set role = message['role'] -%}\n {%- endif -%}\n {{ '<|turn>' + role + '\n' }}\n {%- if message['content'] is string -%}\n {%- if role == \"model\" -%}\n {{ strip_thinking(message['content']) }}\n {%- else -%}\n {{ message['content'] | trim }}\n {%- endif -%}\n {%- elif message['content'] is iterable -%}\n {%- for item in message['content'] -%}\n {%- if item['type'] == 'audio' -%}\n {{ '<|audio|>' }}\n {%- elif item['type'] == 'image' -%}\n {{ '<|image|>' }}\n {%- elif item['type'] == 'video' -%}\n {{ '<|video|>' }}\n {%- elif item['type'] == 'text' -%}\n {%- if role == \"model\" -%}\n {{ strip_thinking(item['text']) }}\n {%- else -%}\n {{ item['text'] | trim }}\n {%- endif -%}\n {%- endif -%}\n {%- endfor -%}\n {%- else -%}\n {{ raise_exception(\"Invalid content type\") }}\n {%- endif -%}\n {{ '<turn|>\n' }}\n{%- endfor -%}\n{%- if add_generation_prompt -%}\n {{'<|turn>model\n'}}\n{%- endif -%}\n"
290
+ }
lora_weights_final/README.md ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: unsloth/gemma-4-e2b-it-unsloth-bnb-4bit
3
+ library_name: peft
4
+ pipeline_tag: text-generation
5
+ tags:
6
+ - base_model:adapter:unsloth/gemma-4-e2b-it-unsloth-bnb-4bit
7
+ - lora
8
+ - sft
9
+ - transformers
10
+ - trl
11
+ - unsloth
12
+ ---
13
+
14
+ # Model Card for Model ID
15
+
16
+ <!-- Provide a quick summary of what the model is/does. -->
17
+
18
+
19
+
20
+ ## Model Details
21
+
22
+ ### Model Description
23
+
24
+ <!-- Provide a longer summary of what this model is. -->
25
+
26
+
27
+
28
+ - **Developed by:** [More Information Needed]
29
+ - **Funded by [optional]:** [More Information Needed]
30
+ - **Shared by [optional]:** [More Information Needed]
31
+ - **Model type:** [More Information Needed]
32
+ - **Language(s) (NLP):** [More Information Needed]
33
+ - **License:** [More Information Needed]
34
+ - **Finetuned from model [optional]:** [More Information Needed]
35
+
36
+ ### Model Sources [optional]
37
+
38
+ <!-- Provide the basic links for the model. -->
39
+
40
+ - **Repository:** [More Information Needed]
41
+ - **Paper [optional]:** [More Information Needed]
42
+ - **Demo [optional]:** [More Information Needed]
43
+
44
+ ## Uses
45
+
46
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
47
+
48
+ ### Direct Use
49
+
50
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
51
+
52
+ [More Information Needed]
53
+
54
+ ### Downstream Use [optional]
55
+
56
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
57
+
58
+ [More Information Needed]
59
+
60
+ ### Out-of-Scope Use
61
+
62
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
63
+
64
+ [More Information Needed]
65
+
66
+ ## Bias, Risks, and Limitations
67
+
68
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
69
+
70
+ [More Information Needed]
71
+
72
+ ### Recommendations
73
+
74
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
75
+
76
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
77
+
78
+ ## How to Get Started with the Model
79
+
80
+ Use the code below to get started with the model.
81
+
82
+ [More Information Needed]
83
+
84
+ ## Training Details
85
+
86
+ ### Training Data
87
+
88
+ <!-- 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. -->
89
+
90
+ [More Information Needed]
91
+
92
+ ### Training Procedure
93
+
94
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
95
+
96
+ #### Preprocessing [optional]
97
+
98
+ [More Information Needed]
99
+
100
+
101
+ #### Training Hyperparameters
102
+
103
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
104
+
105
+ #### Speeds, Sizes, Times [optional]
106
+
107
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
108
+
109
+ [More Information Needed]
110
+
111
+ ## Evaluation
112
+
113
+ <!-- This section describes the evaluation protocols and provides the results. -->
114
+
115
+ ### Testing Data, Factors & Metrics
116
+
117
+ #### Testing Data
118
+
119
+ <!-- This should link to a Dataset Card if possible. -->
120
+
121
+ [More Information Needed]
122
+
123
+ #### Factors
124
+
125
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
126
+
127
+ [More Information Needed]
128
+
129
+ #### Metrics
130
+
131
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
132
+
133
+ [More Information Needed]
134
+
135
+ ### Results
136
+
137
+ [More Information Needed]
138
+
139
+ #### Summary
140
+
141
+
142
+
143
+ ## Model Examination [optional]
144
+
145
+ <!-- Relevant interpretability work for the model goes here -->
146
+
147
+ [More Information Needed]
148
+
149
+ ## Environmental Impact
150
+
151
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
152
+
153
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
154
+
155
+ - **Hardware Type:** [More Information Needed]
156
+ - **Hours used:** [More Information Needed]
157
+ - **Cloud Provider:** [More Information Needed]
158
+ - **Compute Region:** [More Information Needed]
159
+ - **Carbon Emitted:** [More Information Needed]
160
+
161
+ ## Technical Specifications [optional]
162
+
163
+ ### Model Architecture and Objective
164
+
165
+ [More Information Needed]
166
+
167
+ ### Compute Infrastructure
168
+
169
+ [More Information Needed]
170
+
171
+ #### Hardware
172
+
173
+ [More Information Needed]
174
+
175
+ #### Software
176
+
177
+ [More Information Needed]
178
+
179
+ ## Citation [optional]
180
+
181
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
182
+
183
+ **BibTeX:**
184
+
185
+ [More Information Needed]
186
+
187
+ **APA:**
188
+
189
+ [More Information Needed]
190
+
191
+ ## Glossary [optional]
192
+
193
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
194
+
195
+ [More Information Needed]
196
+
197
+ ## More Information [optional]
198
+
199
+ [More Information Needed]
200
+
201
+ ## Model Card Authors [optional]
202
+
203
+ [More Information Needed]
204
+
205
+ ## Model Card Contact
206
+
207
+ [More Information Needed]
208
+ ### Framework versions
209
+
210
+ - PEFT 0.19.1
lora_weights_final/adapter_config.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": {
6
+ "base_model_class": "Gemma4ForConditionalGeneration",
7
+ "parent_library": "transformers.models.gemma4.modeling_gemma4",
8
+ "unsloth_fixed": true
9
+ },
10
+ "base_model_name_or_path": "unsloth/gemma-4-e2b-it-unsloth-bnb-4bit",
11
+ "bias": "none",
12
+ "corda_config": null,
13
+ "ensure_weight_tying": false,
14
+ "eva_config": null,
15
+ "exclude_modules": null,
16
+ "fan_in_fan_out": false,
17
+ "inference_mode": true,
18
+ "init_lora_weights": true,
19
+ "layer_replication": null,
20
+ "layers_pattern": null,
21
+ "layers_to_transform": null,
22
+ "loftq_config": {},
23
+ "lora_alpha": 32,
24
+ "lora_bias": false,
25
+ "lora_dropout": 0,
26
+ "lora_ga_config": null,
27
+ "megatron_config": null,
28
+ "megatron_core": "megatron.core",
29
+ "modules_to_save": null,
30
+ "peft_type": "LORA",
31
+ "peft_version": "0.19.1",
32
+ "qalora_group_size": 16,
33
+ "r": 32,
34
+ "rank_pattern": {},
35
+ "revision": null,
36
+ "target_modules": "(?:.*?(?:language|text).*?(?:self_attn|attention|attn|mixer|mlp|feed_forward|ffn|dense|mixer).*?(?:q_proj|k_proj|v_proj|o_proj|gate_proj|up_proj|down_proj))|(?:\\bmodel\\.layers\\.[\\d]{1,}\\.(?:self_attn|attention|attn|mixer|mlp|feed_forward|ffn|dense|mixer)\\.(?:(?:q_proj|k_proj|v_proj|o_proj|gate_proj|up_proj|down_proj)))",
37
+ "target_parameters": null,
38
+ "task_type": "CAUSAL_LM",
39
+ "trainable_token_indices": null,
40
+ "use_bdlora": null,
41
+ "use_dora": false,
42
+ "use_qalora": false,
43
+ "use_rslora": false
44
+ }
lora_weights_final/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f14e7d5c4c6cfe03e5f99ffea455059061c7edc6b443e909b0c236b0bc8913cb
3
+ size 101424416
lora_weights_final/chat_template.jinja ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{ bos_token }}{%- macro strip_thinking(text) -%}
2
+ {%- set ns = namespace(result='') -%}
3
+ {%- for part in text.split('<channel|>') -%}
4
+ {%- if '<|channel>' in part -%}
5
+ {%- set ns.result = ns.result + part.split('<|channel>')[0] -%}
6
+ {%- else -%}
7
+ {%- set ns.result = ns.result + part -%}
8
+ {%- endif -%}
9
+ {%- endfor -%}
10
+ {{- ns.result | trim -}}
11
+ {%- endmacro -%}
12
+ {%- set thinking = enable_thinking is defined and enable_thinking -%}
13
+ {%- set loop_messages = messages -%}
14
+ {%- if messages[0]['role'] in ['system', 'developer'] or thinking -%}
15
+ {{ '<|turn>system
16
+ ' }}
17
+ {%- if thinking -%}
18
+ {{ '<|think|>
19
+ ' }}
20
+ {%- endif -%}
21
+ {%- if messages[0]['role'] in ['system', 'developer'] -%}
22
+ {{ messages[0]['content'] | trim }}
23
+ {%- set loop_messages = messages[1:] -%}
24
+ {%- endif -%}
25
+ {{ '<turn|>
26
+ ' }}
27
+ {%- endif -%}
28
+ {%- for message in loop_messages -%}
29
+ {%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) -%}
30
+ {{ raise_exception("Conversation roles must alternate user/assistant/user/assistant/...") }}
31
+ {%- endif -%}
32
+ {%- if (message['role'] == 'assistant') -%}
33
+ {%- set role = "model" -%}
34
+ {%- else -%}
35
+ {%- set role = message['role'] -%}
36
+ {%- endif -%}
37
+ {{ '<|turn>' + role + '
38
+ ' }}
39
+ {%- if message['content'] is string -%}
40
+ {%- if role == "model" -%}
41
+ {{ strip_thinking(message['content']) }}
42
+ {%- else -%}
43
+ {{ message['content'] | trim }}
44
+ {%- endif -%}
45
+ {%- elif message['content'] is iterable -%}
46
+ {%- for item in message['content'] -%}
47
+ {%- if item['type'] == 'audio' -%}
48
+ {{ '<|audio|>' }}
49
+ {%- elif item['type'] == 'image' -%}
50
+ {{ '<|image|>' }}
51
+ {%- elif item['type'] == 'video' -%}
52
+ {{ '<|video|>' }}
53
+ {%- elif item['type'] == 'text' -%}
54
+ {%- if role == "model" -%}
55
+ {{ strip_thinking(item['text']) }}
56
+ {%- else -%}
57
+ {{ item['text'] | trim }}
58
+ {%- endif -%}
59
+ {%- endif -%}
60
+ {%- endfor -%}
61
+ {%- else -%}
62
+ {{ raise_exception("Invalid content type") }}
63
+ {%- endif -%}
64
+ {{ '<turn|>
65
+ ' }}
66
+ {%- endfor -%}
67
+ {%- if add_generation_prompt -%}
68
+ {{'<|turn>model
69
+ '}}
70
+ {%- endif -%}
lora_weights_final/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cc8d3a0ce36466ccc1278bf987df5f71db1719b9ca6b4118264f45cb627bfe0f
3
+ size 32169626
lora_weights_final/tokenizer_config.json ADDED
@@ -0,0 +1,289 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "audio_token": "<|audio|>",
3
+ "backend": "tokenizers",
4
+ "boa_token": "<|audio>",
5
+ "boi_token": "<|image>",
6
+ "bos_token": "<bos>",
7
+ "eoa_token": "<audio|>",
8
+ "eoc_token": "<channel|>",
9
+ "eoi_token": "<image|>",
10
+ "eos_token": "<eos>",
11
+ "eot_token": "<turn|>",
12
+ "escape_token": "<|\"|>",
13
+ "etc_token": "<tool_call|>",
14
+ "etd_token": "<tool|>",
15
+ "etr_token": "<tool_response|>",
16
+ "extra_special_tokens": [
17
+ "<|video|>"
18
+ ],
19
+ "image_token": "<|image|>",
20
+ "is_local": false,
21
+ "mask_token": "<mask>",
22
+ "model_max_length": 131072,
23
+ "model_specific_special_tokens": {
24
+ "audio_token": "<|audio|>",
25
+ "boa_token": "<|audio>",
26
+ "boi_token": "<|image>",
27
+ "eoa_token": "<audio|>",
28
+ "eoc_token": "<channel|>",
29
+ "eoi_token": "<image|>",
30
+ "eot_token": "<turn|>",
31
+ "escape_token": "<|\"|>",
32
+ "etc_token": "<tool_call|>",
33
+ "etd_token": "<tool|>",
34
+ "etr_token": "<tool_response|>",
35
+ "image_token": "<|image|>",
36
+ "soc_token": "<|channel>",
37
+ "sot_token": "<|turn>",
38
+ "stc_token": "<|tool_call>",
39
+ "std_token": "<|tool>",
40
+ "str_token": "<|tool_response>",
41
+ "think_token": "<|think|>"
42
+ },
43
+ "pad_token": "<pad>",
44
+ "padding_side": "right",
45
+ "processor_class": "Gemma4Processor",
46
+ "response_schema": {
47
+ "properties": {
48
+ "content": {
49
+ "type": "string"
50
+ },
51
+ "role": {
52
+ "const": "assistant"
53
+ },
54
+ "thinking": {
55
+ "type": "string"
56
+ },
57
+ "tool_calls": {
58
+ "items": {
59
+ "properties": {
60
+ "function": {
61
+ "properties": {
62
+ "arguments": {
63
+ "additionalProperties": {},
64
+ "type": "object",
65
+ "x-parser": "gemma4-tool-call"
66
+ },
67
+ "name": {
68
+ "type": "string"
69
+ }
70
+ },
71
+ "type": "object",
72
+ "x-regex": "call\\:(?P<name>\\w+)(?P<arguments>\\{.*\\})"
73
+ },
74
+ "type": {
75
+ "const": "function"
76
+ }
77
+ },
78
+ "type": "object"
79
+ },
80
+ "type": "array",
81
+ "x-regex-iterator": "<\\|tool_call>(.*?)<tool_call\\|>"
82
+ }
83
+ },
84
+ "type": "object",
85
+ "x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?P<content>(?:(?!\\<turn\\|\\>)(?!\\<\\|tool_response\\>).)+)?(?:\\<turn\\|\\>|\\<\\|tool_response\\>)?"
86
+ },
87
+ "soc_token": "<|channel>",
88
+ "sot_token": "<|turn>",
89
+ "stc_token": "<|tool_call>",
90
+ "std_token": "<|tool>",
91
+ "str_token": "<|tool_response>",
92
+ "think_token": "<|think|>",
93
+ "tokenizer_class": "GemmaTokenizer",
94
+ "unk_token": "<unk>",
95
+ "added_tokens_decoder": {
96
+ "0": {
97
+ "content": "<pad>",
98
+ "single_word": false,
99
+ "lstrip": false,
100
+ "rstrip": false,
101
+ "normalized": false,
102
+ "special": true
103
+ },
104
+ "1": {
105
+ "content": "<eos>",
106
+ "single_word": false,
107
+ "lstrip": false,
108
+ "rstrip": false,
109
+ "normalized": false,
110
+ "special": true
111
+ },
112
+ "2": {
113
+ "content": "<bos>",
114
+ "single_word": false,
115
+ "lstrip": false,
116
+ "rstrip": false,
117
+ "normalized": false,
118
+ "special": true
119
+ },
120
+ "3": {
121
+ "content": "<unk>",
122
+ "single_word": false,
123
+ "lstrip": false,
124
+ "rstrip": false,
125
+ "normalized": false,
126
+ "special": true
127
+ },
128
+ "4": {
129
+ "content": "<mask>",
130
+ "single_word": false,
131
+ "lstrip": false,
132
+ "rstrip": false,
133
+ "normalized": false,
134
+ "special": true
135
+ },
136
+ "46": {
137
+ "content": "<|tool>",
138
+ "single_word": false,
139
+ "lstrip": false,
140
+ "rstrip": false,
141
+ "normalized": false,
142
+ "special": true
143
+ },
144
+ "47": {
145
+ "content": "<tool|>",
146
+ "single_word": false,
147
+ "lstrip": false,
148
+ "rstrip": false,
149
+ "normalized": false,
150
+ "special": true
151
+ },
152
+ "48": {
153
+ "content": "<|tool_call>",
154
+ "single_word": false,
155
+ "lstrip": false,
156
+ "rstrip": false,
157
+ "normalized": false,
158
+ "special": true
159
+ },
160
+ "49": {
161
+ "content": "<tool_call|>",
162
+ "single_word": false,
163
+ "lstrip": false,
164
+ "rstrip": false,
165
+ "normalized": false,
166
+ "special": true
167
+ },
168
+ "50": {
169
+ "content": "<|tool_response>",
170
+ "single_word": false,
171
+ "lstrip": false,
172
+ "rstrip": false,
173
+ "normalized": false,
174
+ "special": true
175
+ },
176
+ "51": {
177
+ "content": "<tool_response|>",
178
+ "single_word": false,
179
+ "lstrip": false,
180
+ "rstrip": false,
181
+ "normalized": false,
182
+ "special": true
183
+ },
184
+ "52": {
185
+ "content": "<|\"|>",
186
+ "single_word": false,
187
+ "lstrip": false,
188
+ "rstrip": false,
189
+ "normalized": false,
190
+ "special": true
191
+ },
192
+ "98": {
193
+ "content": "<|think|>",
194
+ "single_word": false,
195
+ "lstrip": false,
196
+ "rstrip": false,
197
+ "normalized": false,
198
+ "special": true
199
+ },
200
+ "100": {
201
+ "content": "<|channel>",
202
+ "single_word": false,
203
+ "lstrip": false,
204
+ "rstrip": false,
205
+ "normalized": false,
206
+ "special": true
207
+ },
208
+ "101": {
209
+ "content": "<channel|>",
210
+ "single_word": false,
211
+ "lstrip": false,
212
+ "rstrip": false,
213
+ "normalized": false,
214
+ "special": true
215
+ },
216
+ "105": {
217
+ "content": "<|turn>",
218
+ "single_word": false,
219
+ "lstrip": false,
220
+ "rstrip": false,
221
+ "normalized": false,
222
+ "special": true
223
+ },
224
+ "106": {
225
+ "content": "<turn|>",
226
+ "single_word": false,
227
+ "lstrip": false,
228
+ "rstrip": false,
229
+ "normalized": false,
230
+ "special": true
231
+ },
232
+ "255999": {
233
+ "content": "<|image>",
234
+ "single_word": false,
235
+ "lstrip": false,
236
+ "rstrip": false,
237
+ "normalized": false,
238
+ "special": true
239
+ },
240
+ "256000": {
241
+ "content": "<|audio>",
242
+ "single_word": false,
243
+ "lstrip": false,
244
+ "rstrip": false,
245
+ "normalized": false,
246
+ "special": true
247
+ },
248
+ "258880": {
249
+ "content": "<|image|>",
250
+ "single_word": false,
251
+ "lstrip": false,
252
+ "rstrip": false,
253
+ "normalized": false,
254
+ "special": true
255
+ },
256
+ "258881": {
257
+ "content": "<|audio|>",
258
+ "single_word": false,
259
+ "lstrip": false,
260
+ "rstrip": false,
261
+ "normalized": false,
262
+ "special": true
263
+ },
264
+ "258882": {
265
+ "content": "<image|>",
266
+ "single_word": false,
267
+ "lstrip": false,
268
+ "rstrip": false,
269
+ "normalized": false,
270
+ "special": true
271
+ },
272
+ "258883": {
273
+ "content": "<audio|>",
274
+ "single_word": false,
275
+ "lstrip": false,
276
+ "rstrip": false,
277
+ "normalized": false,
278
+ "special": true
279
+ },
280
+ "258884": {
281
+ "content": "<|video|>",
282
+ "single_word": false,
283
+ "lstrip": false,
284
+ "rstrip": false,
285
+ "normalized": false,
286
+ "special": true
287
+ }
288
+ }
289
+ }
unsloth_compiled_cache/AqlmLoraLinear_peft_forward.py ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ 2026.6.7
3
+ 2026.6.9
4
+ 5.5.0
5
+ 1.7.0
6
+ __UNSLOTH_VERSIONING__
7
+ """
8
+
9
+ # Unsloth auto generated code
10
+ # Copyright 2023-present Daniel Han-Chen, Michael Han-Chen & the Unsloth team. All rights reserved.
11
+ #
12
+ # This program is free software: you can redistribute it and/or modify
13
+ # it under the terms of the GNU Lesser General Public License as published by
14
+ # the Free Software Foundation, either version 3 of the License, or
15
+ # (at your option) any later version.
16
+ #
17
+ # This program is distributed in the hope that it will be useful,
18
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ # GNU General Public License for more details.
21
+ #
22
+ # You should have received a copy of the GNU Lesser General Public License
23
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
24
+
25
+
26
+ torch_compile_options = {'epilogue_fusion': True, 'max_autotune': False, 'shape_padding': True, 'trace.enabled': False, 'triton.cudagraphs': False, 'debug': False, 'dce': True, 'memory_planning': True, 'coordinate_descent_tuning': False, 'trace.graph_diagram': False, 'compile_threads': 4, 'group_fusion': True, 'disable_progress': True, 'verbose_progress': False, 'triton.multi_kernel': 0, 'triton.use_block_ptr': False, 'triton.enable_persistent_tma_matmul': True, 'triton.autotune_at_compile_time': False, 'triton.cooperative_reductions': False, 'cuda.compile_opt_level': '-O2', 'cuda.enable_cuda_lto': True, 'combo_kernels': False, 'benchmark_combo_kernel': True, 'combo_kernel_foreach_dynamic_shapes': True}
27
+ from torch import Tensor
28
+ import torch
29
+ import torch.nn as nn
30
+ from torch.nn import functional as F
31
+ from unsloth_zoo.temporary_patches.common import torch_compile
32
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
33
+ from peft.tuners.lora.aqlm import (torch)
34
+
35
+
36
+ torch_addmm = torch.addmm
37
+ torch_add = torch.add
38
+ # @torch.compile(fullgraph = False, dynamic = True, options = torch_compile_options)
39
+ def lora_forward(result, lora_A, lora_B, dropout, x, scaling):
40
+ # Use result.dtype (bfloat16 from base layer) since x may have been cast to float32
41
+ # by _cast_input_dtype when autocast is disabled
42
+ target_dtype = result.dtype
43
+ xA = dropout(x).to(target_dtype) @ lora_A.weight.to(target_dtype).t()
44
+ # output = result + scaling * xA @ lora_B.weight.t()
45
+ shape = result.shape
46
+ output = torch_addmm(
47
+ result.view(-1, shape[-1]),
48
+ xA.view(-1, xA.shape[-1]),
49
+ lora_B.weight.to(target_dtype).t(),
50
+ alpha = scaling,
51
+ beta = 1,
52
+ ).view(shape)
53
+
54
+ bias = lora_B.bias
55
+ if bias is not None:
56
+ output = torch_add(
57
+ output,
58
+ bias.to(target_dtype),
59
+ alpha = scaling,
60
+ )
61
+ return output
62
+ pass
63
+
64
+ def unsloth_forward(self, x: torch.Tensor):
65
+ # note: logic differs from default Linear because merging is not supported
66
+ result = self.base_layer(x)
67
+
68
+ if self.disable_adapters:
69
+ return result
70
+
71
+ for active_adapter in self.active_adapters:
72
+ if active_adapter not in self.lora_A.keys():
73
+ continue
74
+ lora_A = self.lora_A[active_adapter]
75
+ lora_B = self.lora_B[active_adapter]
76
+ dropout = self.lora_dropout[active_adapter]
77
+ scaling = self.scaling[active_adapter]
78
+
79
+ requires_conversion = not torch.is_autocast_enabled()
80
+ if requires_conversion:
81
+ expected_dtype = result.dtype
82
+ x = self._cast_input_dtype(x, lora_A.weight.dtype)
83
+
84
+ output = lora_B(lora_A(dropout(x)))
85
+ if requires_conversion:
86
+ output = output.to(expected_dtype)
87
+ output = output * scaling
88
+ result += output
89
+ return result
unsloth_compiled_cache/AwqLoraLinear_peft_forward.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ 2026.6.7
3
+ 2026.6.9
4
+ 5.5.0
5
+ 1.7.0
6
+ __UNSLOTH_VERSIONING__
7
+ """
8
+
9
+ # Unsloth auto generated code
10
+ # Copyright 2023-present Daniel Han-Chen, Michael Han-Chen & the Unsloth team. All rights reserved.
11
+ #
12
+ # This program is free software: you can redistribute it and/or modify
13
+ # it under the terms of the GNU Lesser General Public License as published by
14
+ # the Free Software Foundation, either version 3 of the License, or
15
+ # (at your option) any later version.
16
+ #
17
+ # This program is distributed in the hope that it will be useful,
18
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ # GNU General Public License for more details.
21
+ #
22
+ # You should have received a copy of the GNU Lesser General Public License
23
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
24
+
25
+
26
+ torch_compile_options = {'epilogue_fusion': True, 'max_autotune': False, 'shape_padding': True, 'trace.enabled': False, 'triton.cudagraphs': False, 'debug': False, 'dce': True, 'memory_planning': True, 'coordinate_descent_tuning': False, 'trace.graph_diagram': False, 'compile_threads': 4, 'group_fusion': True, 'disable_progress': True, 'verbose_progress': False, 'triton.multi_kernel': 0, 'triton.use_block_ptr': False, 'triton.enable_persistent_tma_matmul': True, 'triton.autotune_at_compile_time': False, 'triton.cooperative_reductions': False, 'cuda.compile_opt_level': '-O2', 'cuda.enable_cuda_lto': True, 'combo_kernels': False, 'benchmark_combo_kernel': True, 'combo_kernel_foreach_dynamic_shapes': True}
27
+ from torch import Tensor
28
+ import torch
29
+ import torch.nn as nn
30
+ from torch.nn import functional as F
31
+ from unsloth_zoo.temporary_patches.common import torch_compile
32
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
33
+ from peft.tuners.lora.awq import (torch)
34
+
35
+
36
+ torch_addmm = torch.addmm
37
+ torch_add = torch.add
38
+ # @torch.compile(fullgraph = False, dynamic = True, options = torch_compile_options)
39
+ def lora_forward(result, lora_A, lora_B, dropout, x, scaling):
40
+ # Use result.dtype (bfloat16 from base layer) since x may have been cast to float32
41
+ # by _cast_input_dtype when autocast is disabled
42
+ target_dtype = result.dtype
43
+ xA = dropout(x).to(target_dtype) @ lora_A.weight.to(target_dtype).t()
44
+ # output = result + scaling * xA @ lora_B.weight.t()
45
+ shape = result.shape
46
+ output = torch_addmm(
47
+ result.view(-1, shape[-1]),
48
+ xA.view(-1, xA.shape[-1]),
49
+ lora_B.weight.to(target_dtype).t(),
50
+ alpha = scaling,
51
+ beta = 1,
52
+ ).view(shape)
53
+
54
+ bias = lora_B.bias
55
+ if bias is not None:
56
+ output = torch_add(
57
+ output,
58
+ bias.to(target_dtype),
59
+ alpha = scaling,
60
+ )
61
+ return output
62
+ pass
63
+
64
+ def unsloth_forward(self, x: torch.Tensor):
65
+ result = self.quant_linear_module(x)
66
+
67
+ if self.disable_adapters:
68
+ return result
69
+
70
+ for active_adapter in self.active_adapters:
71
+ if active_adapter not in self.lora_A.keys():
72
+ continue
73
+ lora_A = self.lora_A[active_adapter]
74
+ lora_B = self.lora_B[active_adapter]
75
+ dropout = self.lora_dropout[active_adapter]
76
+ scaling = self.scaling[active_adapter]
77
+
78
+ requires_conversion = not torch.is_autocast_enabled()
79
+ if requires_conversion:
80
+ expected_dtype = result.dtype
81
+ x = self._cast_input_dtype(x, lora_A.weight.dtype)
82
+
83
+ output = lora_B(lora_A(dropout(x)))
84
+ if requires_conversion:
85
+ output = output.to(expected_dtype)
86
+ output = output * scaling
87
+ result = result + output
88
+ return result
unsloth_compiled_cache/BatchNorm1d.py ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ 2026.6.7
3
+ 2026.6.9
4
+ 5.5.0
5
+ 1.7.0
6
+ __UNSLOTH_VERSIONING__
7
+ """
8
+
9
+ # Unsloth auto generated code
10
+ # Copyright 2023-present Daniel Han-Chen, Michael Han-Chen & the Unsloth team. All rights reserved.
11
+ #
12
+ # This program is free software: you can redistribute it and/or modify
13
+ # it under the terms of the GNU Lesser General Public License as published by
14
+ # the Free Software Foundation, either version 3 of the License, or
15
+ # (at your option) any later version.
16
+ #
17
+ # This program is distributed in the hope that it will be useful,
18
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ # GNU General Public License for more details.
21
+ #
22
+ # You should have received a copy of the GNU Lesser General Public License
23
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
24
+
25
+
26
+ import os
27
+ import sys
28
+ import torch
29
+ import importlib.util
30
+ import math
31
+ if importlib.util.find_spec("unsloth_studio") is None:
32
+ UNSLOTH_STUDIO_ENABLED = False
33
+ else:
34
+ UNSLOTH_STUDIO_ENABLED = os.environ.get("UNSLOTH_STUDIO_DISABLED", "0") == "0"
35
+ pass
36
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
37
+ import math
38
+
39
+ UNSLOTH_ENABLE_LOGGING = os.environ.get("UNSLOTH_ENABLE_LOGGING", "0") == "1"
40
+ UNSLOTH_ENABLE_CCE = os.environ.get("UNSLOTH_ENABLE_CCE", "1") == "1"
41
+ UNSLOTH_COMPILE_DISABLE = os.environ.get("UNSLOTH_COMPILE_DISABLE", "0") in ("1", "partial",)
42
+ UNSLOTH_COMPILE_LOCATION = os.environ.get("UNSLOTH_COMPILE_LOCATION", "unsloth_compiled_cache")
43
+ if UNSLOTH_COMPILE_LOCATION not in sys.path:
44
+ sys.path.insert(0, UNSLOTH_COMPILE_LOCATION)
45
+
46
+ import logging
47
+ logger_compiler = logging.getLogger(__name__)
48
+ if UNSLOTH_ENABLE_LOGGING:
49
+ logger_compiler.setLevel(logging.DEBUG)
50
+
51
+ global INFERENCE_RUNS
52
+ INFERENCE_RUNS = 0
53
+
54
+ try:
55
+ import torch._dynamo.eval_frame as torch_dynamo_eval_frame
56
+ torch_dynamo_eval_frame._stance.stance
57
+ torch_compiler_set_stance = torch.compiler.set_stance
58
+ except:
59
+ torch_dynamo_eval_frame = None
60
+ torch_compiler_set_stance = None
61
+ pass
62
+
63
+ from unsloth_zoo import DEVICE_TYPE_TORCH, DEVICE_COUNT
64
+
65
+ torch_compile_options = {'epilogue_fusion': True, 'max_autotune': False, 'shape_padding': True, 'trace.enabled': False, 'triton.cudagraphs': False, 'debug': False, 'dce': True, 'memory_planning': True, 'coordinate_descent_tuning': False, 'trace.graph_diagram': False, 'compile_threads': 4, 'group_fusion': True, 'disable_progress': True, 'verbose_progress': False, 'triton.multi_kernel': 0, 'triton.use_block_ptr': False, 'triton.enable_persistent_tma_matmul': True, 'triton.autotune_at_compile_time': False, 'triton.cooperative_reductions': False, 'cuda.compile_opt_level': '-O2', 'cuda.enable_cuda_lto': True, 'combo_kernels': False, 'benchmark_combo_kernel': True, 'combo_kernel_foreach_dynamic_shapes': True}
66
+ from torch import Tensor
67
+ import torch
68
+ import torch.nn as nn
69
+ from torch.nn import functional as F
70
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
71
+ from transformers.models.gemma4.modeling_gemma4 import (F, nn)
72
+
73
+ def forward(self, input: Tensor) -> Tensor:
74
+ self._check_input_dim(input)
75
+
76
+ # exponential_average_factor is set to self.momentum
77
+ # (when it is available) only so that it gets updated
78
+ # in ONNX graph when this node is exported to ONNX.
79
+ if self.momentum is None:
80
+ exponential_average_factor = 0.0
81
+ else:
82
+ exponential_average_factor = self.momentum
83
+
84
+ if self.training and self.track_running_stats:
85
+ # TODO: if statement only here to tell the jit to skip emitting this when it is None
86
+ if self.num_batches_tracked is not None: # type: ignore[has-type]
87
+ self.num_batches_tracked.add_(1) # type: ignore[has-type]
88
+ if self.momentum is None: # use cumulative moving average
89
+ exponential_average_factor = 1.0 / float(self.num_batches_tracked)
90
+ else: # use exponential moving average
91
+ exponential_average_factor = self.momentum
92
+
93
+ r"""
94
+ Decide whether the mini-batch stats should be used for normalization rather than the buffers.
95
+ Mini-batch stats are used in training mode, and in eval mode when buffers are None.
96
+ """
97
+ if self.training:
98
+ bn_training = True
99
+ else:
100
+ bn_training = (self.running_mean is None) and (self.running_var is None)
101
+
102
+ r"""
103
+ Buffers are only updated if they are to be tracked and we are in training mode. Thus they only need to be
104
+ passed when the update should occur (i.e. in training mode when they are tracked), or when buffer stats are
105
+ used for normalization (i.e. in eval mode when buffers are not None).
106
+ """
107
+ return F.batch_norm(
108
+ input,
109
+ # If buffers are not to be tracked, ensure that they won't be updated
110
+ (
111
+ self.running_mean
112
+ if not self.training or self.track_running_stats
113
+ else None
114
+ ),
115
+ self.running_var if not self.training or self.track_running_stats else None,
116
+ self.weight,
117
+ self.bias,
118
+ bn_training,
119
+ exponential_average_factor,
120
+ self.eps,
121
+ ).to(input.dtype).to(input.dtype)
unsloth_compiled_cache/BatchNorm2d.py ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ 2026.6.7
3
+ 2026.6.9
4
+ 5.5.0
5
+ 1.7.0
6
+ __UNSLOTH_VERSIONING__
7
+ """
8
+
9
+ # Unsloth auto generated code
10
+ # Copyright 2023-present Daniel Han-Chen, Michael Han-Chen & the Unsloth team. All rights reserved.
11
+ #
12
+ # This program is free software: you can redistribute it and/or modify
13
+ # it under the terms of the GNU Lesser General Public License as published by
14
+ # the Free Software Foundation, either version 3 of the License, or
15
+ # (at your option) any later version.
16
+ #
17
+ # This program is distributed in the hope that it will be useful,
18
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ # GNU General Public License for more details.
21
+ #
22
+ # You should have received a copy of the GNU Lesser General Public License
23
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
24
+
25
+
26
+ import os
27
+ import sys
28
+ import torch
29
+ import importlib.util
30
+ import math
31
+ if importlib.util.find_spec("unsloth_studio") is None:
32
+ UNSLOTH_STUDIO_ENABLED = False
33
+ else:
34
+ UNSLOTH_STUDIO_ENABLED = os.environ.get("UNSLOTH_STUDIO_DISABLED", "0") == "0"
35
+ pass
36
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
37
+ import math
38
+
39
+ UNSLOTH_ENABLE_LOGGING = os.environ.get("UNSLOTH_ENABLE_LOGGING", "0") == "1"
40
+ UNSLOTH_ENABLE_CCE = os.environ.get("UNSLOTH_ENABLE_CCE", "1") == "1"
41
+ UNSLOTH_COMPILE_DISABLE = os.environ.get("UNSLOTH_COMPILE_DISABLE", "0") in ("1", "partial",)
42
+ UNSLOTH_COMPILE_LOCATION = os.environ.get("UNSLOTH_COMPILE_LOCATION", "unsloth_compiled_cache")
43
+ if UNSLOTH_COMPILE_LOCATION not in sys.path:
44
+ sys.path.insert(0, UNSLOTH_COMPILE_LOCATION)
45
+
46
+ import logging
47
+ logger_compiler = logging.getLogger(__name__)
48
+ if UNSLOTH_ENABLE_LOGGING:
49
+ logger_compiler.setLevel(logging.DEBUG)
50
+
51
+ global INFERENCE_RUNS
52
+ INFERENCE_RUNS = 0
53
+
54
+ try:
55
+ import torch._dynamo.eval_frame as torch_dynamo_eval_frame
56
+ torch_dynamo_eval_frame._stance.stance
57
+ torch_compiler_set_stance = torch.compiler.set_stance
58
+ except:
59
+ torch_dynamo_eval_frame = None
60
+ torch_compiler_set_stance = None
61
+ pass
62
+
63
+ from unsloth_zoo import DEVICE_TYPE_TORCH, DEVICE_COUNT
64
+
65
+ torch_compile_options = {'epilogue_fusion': True, 'max_autotune': False, 'shape_padding': True, 'trace.enabled': False, 'triton.cudagraphs': False, 'debug': False, 'dce': True, 'memory_planning': True, 'coordinate_descent_tuning': False, 'trace.graph_diagram': False, 'compile_threads': 4, 'group_fusion': True, 'disable_progress': True, 'verbose_progress': False, 'triton.multi_kernel': 0, 'triton.use_block_ptr': False, 'triton.enable_persistent_tma_matmul': True, 'triton.autotune_at_compile_time': False, 'triton.cooperative_reductions': False, 'cuda.compile_opt_level': '-O2', 'cuda.enable_cuda_lto': True, 'combo_kernels': False, 'benchmark_combo_kernel': True, 'combo_kernel_foreach_dynamic_shapes': True}
66
+ from torch import Tensor
67
+ import torch
68
+ import torch.nn as nn
69
+ from torch.nn import functional as F
70
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
71
+ from transformers.models.gemma4.modeling_gemma4 import (F, nn)
72
+
73
+ def forward(self, input: Tensor) -> Tensor:
74
+ self._check_input_dim(input)
75
+
76
+ # exponential_average_factor is set to self.momentum
77
+ # (when it is available) only so that it gets updated
78
+ # in ONNX graph when this node is exported to ONNX.
79
+ if self.momentum is None:
80
+ exponential_average_factor = 0.0
81
+ else:
82
+ exponential_average_factor = self.momentum
83
+
84
+ if self.training and self.track_running_stats:
85
+ # TODO: if statement only here to tell the jit to skip emitting this when it is None
86
+ if self.num_batches_tracked is not None: # type: ignore[has-type]
87
+ self.num_batches_tracked.add_(1) # type: ignore[has-type]
88
+ if self.momentum is None: # use cumulative moving average
89
+ exponential_average_factor = 1.0 / float(self.num_batches_tracked)
90
+ else: # use exponential moving average
91
+ exponential_average_factor = self.momentum
92
+
93
+ r"""
94
+ Decide whether the mini-batch stats should be used for normalization rather than the buffers.
95
+ Mini-batch stats are used in training mode, and in eval mode when buffers are None.
96
+ """
97
+ if self.training:
98
+ bn_training = True
99
+ else:
100
+ bn_training = (self.running_mean is None) and (self.running_var is None)
101
+
102
+ r"""
103
+ Buffers are only updated if they are to be tracked and we are in training mode. Thus they only need to be
104
+ passed when the update should occur (i.e. in training mode when they are tracked), or when buffer stats are
105
+ used for normalization (i.e. in eval mode when buffers are not None).
106
+ """
107
+ return F.batch_norm(
108
+ input,
109
+ # If buffers are not to be tracked, ensure that they won't be updated
110
+ (
111
+ self.running_mean
112
+ if not self.training or self.track_running_stats
113
+ else None
114
+ ),
115
+ self.running_var if not self.training or self.track_running_stats else None,
116
+ self.weight,
117
+ self.bias,
118
+ bn_training,
119
+ exponential_average_factor,
120
+ self.eps,
121
+ ).to(input.dtype).to(input.dtype)
unsloth_compiled_cache/BatchNorm3d.py ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ 2026.6.7
3
+ 2026.6.9
4
+ 5.5.0
5
+ 1.7.0
6
+ __UNSLOTH_VERSIONING__
7
+ """
8
+
9
+ # Unsloth auto generated code
10
+ # Copyright 2023-present Daniel Han-Chen, Michael Han-Chen & the Unsloth team. All rights reserved.
11
+ #
12
+ # This program is free software: you can redistribute it and/or modify
13
+ # it under the terms of the GNU Lesser General Public License as published by
14
+ # the Free Software Foundation, either version 3 of the License, or
15
+ # (at your option) any later version.
16
+ #
17
+ # This program is distributed in the hope that it will be useful,
18
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ # GNU General Public License for more details.
21
+ #
22
+ # You should have received a copy of the GNU Lesser General Public License
23
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
24
+
25
+
26
+ import os
27
+ import sys
28
+ import torch
29
+ import importlib.util
30
+ import math
31
+ if importlib.util.find_spec("unsloth_studio") is None:
32
+ UNSLOTH_STUDIO_ENABLED = False
33
+ else:
34
+ UNSLOTH_STUDIO_ENABLED = os.environ.get("UNSLOTH_STUDIO_DISABLED", "0") == "0"
35
+ pass
36
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
37
+ import math
38
+
39
+ UNSLOTH_ENABLE_LOGGING = os.environ.get("UNSLOTH_ENABLE_LOGGING", "0") == "1"
40
+ UNSLOTH_ENABLE_CCE = os.environ.get("UNSLOTH_ENABLE_CCE", "1") == "1"
41
+ UNSLOTH_COMPILE_DISABLE = os.environ.get("UNSLOTH_COMPILE_DISABLE", "0") in ("1", "partial",)
42
+ UNSLOTH_COMPILE_LOCATION = os.environ.get("UNSLOTH_COMPILE_LOCATION", "unsloth_compiled_cache")
43
+ if UNSLOTH_COMPILE_LOCATION not in sys.path:
44
+ sys.path.insert(0, UNSLOTH_COMPILE_LOCATION)
45
+
46
+ import logging
47
+ logger_compiler = logging.getLogger(__name__)
48
+ if UNSLOTH_ENABLE_LOGGING:
49
+ logger_compiler.setLevel(logging.DEBUG)
50
+
51
+ global INFERENCE_RUNS
52
+ INFERENCE_RUNS = 0
53
+
54
+ try:
55
+ import torch._dynamo.eval_frame as torch_dynamo_eval_frame
56
+ torch_dynamo_eval_frame._stance.stance
57
+ torch_compiler_set_stance = torch.compiler.set_stance
58
+ except:
59
+ torch_dynamo_eval_frame = None
60
+ torch_compiler_set_stance = None
61
+ pass
62
+
63
+ from unsloth_zoo import DEVICE_TYPE_TORCH, DEVICE_COUNT
64
+
65
+ torch_compile_options = {'epilogue_fusion': True, 'max_autotune': False, 'shape_padding': True, 'trace.enabled': False, 'triton.cudagraphs': False, 'debug': False, 'dce': True, 'memory_planning': True, 'coordinate_descent_tuning': False, 'trace.graph_diagram': False, 'compile_threads': 4, 'group_fusion': True, 'disable_progress': True, 'verbose_progress': False, 'triton.multi_kernel': 0, 'triton.use_block_ptr': False, 'triton.enable_persistent_tma_matmul': True, 'triton.autotune_at_compile_time': False, 'triton.cooperative_reductions': False, 'cuda.compile_opt_level': '-O2', 'cuda.enable_cuda_lto': True, 'combo_kernels': False, 'benchmark_combo_kernel': True, 'combo_kernel_foreach_dynamic_shapes': True}
66
+ from torch import Tensor
67
+ import torch
68
+ import torch.nn as nn
69
+ from torch.nn import functional as F
70
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
71
+ from transformers.models.gemma4.modeling_gemma4 import (F, nn)
72
+
73
+ def forward(self, input: Tensor) -> Tensor:
74
+ self._check_input_dim(input)
75
+
76
+ # exponential_average_factor is set to self.momentum
77
+ # (when it is available) only so that it gets updated
78
+ # in ONNX graph when this node is exported to ONNX.
79
+ if self.momentum is None:
80
+ exponential_average_factor = 0.0
81
+ else:
82
+ exponential_average_factor = self.momentum
83
+
84
+ if self.training and self.track_running_stats:
85
+ # TODO: if statement only here to tell the jit to skip emitting this when it is None
86
+ if self.num_batches_tracked is not None: # type: ignore[has-type]
87
+ self.num_batches_tracked.add_(1) # type: ignore[has-type]
88
+ if self.momentum is None: # use cumulative moving average
89
+ exponential_average_factor = 1.0 / float(self.num_batches_tracked)
90
+ else: # use exponential moving average
91
+ exponential_average_factor = self.momentum
92
+
93
+ r"""
94
+ Decide whether the mini-batch stats should be used for normalization rather than the buffers.
95
+ Mini-batch stats are used in training mode, and in eval mode when buffers are None.
96
+ """
97
+ if self.training:
98
+ bn_training = True
99
+ else:
100
+ bn_training = (self.running_mean is None) and (self.running_var is None)
101
+
102
+ r"""
103
+ Buffers are only updated if they are to be tracked and we are in training mode. Thus they only need to be
104
+ passed when the update should occur (i.e. in training mode when they are tracked), or when buffer stats are
105
+ used for normalization (i.e. in eval mode when buffers are not None).
106
+ """
107
+ return F.batch_norm(
108
+ input,
109
+ # If buffers are not to be tracked, ensure that they won't be updated
110
+ (
111
+ self.running_mean
112
+ if not self.training or self.track_running_stats
113
+ else None
114
+ ),
115
+ self.running_var if not self.training or self.track_running_stats else None,
116
+ self.weight,
117
+ self.bias,
118
+ bn_training,
119
+ exponential_average_factor,
120
+ self.eps,
121
+ ).to(input.dtype).to(input.dtype)
unsloth_compiled_cache/BlockDiagonalLinear_peft_forward.py ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ 2026.6.7
3
+ 2026.6.9
4
+ 5.5.0
5
+ 1.7.0
6
+ __UNSLOTH_VERSIONING__
7
+ """
8
+
9
+ # Unsloth auto generated code
10
+ # Copyright 2023-present Daniel Han-Chen, Michael Han-Chen & the Unsloth team. All rights reserved.
11
+ #
12
+ # This program is free software: you can redistribute it and/or modify
13
+ # it under the terms of the GNU Lesser General Public License as published by
14
+ # the Free Software Foundation, either version 3 of the License, or
15
+ # (at your option) any later version.
16
+ #
17
+ # This program is distributed in the hope that it will be useful,
18
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ # GNU General Public License for more details.
21
+ #
22
+ # You should have received a copy of the GNU Lesser General Public License
23
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
24
+
25
+
26
+ torch_compile_options = {'epilogue_fusion': True, 'max_autotune': False, 'shape_padding': True, 'trace.enabled': False, 'triton.cudagraphs': False, 'debug': False, 'dce': True, 'memory_planning': True, 'coordinate_descent_tuning': False, 'trace.graph_diagram': False, 'compile_threads': 4, 'group_fusion': True, 'disable_progress': True, 'verbose_progress': False, 'triton.multi_kernel': 0, 'triton.use_block_ptr': False, 'triton.enable_persistent_tma_matmul': True, 'triton.autotune_at_compile_time': False, 'triton.cooperative_reductions': False, 'cuda.compile_opt_level': '-O2', 'cuda.enable_cuda_lto': True, 'combo_kernels': False, 'benchmark_combo_kernel': True, 'combo_kernel_foreach_dynamic_shapes': True}
27
+ from torch import Tensor
28
+ import torch
29
+ import torch.nn as nn
30
+ from torch.nn import functional as F
31
+ from unsloth_zoo.temporary_patches.common import torch_compile
32
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
33
+ from peft.tuners.lora.variants import (torch)
34
+
35
+
36
+ torch_addmm = torch.addmm
37
+ torch_add = torch.add
38
+ # @torch.compile(fullgraph = False, dynamic = True, options = torch_compile_options)
39
+ def lora_forward(result, lora_A, lora_B, dropout, x, scaling):
40
+ # Use result.dtype (bfloat16 from base layer) since x may have been cast to float32
41
+ # by _cast_input_dtype when autocast is disabled
42
+ target_dtype = result.dtype
43
+ xA = dropout(x).to(target_dtype) @ lora_A.weight.to(target_dtype).t()
44
+ # output = result + scaling * xA @ lora_B.weight.t()
45
+ shape = result.shape
46
+ output = torch_addmm(
47
+ result.view(-1, shape[-1]),
48
+ xA.view(-1, xA.shape[-1]),
49
+ lora_B.weight.to(target_dtype).t(),
50
+ alpha = scaling,
51
+ beta = 1,
52
+ ).view(shape)
53
+
54
+ bias = lora_B.bias
55
+ if bias is not None:
56
+ output = torch_add(
57
+ output,
58
+ bias.to(target_dtype),
59
+ alpha = scaling,
60
+ )
61
+ return output
62
+ pass
63
+
64
+ def unsloth_forward(self, x: torch.Tensor) -> torch.Tensor:
65
+ first_dims = x.shape[:-1]
66
+ if x.dim() != 2:
67
+ x = x.reshape(-1, x.shape[-1])
68
+ B = x.shape[0]
69
+ nb = self.nblocks
70
+ m = x.shape[-1] // nb
71
+ n = self.out_features // nb
72
+ x = x.reshape(B, nb, m)
73
+ w = self.weight.view(nb, n, m)
74
+ out = torch.einsum("bim,inm->bin", x, w)
75
+ return out.reshape(*first_dims, -1)
unsloth_compiled_cache/Conv1d.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ 2026.6.7
3
+ 2026.6.9
4
+ 5.5.0
5
+ 1.7.0
6
+ __UNSLOTH_VERSIONING__
7
+ """
8
+
9
+ # Unsloth auto generated code
10
+ # Copyright 2023-present Daniel Han-Chen, Michael Han-Chen & the Unsloth team. All rights reserved.
11
+ #
12
+ # This program is free software: you can redistribute it and/or modify
13
+ # it under the terms of the GNU Lesser General Public License as published by
14
+ # the Free Software Foundation, either version 3 of the License, or
15
+ # (at your option) any later version.
16
+ #
17
+ # This program is distributed in the hope that it will be useful,
18
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ # GNU General Public License for more details.
21
+ #
22
+ # You should have received a copy of the GNU Lesser General Public License
23
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
24
+
25
+
26
+ import os
27
+ import sys
28
+ import torch
29
+ import importlib.util
30
+ import math
31
+ if importlib.util.find_spec("unsloth_studio") is None:
32
+ UNSLOTH_STUDIO_ENABLED = False
33
+ else:
34
+ UNSLOTH_STUDIO_ENABLED = os.environ.get("UNSLOTH_STUDIO_DISABLED", "0") == "0"
35
+ pass
36
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
37
+ import math
38
+
39
+ UNSLOTH_ENABLE_LOGGING = os.environ.get("UNSLOTH_ENABLE_LOGGING", "0") == "1"
40
+ UNSLOTH_ENABLE_CCE = os.environ.get("UNSLOTH_ENABLE_CCE", "1") == "1"
41
+ UNSLOTH_COMPILE_DISABLE = os.environ.get("UNSLOTH_COMPILE_DISABLE", "0") in ("1", "partial",)
42
+ UNSLOTH_COMPILE_LOCATION = os.environ.get("UNSLOTH_COMPILE_LOCATION", "unsloth_compiled_cache")
43
+ if UNSLOTH_COMPILE_LOCATION not in sys.path:
44
+ sys.path.insert(0, UNSLOTH_COMPILE_LOCATION)
45
+
46
+ import logging
47
+ logger_compiler = logging.getLogger(__name__)
48
+ if UNSLOTH_ENABLE_LOGGING:
49
+ logger_compiler.setLevel(logging.DEBUG)
50
+
51
+ global INFERENCE_RUNS
52
+ INFERENCE_RUNS = 0
53
+
54
+ try:
55
+ import torch._dynamo.eval_frame as torch_dynamo_eval_frame
56
+ torch_dynamo_eval_frame._stance.stance
57
+ torch_compiler_set_stance = torch.compiler.set_stance
58
+ except:
59
+ torch_dynamo_eval_frame = None
60
+ torch_compiler_set_stance = None
61
+ pass
62
+
63
+ from unsloth_zoo import DEVICE_TYPE_TORCH, DEVICE_COUNT
64
+
65
+ torch_compile_options = {'epilogue_fusion': True, 'max_autotune': False, 'shape_padding': True, 'trace.enabled': False, 'triton.cudagraphs': False, 'debug': False, 'dce': True, 'memory_planning': True, 'coordinate_descent_tuning': False, 'trace.graph_diagram': False, 'compile_threads': 4, 'group_fusion': True, 'disable_progress': True, 'verbose_progress': False, 'triton.multi_kernel': 0, 'triton.use_block_ptr': False, 'triton.enable_persistent_tma_matmul': True, 'triton.autotune_at_compile_time': False, 'triton.cooperative_reductions': False, 'cuda.compile_opt_level': '-O2', 'cuda.enable_cuda_lto': True, 'combo_kernels': False, 'benchmark_combo_kernel': True, 'combo_kernel_foreach_dynamic_shapes': True}
66
+ from torch import Tensor
67
+ import torch
68
+ import torch.nn as nn
69
+ from torch.nn import functional as F
70
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
71
+
72
+
73
+ def forward(self, input: Tensor) -> Tensor:
74
+ original_dtype = input.dtype
75
+ input = input.to(self.weight.dtype)
76
+ original_dtype = input.dtype
77
+ input = input.to(self.weight.dtype)
78
+ return self._conv_forward(input, self.weight, self.bias).to(original_dtype).to(original_dtype)
unsloth_compiled_cache/Conv2d.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ 2026.6.7
3
+ 2026.6.9
4
+ 5.5.0
5
+ 1.7.0
6
+ __UNSLOTH_VERSIONING__
7
+ """
8
+
9
+ # Unsloth auto generated code
10
+ # Copyright 2023-present Daniel Han-Chen, Michael Han-Chen & the Unsloth team. All rights reserved.
11
+ #
12
+ # This program is free software: you can redistribute it and/or modify
13
+ # it under the terms of the GNU Lesser General Public License as published by
14
+ # the Free Software Foundation, either version 3 of the License, or
15
+ # (at your option) any later version.
16
+ #
17
+ # This program is distributed in the hope that it will be useful,
18
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ # GNU General Public License for more details.
21
+ #
22
+ # You should have received a copy of the GNU Lesser General Public License
23
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
24
+
25
+
26
+ import os
27
+ import sys
28
+ import torch
29
+ import importlib.util
30
+ import math
31
+ if importlib.util.find_spec("unsloth_studio") is None:
32
+ UNSLOTH_STUDIO_ENABLED = False
33
+ else:
34
+ UNSLOTH_STUDIO_ENABLED = os.environ.get("UNSLOTH_STUDIO_DISABLED", "0") == "0"
35
+ pass
36
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
37
+ import math
38
+
39
+ UNSLOTH_ENABLE_LOGGING = os.environ.get("UNSLOTH_ENABLE_LOGGING", "0") == "1"
40
+ UNSLOTH_ENABLE_CCE = os.environ.get("UNSLOTH_ENABLE_CCE", "1") == "1"
41
+ UNSLOTH_COMPILE_DISABLE = os.environ.get("UNSLOTH_COMPILE_DISABLE", "0") in ("1", "partial",)
42
+ UNSLOTH_COMPILE_LOCATION = os.environ.get("UNSLOTH_COMPILE_LOCATION", "unsloth_compiled_cache")
43
+ if UNSLOTH_COMPILE_LOCATION not in sys.path:
44
+ sys.path.insert(0, UNSLOTH_COMPILE_LOCATION)
45
+
46
+ import logging
47
+ logger_compiler = logging.getLogger(__name__)
48
+ if UNSLOTH_ENABLE_LOGGING:
49
+ logger_compiler.setLevel(logging.DEBUG)
50
+
51
+ global INFERENCE_RUNS
52
+ INFERENCE_RUNS = 0
53
+
54
+ try:
55
+ import torch._dynamo.eval_frame as torch_dynamo_eval_frame
56
+ torch_dynamo_eval_frame._stance.stance
57
+ torch_compiler_set_stance = torch.compiler.set_stance
58
+ except:
59
+ torch_dynamo_eval_frame = None
60
+ torch_compiler_set_stance = None
61
+ pass
62
+
63
+ from unsloth_zoo import DEVICE_TYPE_TORCH, DEVICE_COUNT
64
+
65
+ torch_compile_options = {'epilogue_fusion': True, 'max_autotune': False, 'shape_padding': True, 'trace.enabled': False, 'triton.cudagraphs': False, 'debug': False, 'dce': True, 'memory_planning': True, 'coordinate_descent_tuning': False, 'trace.graph_diagram': False, 'compile_threads': 4, 'group_fusion': True, 'disable_progress': True, 'verbose_progress': False, 'triton.multi_kernel': 0, 'triton.use_block_ptr': False, 'triton.enable_persistent_tma_matmul': True, 'triton.autotune_at_compile_time': False, 'triton.cooperative_reductions': False, 'cuda.compile_opt_level': '-O2', 'cuda.enable_cuda_lto': True, 'combo_kernels': False, 'benchmark_combo_kernel': True, 'combo_kernel_foreach_dynamic_shapes': True}
66
+ from torch import Tensor
67
+ import torch
68
+ import torch.nn as nn
69
+ from torch.nn import functional as F
70
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
71
+
72
+
73
+ def forward(self, input: Tensor) -> Tensor:
74
+ original_dtype = input.dtype
75
+ input = input.to(self.weight.dtype)
76
+ original_dtype = input.dtype
77
+ input = input.to(self.weight.dtype)
78
+ return self._conv_forward(input, self.weight, self.bias).to(original_dtype).to(original_dtype)
unsloth_compiled_cache/Conv3d.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ 2026.6.7
3
+ 2026.6.9
4
+ 5.5.0
5
+ 1.7.0
6
+ __UNSLOTH_VERSIONING__
7
+ """
8
+
9
+ # Unsloth auto generated code
10
+ # Copyright 2023-present Daniel Han-Chen, Michael Han-Chen & the Unsloth team. All rights reserved.
11
+ #
12
+ # This program is free software: you can redistribute it and/or modify
13
+ # it under the terms of the GNU Lesser General Public License as published by
14
+ # the Free Software Foundation, either version 3 of the License, or
15
+ # (at your option) any later version.
16
+ #
17
+ # This program is distributed in the hope that it will be useful,
18
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ # GNU General Public License for more details.
21
+ #
22
+ # You should have received a copy of the GNU Lesser General Public License
23
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
24
+
25
+
26
+ import os
27
+ import sys
28
+ import torch
29
+ import importlib.util
30
+ import math
31
+ if importlib.util.find_spec("unsloth_studio") is None:
32
+ UNSLOTH_STUDIO_ENABLED = False
33
+ else:
34
+ UNSLOTH_STUDIO_ENABLED = os.environ.get("UNSLOTH_STUDIO_DISABLED", "0") == "0"
35
+ pass
36
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
37
+ import math
38
+
39
+ UNSLOTH_ENABLE_LOGGING = os.environ.get("UNSLOTH_ENABLE_LOGGING", "0") == "1"
40
+ UNSLOTH_ENABLE_CCE = os.environ.get("UNSLOTH_ENABLE_CCE", "1") == "1"
41
+ UNSLOTH_COMPILE_DISABLE = os.environ.get("UNSLOTH_COMPILE_DISABLE", "0") in ("1", "partial",)
42
+ UNSLOTH_COMPILE_LOCATION = os.environ.get("UNSLOTH_COMPILE_LOCATION", "unsloth_compiled_cache")
43
+ if UNSLOTH_COMPILE_LOCATION not in sys.path:
44
+ sys.path.insert(0, UNSLOTH_COMPILE_LOCATION)
45
+
46
+ import logging
47
+ logger_compiler = logging.getLogger(__name__)
48
+ if UNSLOTH_ENABLE_LOGGING:
49
+ logger_compiler.setLevel(logging.DEBUG)
50
+
51
+ global INFERENCE_RUNS
52
+ INFERENCE_RUNS = 0
53
+
54
+ try:
55
+ import torch._dynamo.eval_frame as torch_dynamo_eval_frame
56
+ torch_dynamo_eval_frame._stance.stance
57
+ torch_compiler_set_stance = torch.compiler.set_stance
58
+ except:
59
+ torch_dynamo_eval_frame = None
60
+ torch_compiler_set_stance = None
61
+ pass
62
+
63
+ from unsloth_zoo import DEVICE_TYPE_TORCH, DEVICE_COUNT
64
+
65
+ torch_compile_options = {'epilogue_fusion': True, 'max_autotune': False, 'shape_padding': True, 'trace.enabled': False, 'triton.cudagraphs': False, 'debug': False, 'dce': True, 'memory_planning': True, 'coordinate_descent_tuning': False, 'trace.graph_diagram': False, 'compile_threads': 4, 'group_fusion': True, 'disable_progress': True, 'verbose_progress': False, 'triton.multi_kernel': 0, 'triton.use_block_ptr': False, 'triton.enable_persistent_tma_matmul': True, 'triton.autotune_at_compile_time': False, 'triton.cooperative_reductions': False, 'cuda.compile_opt_level': '-O2', 'cuda.enable_cuda_lto': True, 'combo_kernels': False, 'benchmark_combo_kernel': True, 'combo_kernel_foreach_dynamic_shapes': True}
66
+ from torch import Tensor
67
+ import torch
68
+ import torch.nn as nn
69
+ from torch.nn import functional as F
70
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
71
+
72
+
73
+ def forward(self, input: Tensor) -> Tensor:
74
+ original_dtype = input.dtype
75
+ input = input.to(self.weight.dtype)
76
+ original_dtype = input.dtype
77
+ input = input.to(self.weight.dtype)
78
+ return self._conv_forward(input, self.weight, self.bias).to(original_dtype).to(original_dtype)
unsloth_compiled_cache/ConvTranspose1d.py ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ 2026.6.7
3
+ 2026.6.9
4
+ 5.5.0
5
+ 1.7.0
6
+ __UNSLOTH_VERSIONING__
7
+ """
8
+
9
+ # Unsloth auto generated code
10
+ # Copyright 2023-present Daniel Han-Chen, Michael Han-Chen & the Unsloth team. All rights reserved.
11
+ #
12
+ # This program is free software: you can redistribute it and/or modify
13
+ # it under the terms of the GNU Lesser General Public License as published by
14
+ # the Free Software Foundation, either version 3 of the License, or
15
+ # (at your option) any later version.
16
+ #
17
+ # This program is distributed in the hope that it will be useful,
18
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ # GNU General Public License for more details.
21
+ #
22
+ # You should have received a copy of the GNU Lesser General Public License
23
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
24
+
25
+
26
+ import os
27
+ import sys
28
+ import torch
29
+ import importlib.util
30
+ import math
31
+ if importlib.util.find_spec("unsloth_studio") is None:
32
+ UNSLOTH_STUDIO_ENABLED = False
33
+ else:
34
+ UNSLOTH_STUDIO_ENABLED = os.environ.get("UNSLOTH_STUDIO_DISABLED", "0") == "0"
35
+ pass
36
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
37
+ import math
38
+
39
+ UNSLOTH_ENABLE_LOGGING = os.environ.get("UNSLOTH_ENABLE_LOGGING", "0") == "1"
40
+ UNSLOTH_ENABLE_CCE = os.environ.get("UNSLOTH_ENABLE_CCE", "1") == "1"
41
+ UNSLOTH_COMPILE_DISABLE = os.environ.get("UNSLOTH_COMPILE_DISABLE", "0") in ("1", "partial",)
42
+ UNSLOTH_COMPILE_LOCATION = os.environ.get("UNSLOTH_COMPILE_LOCATION", "unsloth_compiled_cache")
43
+ if UNSLOTH_COMPILE_LOCATION not in sys.path:
44
+ sys.path.insert(0, UNSLOTH_COMPILE_LOCATION)
45
+
46
+ import logging
47
+ logger_compiler = logging.getLogger(__name__)
48
+ if UNSLOTH_ENABLE_LOGGING:
49
+ logger_compiler.setLevel(logging.DEBUG)
50
+
51
+ global INFERENCE_RUNS
52
+ INFERENCE_RUNS = 0
53
+
54
+ try:
55
+ import torch._dynamo.eval_frame as torch_dynamo_eval_frame
56
+ torch_dynamo_eval_frame._stance.stance
57
+ torch_compiler_set_stance = torch.compiler.set_stance
58
+ except:
59
+ torch_dynamo_eval_frame = None
60
+ torch_compiler_set_stance = None
61
+ pass
62
+
63
+ from unsloth_zoo import DEVICE_TYPE_TORCH, DEVICE_COUNT
64
+
65
+ torch_compile_options = {'epilogue_fusion': True, 'max_autotune': False, 'shape_padding': True, 'trace.enabled': False, 'triton.cudagraphs': False, 'debug': False, 'dce': True, 'memory_planning': True, 'coordinate_descent_tuning': False, 'trace.graph_diagram': False, 'compile_threads': 4, 'group_fusion': True, 'disable_progress': True, 'verbose_progress': False, 'triton.multi_kernel': 0, 'triton.use_block_ptr': False, 'triton.enable_persistent_tma_matmul': True, 'triton.autotune_at_compile_time': False, 'triton.cooperative_reductions': False, 'cuda.compile_opt_level': '-O2', 'cuda.enable_cuda_lto': True, 'combo_kernels': False, 'benchmark_combo_kernel': True, 'combo_kernel_foreach_dynamic_shapes': True}
66
+ from torch import Tensor
67
+ import torch
68
+ import torch.nn as nn
69
+ from torch.nn import functional as F
70
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
71
+ from transformers.models.gemma4.modeling_gemma4 import (F, nn)
72
+
73
+ def forward(self, input: Tensor, output_size: list[int] | None = None) -> Tensor:
74
+ original_dtype = input.dtype
75
+ input = input.to(self.weight.dtype)
76
+ original_dtype = input.dtype
77
+ input = input.to(self.weight.dtype)
78
+ if self.padding_mode != "zeros":
79
+ raise ValueError(
80
+ "Only `zeros` padding mode is supported for ConvTranspose1d"
81
+ )
82
+
83
+ assert isinstance(self.padding, tuple)
84
+ # One cannot replace List by Tuple or Sequence in "_output_padding" because
85
+ # TorchScript does not support `Sequence[T]` or `Tuple[T, ...]`.
86
+ num_spatial_dims = 1
87
+ output_padding = self._output_padding(
88
+ input,
89
+ output_size,
90
+ self.stride, # type: ignore[arg-type]
91
+ self.padding, # type: ignore[arg-type]
92
+ self.kernel_size, # type: ignore[arg-type]
93
+ num_spatial_dims,
94
+ self.dilation, # type: ignore[arg-type]
95
+ )
96
+ return F.conv_transpose1d(
97
+ input,
98
+ self.weight,
99
+ self.bias,
100
+ self.stride,
101
+ self.padding,
102
+ output_padding,
103
+ self.groups,
104
+ self.dilation,
105
+ ).to(original_dtype).to(original_dtype)
unsloth_compiled_cache/ConvTranspose2d.py ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ 2026.6.7
3
+ 2026.6.9
4
+ 5.5.0
5
+ 1.7.0
6
+ __UNSLOTH_VERSIONING__
7
+ """
8
+
9
+ # Unsloth auto generated code
10
+ # Copyright 2023-present Daniel Han-Chen, Michael Han-Chen & the Unsloth team. All rights reserved.
11
+ #
12
+ # This program is free software: you can redistribute it and/or modify
13
+ # it under the terms of the GNU Lesser General Public License as published by
14
+ # the Free Software Foundation, either version 3 of the License, or
15
+ # (at your option) any later version.
16
+ #
17
+ # This program is distributed in the hope that it will be useful,
18
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ # GNU General Public License for more details.
21
+ #
22
+ # You should have received a copy of the GNU Lesser General Public License
23
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
24
+
25
+
26
+ import os
27
+ import sys
28
+ import torch
29
+ import importlib.util
30
+ import math
31
+ if importlib.util.find_spec("unsloth_studio") is None:
32
+ UNSLOTH_STUDIO_ENABLED = False
33
+ else:
34
+ UNSLOTH_STUDIO_ENABLED = os.environ.get("UNSLOTH_STUDIO_DISABLED", "0") == "0"
35
+ pass
36
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
37
+ import math
38
+
39
+ UNSLOTH_ENABLE_LOGGING = os.environ.get("UNSLOTH_ENABLE_LOGGING", "0") == "1"
40
+ UNSLOTH_ENABLE_CCE = os.environ.get("UNSLOTH_ENABLE_CCE", "1") == "1"
41
+ UNSLOTH_COMPILE_DISABLE = os.environ.get("UNSLOTH_COMPILE_DISABLE", "0") in ("1", "partial",)
42
+ UNSLOTH_COMPILE_LOCATION = os.environ.get("UNSLOTH_COMPILE_LOCATION", "unsloth_compiled_cache")
43
+ if UNSLOTH_COMPILE_LOCATION not in sys.path:
44
+ sys.path.insert(0, UNSLOTH_COMPILE_LOCATION)
45
+
46
+ import logging
47
+ logger_compiler = logging.getLogger(__name__)
48
+ if UNSLOTH_ENABLE_LOGGING:
49
+ logger_compiler.setLevel(logging.DEBUG)
50
+
51
+ global INFERENCE_RUNS
52
+ INFERENCE_RUNS = 0
53
+
54
+ try:
55
+ import torch._dynamo.eval_frame as torch_dynamo_eval_frame
56
+ torch_dynamo_eval_frame._stance.stance
57
+ torch_compiler_set_stance = torch.compiler.set_stance
58
+ except:
59
+ torch_dynamo_eval_frame = None
60
+ torch_compiler_set_stance = None
61
+ pass
62
+
63
+ from unsloth_zoo import DEVICE_TYPE_TORCH, DEVICE_COUNT
64
+
65
+ torch_compile_options = {'epilogue_fusion': True, 'max_autotune': False, 'shape_padding': True, 'trace.enabled': False, 'triton.cudagraphs': False, 'debug': False, 'dce': True, 'memory_planning': True, 'coordinate_descent_tuning': False, 'trace.graph_diagram': False, 'compile_threads': 4, 'group_fusion': True, 'disable_progress': True, 'verbose_progress': False, 'triton.multi_kernel': 0, 'triton.use_block_ptr': False, 'triton.enable_persistent_tma_matmul': True, 'triton.autotune_at_compile_time': False, 'triton.cooperative_reductions': False, 'cuda.compile_opt_level': '-O2', 'cuda.enable_cuda_lto': True, 'combo_kernels': False, 'benchmark_combo_kernel': True, 'combo_kernel_foreach_dynamic_shapes': True}
66
+ from torch import Tensor
67
+ import torch
68
+ import torch.nn as nn
69
+ from torch.nn import functional as F
70
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
71
+ from transformers.models.gemma4.modeling_gemma4 import (F, nn)
72
+
73
+ def forward(self, input: Tensor, output_size: list[int] | None = None) -> Tensor:
74
+ original_dtype = input.dtype
75
+ input = input.to(self.weight.dtype)
76
+ original_dtype = input.dtype
77
+ input = input.to(self.weight.dtype)
78
+ """
79
+ Performs the forward pass.
80
+
81
+ Attributes:
82
+ input (Tensor): The input tensor.
83
+ output_size (list[int], optional): A list of integers representing
84
+ the size of the output tensor. Default is None.
85
+ """
86
+ if self.padding_mode != "zeros":
87
+ raise ValueError(
88
+ "Only `zeros` padding mode is supported for ConvTranspose2d"
89
+ )
90
+
91
+ assert isinstance(self.padding, tuple)
92
+ # One cannot replace List by Tuple or Sequence in "_output_padding" because
93
+ # TorchScript does not support `Sequence[T]` or `Tuple[T, ...]`.
94
+ num_spatial_dims = 2
95
+ output_padding = self._output_padding(
96
+ input,
97
+ output_size,
98
+ self.stride, # type: ignore[arg-type]
99
+ self.padding, # type: ignore[arg-type]
100
+ self.kernel_size, # type: ignore[arg-type]
101
+ num_spatial_dims,
102
+ self.dilation, # type: ignore[arg-type]
103
+ )
104
+
105
+ return F.conv_transpose2d(
106
+ input,
107
+ self.weight,
108
+ self.bias,
109
+ self.stride,
110
+ self.padding,
111
+ output_padding,
112
+ self.groups,
113
+ self.dilation,
114
+ ).to(original_dtype).to(original_dtype)
unsloth_compiled_cache/ConvTranspose3d.py ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ 2026.6.7
3
+ 2026.6.9
4
+ 5.5.0
5
+ 1.7.0
6
+ __UNSLOTH_VERSIONING__
7
+ """
8
+
9
+ # Unsloth auto generated code
10
+ # Copyright 2023-present Daniel Han-Chen, Michael Han-Chen & the Unsloth team. All rights reserved.
11
+ #
12
+ # This program is free software: you can redistribute it and/or modify
13
+ # it under the terms of the GNU Lesser General Public License as published by
14
+ # the Free Software Foundation, either version 3 of the License, or
15
+ # (at your option) any later version.
16
+ #
17
+ # This program is distributed in the hope that it will be useful,
18
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ # GNU General Public License for more details.
21
+ #
22
+ # You should have received a copy of the GNU Lesser General Public License
23
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
24
+
25
+
26
+ import os
27
+ import sys
28
+ import torch
29
+ import importlib.util
30
+ import math
31
+ if importlib.util.find_spec("unsloth_studio") is None:
32
+ UNSLOTH_STUDIO_ENABLED = False
33
+ else:
34
+ UNSLOTH_STUDIO_ENABLED = os.environ.get("UNSLOTH_STUDIO_DISABLED", "0") == "0"
35
+ pass
36
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
37
+ import math
38
+
39
+ UNSLOTH_ENABLE_LOGGING = os.environ.get("UNSLOTH_ENABLE_LOGGING", "0") == "1"
40
+ UNSLOTH_ENABLE_CCE = os.environ.get("UNSLOTH_ENABLE_CCE", "1") == "1"
41
+ UNSLOTH_COMPILE_DISABLE = os.environ.get("UNSLOTH_COMPILE_DISABLE", "0") in ("1", "partial",)
42
+ UNSLOTH_COMPILE_LOCATION = os.environ.get("UNSLOTH_COMPILE_LOCATION", "unsloth_compiled_cache")
43
+ if UNSLOTH_COMPILE_LOCATION not in sys.path:
44
+ sys.path.insert(0, UNSLOTH_COMPILE_LOCATION)
45
+
46
+ import logging
47
+ logger_compiler = logging.getLogger(__name__)
48
+ if UNSLOTH_ENABLE_LOGGING:
49
+ logger_compiler.setLevel(logging.DEBUG)
50
+
51
+ global INFERENCE_RUNS
52
+ INFERENCE_RUNS = 0
53
+
54
+ try:
55
+ import torch._dynamo.eval_frame as torch_dynamo_eval_frame
56
+ torch_dynamo_eval_frame._stance.stance
57
+ torch_compiler_set_stance = torch.compiler.set_stance
58
+ except:
59
+ torch_dynamo_eval_frame = None
60
+ torch_compiler_set_stance = None
61
+ pass
62
+
63
+ from unsloth_zoo import DEVICE_TYPE_TORCH, DEVICE_COUNT
64
+
65
+ torch_compile_options = {'epilogue_fusion': True, 'max_autotune': False, 'shape_padding': True, 'trace.enabled': False, 'triton.cudagraphs': False, 'debug': False, 'dce': True, 'memory_planning': True, 'coordinate_descent_tuning': False, 'trace.graph_diagram': False, 'compile_threads': 4, 'group_fusion': True, 'disable_progress': True, 'verbose_progress': False, 'triton.multi_kernel': 0, 'triton.use_block_ptr': False, 'triton.enable_persistent_tma_matmul': True, 'triton.autotune_at_compile_time': False, 'triton.cooperative_reductions': False, 'cuda.compile_opt_level': '-O2', 'cuda.enable_cuda_lto': True, 'combo_kernels': False, 'benchmark_combo_kernel': True, 'combo_kernel_foreach_dynamic_shapes': True}
66
+ from torch import Tensor
67
+ import torch
68
+ import torch.nn as nn
69
+ from torch.nn import functional as F
70
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
71
+ from transformers.models.gemma4.modeling_gemma4 import (F, nn)
72
+
73
+ def forward(self, input: Tensor, output_size: list[int] | None = None) -> Tensor:
74
+ original_dtype = input.dtype
75
+ input = input.to(self.weight.dtype)
76
+ original_dtype = input.dtype
77
+ input = input.to(self.weight.dtype)
78
+ if self.padding_mode != "zeros":
79
+ raise ValueError(
80
+ "Only `zeros` padding mode is supported for ConvTranspose3d"
81
+ )
82
+
83
+ assert isinstance(self.padding, tuple)
84
+ # One cannot replace List by Tuple or Sequence in "_output_padding" because
85
+ # TorchScript does not support `Sequence[T]` or `Tuple[T, ...]`.
86
+ num_spatial_dims = 3
87
+ output_padding = self._output_padding(
88
+ input,
89
+ output_size,
90
+ self.stride, # type: ignore[arg-type]
91
+ self.padding, # type: ignore[arg-type]
92
+ self.kernel_size, # type: ignore[arg-type]
93
+ num_spatial_dims,
94
+ self.dilation, # type: ignore[arg-type]
95
+ )
96
+
97
+ return F.conv_transpose3d(
98
+ input,
99
+ self.weight,
100
+ self.bias,
101
+ self.stride,
102
+ self.padding,
103
+ output_padding,
104
+ self.groups,
105
+ self.dilation,
106
+ ).to(original_dtype).to(original_dtype)
unsloth_compiled_cache/GPTQLoraLinear_peft_forward.py ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ 2026.6.7
3
+ 2026.6.9
4
+ 5.5.0
5
+ 1.7.0
6
+ __UNSLOTH_VERSIONING__
7
+ """
8
+
9
+ # Unsloth auto generated code
10
+ # Copyright 2023-present Daniel Han-Chen, Michael Han-Chen & the Unsloth team. All rights reserved.
11
+ #
12
+ # This program is free software: you can redistribute it and/or modify
13
+ # it under the terms of the GNU Lesser General Public License as published by
14
+ # the Free Software Foundation, either version 3 of the License, or
15
+ # (at your option) any later version.
16
+ #
17
+ # This program is distributed in the hope that it will be useful,
18
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ # GNU General Public License for more details.
21
+ #
22
+ # You should have received a copy of the GNU Lesser General Public License
23
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
24
+
25
+
26
+ torch_compile_options = {'epilogue_fusion': True, 'max_autotune': False, 'shape_padding': True, 'trace.enabled': False, 'triton.cudagraphs': False, 'debug': False, 'dce': True, 'memory_planning': True, 'coordinate_descent_tuning': False, 'trace.graph_diagram': False, 'compile_threads': 4, 'group_fusion': True, 'disable_progress': True, 'verbose_progress': False, 'triton.multi_kernel': 0, 'triton.use_block_ptr': False, 'triton.enable_persistent_tma_matmul': True, 'triton.autotune_at_compile_time': False, 'triton.cooperative_reductions': False, 'cuda.compile_opt_level': '-O2', 'cuda.enable_cuda_lto': True, 'combo_kernels': False, 'benchmark_combo_kernel': True, 'combo_kernel_foreach_dynamic_shapes': True}
27
+ from torch import Tensor
28
+ import torch
29
+ import torch.nn as nn
30
+ from torch.nn import functional as F
31
+ from unsloth_zoo.temporary_patches.common import torch_compile
32
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
33
+ from peft.tuners.lora.gptq import (torch)
34
+
35
+
36
+ torch_addmm = torch.addmm
37
+ torch_add = torch.add
38
+ # @torch.compile(fullgraph = False, dynamic = True, options = torch_compile_options)
39
+ def lora_forward(result, lora_A, lora_B, dropout, x, scaling):
40
+ # Use result.dtype (bfloat16 from base layer) since x may have been cast to float32
41
+ # by _cast_input_dtype when autocast is disabled
42
+ target_dtype = result.dtype
43
+ xA = dropout(x).to(target_dtype) @ lora_A.weight.to(target_dtype).t()
44
+ # output = result + scaling * xA @ lora_B.weight.t()
45
+ shape = result.shape
46
+ output = torch_addmm(
47
+ result.view(-1, shape[-1]),
48
+ xA.view(-1, xA.shape[-1]),
49
+ lora_B.weight.to(target_dtype).t(),
50
+ alpha = scaling,
51
+ beta = 1,
52
+ ).view(shape)
53
+
54
+ bias = lora_B.bias
55
+ if bias is not None:
56
+ output = torch_add(
57
+ output,
58
+ bias.to(target_dtype),
59
+ alpha = scaling,
60
+ )
61
+ return output
62
+ pass
63
+
64
+ def unsloth_forward(self, x: torch.Tensor):
65
+ # note: logic differs from default Linear because merging is not supported
66
+ result = self.quant_linear_module(x)
67
+
68
+ if self.disable_adapters:
69
+ return result
70
+
71
+ lora_A_keys = self.lora_A.keys()
72
+
73
+ for active_adapter in self.active_adapters:
74
+ if active_adapter not in lora_A_keys:
75
+ continue
76
+ torch_result_dtype = result.dtype
77
+
78
+ lora_A = self.lora_A[active_adapter]
79
+ lora_B = self.lora_B[active_adapter]
80
+ dropout = self.lora_dropout[active_adapter]
81
+ scaling = self.scaling[active_adapter]
82
+
83
+ if not torch.is_autocast_enabled(): result, x = result.to(lora_A.weight.dtype), x.to(lora_A.weight.dtype)
84
+
85
+ if active_adapter not in self.lora_variant: # vanilla LoRA
86
+ return lora_forward(result, lora_A, lora_B, dropout, x, scaling).to(torch_result_dtype)
87
+ else:
88
+ result = self.lora_variant[active_adapter].forward(
89
+ self,
90
+ active_adapter=active_adapter,
91
+ x=x,
92
+ result=result,
93
+ )
94
+
95
+ result = result.to(torch_result_dtype)
96
+ return result
unsloth_compiled_cache/GroupNorm.py ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ 2026.6.7
3
+ 2026.6.9
4
+ 5.5.0
5
+ 1.7.0
6
+ __UNSLOTH_VERSIONING__
7
+ """
8
+
9
+ # Unsloth auto generated code
10
+ # Copyright 2023-present Daniel Han-Chen, Michael Han-Chen & the Unsloth team. All rights reserved.
11
+ #
12
+ # This program is free software: you can redistribute it and/or modify
13
+ # it under the terms of the GNU Lesser General Public License as published by
14
+ # the Free Software Foundation, either version 3 of the License, or
15
+ # (at your option) any later version.
16
+ #
17
+ # This program is distributed in the hope that it will be useful,
18
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ # GNU General Public License for more details.
21
+ #
22
+ # You should have received a copy of the GNU Lesser General Public License
23
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
24
+
25
+
26
+ import os
27
+ import sys
28
+ import torch
29
+ import importlib.util
30
+ import math
31
+ if importlib.util.find_spec("unsloth_studio") is None:
32
+ UNSLOTH_STUDIO_ENABLED = False
33
+ else:
34
+ UNSLOTH_STUDIO_ENABLED = os.environ.get("UNSLOTH_STUDIO_DISABLED", "0") == "0"
35
+ pass
36
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
37
+ import math
38
+
39
+ UNSLOTH_ENABLE_LOGGING = os.environ.get("UNSLOTH_ENABLE_LOGGING", "0") == "1"
40
+ UNSLOTH_ENABLE_CCE = os.environ.get("UNSLOTH_ENABLE_CCE", "1") == "1"
41
+ UNSLOTH_COMPILE_DISABLE = os.environ.get("UNSLOTH_COMPILE_DISABLE", "0") in ("1", "partial",)
42
+ UNSLOTH_COMPILE_LOCATION = os.environ.get("UNSLOTH_COMPILE_LOCATION", "unsloth_compiled_cache")
43
+ if UNSLOTH_COMPILE_LOCATION not in sys.path:
44
+ sys.path.insert(0, UNSLOTH_COMPILE_LOCATION)
45
+
46
+ import logging
47
+ logger_compiler = logging.getLogger(__name__)
48
+ if UNSLOTH_ENABLE_LOGGING:
49
+ logger_compiler.setLevel(logging.DEBUG)
50
+
51
+ global INFERENCE_RUNS
52
+ INFERENCE_RUNS = 0
53
+
54
+ try:
55
+ import torch._dynamo.eval_frame as torch_dynamo_eval_frame
56
+ torch_dynamo_eval_frame._stance.stance
57
+ torch_compiler_set_stance = torch.compiler.set_stance
58
+ except:
59
+ torch_dynamo_eval_frame = None
60
+ torch_compiler_set_stance = None
61
+ pass
62
+
63
+ from unsloth_zoo import DEVICE_TYPE_TORCH, DEVICE_COUNT
64
+
65
+ torch_compile_options = {'epilogue_fusion': True, 'max_autotune': False, 'shape_padding': True, 'trace.enabled': False, 'triton.cudagraphs': False, 'debug': False, 'dce': True, 'memory_planning': True, 'coordinate_descent_tuning': False, 'trace.graph_diagram': False, 'compile_threads': 4, 'group_fusion': True, 'disable_progress': True, 'verbose_progress': False, 'triton.multi_kernel': 0, 'triton.use_block_ptr': False, 'triton.enable_persistent_tma_matmul': True, 'triton.autotune_at_compile_time': False, 'triton.cooperative_reductions': False, 'cuda.compile_opt_level': '-O2', 'cuda.enable_cuda_lto': True, 'combo_kernels': False, 'benchmark_combo_kernel': True, 'combo_kernel_foreach_dynamic_shapes': True}
66
+ from torch import Tensor
67
+ import torch
68
+ import torch.nn as nn
69
+ from torch.nn import functional as F
70
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
71
+ from transformers.models.gemma4.modeling_gemma4 import (F)
72
+
73
+ def forward(self, input: Tensor) -> Tensor:
74
+ return F.group_norm(input, self.num_groups, self.weight, self.bias, self.eps).to(input.dtype).to(input.dtype)
unsloth_compiled_cache/LayerNorm.py ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ 2026.6.7
3
+ 2026.6.9
4
+ 5.5.0
5
+ 1.7.0
6
+ __UNSLOTH_VERSIONING__
7
+ """
8
+
9
+ # Unsloth auto generated code
10
+ # Copyright 2023-present Daniel Han-Chen, Michael Han-Chen & the Unsloth team. All rights reserved.
11
+ #
12
+ # This program is free software: you can redistribute it and/or modify
13
+ # it under the terms of the GNU Lesser General Public License as published by
14
+ # the Free Software Foundation, either version 3 of the License, or
15
+ # (at your option) any later version.
16
+ #
17
+ # This program is distributed in the hope that it will be useful,
18
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ # GNU General Public License for more details.
21
+ #
22
+ # You should have received a copy of the GNU Lesser General Public License
23
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
24
+
25
+
26
+ import os
27
+ import sys
28
+ import torch
29
+ import importlib.util
30
+ import math
31
+ if importlib.util.find_spec("unsloth_studio") is None:
32
+ UNSLOTH_STUDIO_ENABLED = False
33
+ else:
34
+ UNSLOTH_STUDIO_ENABLED = os.environ.get("UNSLOTH_STUDIO_DISABLED", "0") == "0"
35
+ pass
36
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
37
+ import math
38
+
39
+ UNSLOTH_ENABLE_LOGGING = os.environ.get("UNSLOTH_ENABLE_LOGGING", "0") == "1"
40
+ UNSLOTH_ENABLE_CCE = os.environ.get("UNSLOTH_ENABLE_CCE", "1") == "1"
41
+ UNSLOTH_COMPILE_DISABLE = os.environ.get("UNSLOTH_COMPILE_DISABLE", "0") in ("1", "partial",)
42
+ UNSLOTH_COMPILE_LOCATION = os.environ.get("UNSLOTH_COMPILE_LOCATION", "unsloth_compiled_cache")
43
+ if UNSLOTH_COMPILE_LOCATION not in sys.path:
44
+ sys.path.insert(0, UNSLOTH_COMPILE_LOCATION)
45
+
46
+ import logging
47
+ logger_compiler = logging.getLogger(__name__)
48
+ if UNSLOTH_ENABLE_LOGGING:
49
+ logger_compiler.setLevel(logging.DEBUG)
50
+
51
+ global INFERENCE_RUNS
52
+ INFERENCE_RUNS = 0
53
+
54
+ try:
55
+ import torch._dynamo.eval_frame as torch_dynamo_eval_frame
56
+ torch_dynamo_eval_frame._stance.stance
57
+ torch_compiler_set_stance = torch.compiler.set_stance
58
+ except:
59
+ torch_dynamo_eval_frame = None
60
+ torch_compiler_set_stance = None
61
+ pass
62
+
63
+ from unsloth_zoo import DEVICE_TYPE_TORCH, DEVICE_COUNT
64
+
65
+ torch_compile_options = {'epilogue_fusion': True, 'max_autotune': False, 'shape_padding': True, 'trace.enabled': False, 'triton.cudagraphs': False, 'debug': False, 'dce': True, 'memory_planning': True, 'coordinate_descent_tuning': False, 'trace.graph_diagram': False, 'compile_threads': 4, 'group_fusion': True, 'disable_progress': True, 'verbose_progress': False, 'triton.multi_kernel': 0, 'triton.use_block_ptr': False, 'triton.enable_persistent_tma_matmul': True, 'triton.autotune_at_compile_time': False, 'triton.cooperative_reductions': False, 'cuda.compile_opt_level': '-O2', 'cuda.enable_cuda_lto': True, 'combo_kernels': False, 'benchmark_combo_kernel': True, 'combo_kernel_foreach_dynamic_shapes': True}
66
+ from torch import Tensor
67
+ import torch
68
+ import torch.nn as nn
69
+ from torch.nn import functional as F
70
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
71
+ from transformers.models.gemma4.modeling_gemma4 import (F)
72
+
73
+ def forward(self, input: Tensor) -> Tensor:
74
+ return F.layer_norm(
75
+ input, self.normalized_shape, self.weight, self.bias, self.eps
76
+ ).to(input.dtype).to(input.dtype)
unsloth_compiled_cache/Linear4bit_peft_forward.py ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ 2026.6.7
3
+ 2026.6.9
4
+ 5.5.0
5
+ 1.7.0
6
+ __UNSLOTH_VERSIONING__
7
+ """
8
+
9
+ # Unsloth auto generated code
10
+ # Copyright 2023-present Daniel Han-Chen, Michael Han-Chen & the Unsloth team. All rights reserved.
11
+ #
12
+ # This program is free software: you can redistribute it and/or modify
13
+ # it under the terms of the GNU Lesser General Public License as published by
14
+ # the Free Software Foundation, either version 3 of the License, or
15
+ # (at your option) any later version.
16
+ #
17
+ # This program is distributed in the hope that it will be useful,
18
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ # GNU General Public License for more details.
21
+ #
22
+ # You should have received a copy of the GNU Lesser General Public License
23
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
24
+
25
+
26
+ try:
27
+ from peft.tuners.lora.layer import VARIANT_KWARG_KEYS
28
+ except ImportError:
29
+ VARIANT_KWARG_KEYS = ['alora_offsets']
30
+ torch_compile_options = {'epilogue_fusion': True, 'max_autotune': False, 'shape_padding': True, 'trace.enabled': False, 'triton.cudagraphs': False, 'debug': False, 'dce': True, 'memory_planning': True, 'coordinate_descent_tuning': False, 'trace.graph_diagram': False, 'compile_threads': 4, 'group_fusion': True, 'disable_progress': True, 'verbose_progress': False, 'triton.multi_kernel': 0, 'triton.use_block_ptr': False, 'triton.enable_persistent_tma_matmul': True, 'triton.autotune_at_compile_time': False, 'triton.cooperative_reductions': False, 'cuda.compile_opt_level': '-O2', 'cuda.enable_cuda_lto': True, 'combo_kernels': False, 'benchmark_combo_kernel': True, 'combo_kernel_foreach_dynamic_shapes': True}
31
+ from torch import Tensor
32
+ import torch
33
+ import torch.nn as nn
34
+ from torch.nn import functional as F
35
+ from unsloth_zoo.temporary_patches.common import torch_compile
36
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
37
+ from peft.tuners.lora.bnb import (VARIANT_KWARG_KEYS, torch)
38
+
39
+
40
+ torch_addmm = torch.addmm
41
+ torch_add = torch.add
42
+ # @torch.compile(fullgraph = False, dynamic = True, options = torch_compile_options)
43
+ def lora_forward(result, lora_A, lora_B, dropout, x, scaling):
44
+ # Use result.dtype (bfloat16 from base layer) since x may have been cast to float32
45
+ # by _cast_input_dtype when autocast is disabled
46
+ target_dtype = result.dtype
47
+ xA = dropout(x).to(target_dtype) @ lora_A.weight.to(target_dtype).t()
48
+ # output = result + scaling * xA @ lora_B.weight.t()
49
+ shape = result.shape
50
+ output = torch_addmm(
51
+ result.view(-1, shape[-1]),
52
+ xA.view(-1, xA.shape[-1]),
53
+ lora_B.weight.to(target_dtype).t(),
54
+ alpha = scaling,
55
+ beta = 1,
56
+ ).view(shape)
57
+
58
+ bias = lora_B.bias
59
+ if bias is not None:
60
+ output = torch_add(
61
+ output,
62
+ bias.to(target_dtype),
63
+ alpha = scaling,
64
+ )
65
+ return output
66
+ pass
67
+
68
+ def unsloth_forward(self, x: torch.Tensor, *args, **kwargs) -> torch.Tensor:
69
+
70
+ adapter_names = kwargs.pop("adapter_names", None)
71
+ variant_kwargs = {k: kwargs.pop(k, None) for k in VARIANT_KWARG_KEYS} # don't pass these to base_layer
72
+
73
+ if self.disable_adapters:
74
+ if self.merged:
75
+ self.unmerge()
76
+ if not torch.is_autocast_enabled() and hasattr(self.base_layer, 'weight') and self.base_layer.weight is not None and not hasattr(self.base_layer.weight, 'quant_state') and x.dtype != self.base_layer.weight.dtype:
77
+ x = x.to(self.base_layer.weight.dtype)
78
+ result = self.base_layer(x, *args, **kwargs)
79
+ elif adapter_names is not None:
80
+ result = self._mixed_batch_forward(x, *args, adapter_names=adapter_names, **variant_kwargs, **kwargs)
81
+ elif self.merged:
82
+ if not torch.is_autocast_enabled() and hasattr(self.base_layer, 'weight') and self.base_layer.weight is not None and not hasattr(self.base_layer.weight, 'quant_state') and x.dtype != self.base_layer.weight.dtype:
83
+ x = x.to(self.base_layer.weight.dtype)
84
+ result = self.base_layer(x, *args, **kwargs)
85
+ else:
86
+ if not torch.is_autocast_enabled() and hasattr(self.base_layer, 'weight') and self.base_layer.weight is not None and not hasattr(self.base_layer.weight, 'quant_state') and x.dtype != self.base_layer.weight.dtype:
87
+ x = x.to(self.base_layer.weight.dtype)
88
+ result = self.base_layer(x, *args, **kwargs)
89
+ # As per Tim Dettmers, for 4bit, we need to defensively clone here.
90
+ # The reason is that in some cases, an error can occur that backprop
91
+ # does not work on a manipulated view. This issue may be solved with
92
+ # newer PyTorch versions but this would need extensive testing to be
93
+ # sure.
94
+
95
+
96
+ for active_adapter in self.active_adapters:
97
+ if active_adapter not in self.lora_A.keys():
98
+ continue
99
+ lora_A = self.lora_A[active_adapter]
100
+ lora_B = self.lora_B[active_adapter]
101
+ dropout = self.lora_dropout[active_adapter]
102
+ scaling = self.scaling[active_adapter]
103
+
104
+ requires_conversion = not torch.is_autocast_enabled()
105
+ if requires_conversion:
106
+ expected_dtype = result.dtype
107
+ x = self._cast_input_dtype(x, lora_A.weight.dtype)
108
+
109
+ if active_adapter not in self.lora_variant: # vanilla LoRA
110
+ return lora_forward(result, lora_A, lora_B, dropout, x, scaling).to(result.dtype)
111
+ if requires_conversion:
112
+ output = output.to(expected_dtype)
113
+ result = result + output
114
+ else:
115
+ result = self.lora_variant[active_adapter].forward(
116
+ self,
117
+ active_adapter=active_adapter,
118
+ x=x,
119
+ result=result,
120
+ **variant_kwargs,
121
+ **kwargs,
122
+ )
123
+ if requires_conversion:
124
+ result = result.to(expected_dtype)
125
+
126
+ return result
unsloth_compiled_cache/Linear8bitLt_peft_forward.py ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ 2026.6.7
3
+ 2026.6.9
4
+ 5.5.0
5
+ 1.7.0
6
+ __UNSLOTH_VERSIONING__
7
+ """
8
+
9
+ # Unsloth auto generated code
10
+ # Copyright 2023-present Daniel Han-Chen, Michael Han-Chen & the Unsloth team. All rights reserved.
11
+ #
12
+ # This program is free software: you can redistribute it and/or modify
13
+ # it under the terms of the GNU Lesser General Public License as published by
14
+ # the Free Software Foundation, either version 3 of the License, or
15
+ # (at your option) any later version.
16
+ #
17
+ # This program is distributed in the hope that it will be useful,
18
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ # GNU General Public License for more details.
21
+ #
22
+ # You should have received a copy of the GNU Lesser General Public License
23
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
24
+
25
+
26
+ try:
27
+ from peft.tuners.lora.layer import VARIANT_KWARG_KEYS
28
+ except ImportError:
29
+ VARIANT_KWARG_KEYS = ['alora_offsets']
30
+ torch_compile_options = {'epilogue_fusion': True, 'max_autotune': False, 'shape_padding': True, 'trace.enabled': False, 'triton.cudagraphs': False, 'debug': False, 'dce': True, 'memory_planning': True, 'coordinate_descent_tuning': False, 'trace.graph_diagram': False, 'compile_threads': 4, 'group_fusion': True, 'disable_progress': True, 'verbose_progress': False, 'triton.multi_kernel': 0, 'triton.use_block_ptr': False, 'triton.enable_persistent_tma_matmul': True, 'triton.autotune_at_compile_time': False, 'triton.cooperative_reductions': False, 'cuda.compile_opt_level': '-O2', 'cuda.enable_cuda_lto': True, 'combo_kernels': False, 'benchmark_combo_kernel': True, 'combo_kernel_foreach_dynamic_shapes': True}
31
+
32
+ import torch._dynamo
33
+ @torch._dynamo.disable
34
+ def _call_8bit_base_layer(base_layer, x, *args, **kwargs):
35
+ return base_layer(x, *args, **kwargs)
36
+ from torch import Tensor
37
+ import torch
38
+ import torch.nn as nn
39
+ from torch.nn import functional as F
40
+ from unsloth_zoo.temporary_patches.common import torch_compile
41
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
42
+ from peft.tuners.lora.bnb import (VARIANT_KWARG_KEYS, torch)
43
+
44
+
45
+ torch_addmm = torch.addmm
46
+ torch_add = torch.add
47
+ # @torch.compile(fullgraph = False, dynamic = True, options = torch_compile_options)
48
+ def lora_forward(result, lora_A, lora_B, dropout, x, scaling):
49
+ # Use result.dtype (bfloat16 from base layer) since x may have been cast to float32
50
+ # by _cast_input_dtype when autocast is disabled
51
+ target_dtype = result.dtype
52
+ xA = dropout(x).to(target_dtype) @ lora_A.weight.to(target_dtype).t()
53
+ # output = result + scaling * xA @ lora_B.weight.t()
54
+ shape = result.shape
55
+ output = torch_addmm(
56
+ result.view(-1, shape[-1]),
57
+ xA.view(-1, xA.shape[-1]),
58
+ lora_B.weight.to(target_dtype).t(),
59
+ alpha = scaling,
60
+ beta = 1,
61
+ ).view(shape)
62
+
63
+ bias = lora_B.bias
64
+ if bias is not None:
65
+ output = torch_add(
66
+ output,
67
+ bias.to(target_dtype),
68
+ alpha = scaling,
69
+ )
70
+ return output
71
+ pass
72
+
73
+ def unsloth_forward(self, x: torch.Tensor, *args, **kwargs) -> torch.Tensor:
74
+
75
+ adapter_names = kwargs.pop("adapter_names", None)
76
+ variant_kwargs = {k: kwargs.pop(k, None) for k in VARIANT_KWARG_KEYS} # don't pass these to base_layer
77
+
78
+ if self.disable_adapters:
79
+ if self.merged:
80
+ self.unmerge()
81
+ result = _call_8bit_base_layer(self.base_layer, x, *args, **kwargs)
82
+ elif adapter_names is not None:
83
+ result = self._mixed_batch_forward(x, *args, adapter_names=adapter_names, **variant_kwargs, **kwargs)
84
+ elif self.merged:
85
+ result = _call_8bit_base_layer(self.base_layer, x, *args, **kwargs)
86
+ else:
87
+ result = _call_8bit_base_layer(self.base_layer, x, *args, **kwargs)
88
+ for active_adapter in self.active_adapters:
89
+ if active_adapter not in self.lora_A.keys():
90
+ continue
91
+ lora_A = self.lora_A[active_adapter]
92
+ lora_B = self.lora_B[active_adapter]
93
+ dropout = self.lora_dropout[active_adapter]
94
+ scaling = self.scaling[active_adapter]
95
+
96
+ requires_conversion = not torch.is_autocast_enabled()
97
+ if requires_conversion:
98
+ expected_dtype = result.dtype
99
+ x = self._cast_input_dtype(x, lora_A.weight.dtype)
100
+
101
+ if active_adapter not in self.lora_variant: # vanilla LoRA
102
+ return lora_forward(result, lora_A, lora_B, dropout, x, scaling).to(result.dtype)
103
+ if requires_conversion:
104
+ output = output.to(expected_dtype)
105
+ result = result + output
106
+ else:
107
+ result = self.lora_variant[active_adapter].forward(
108
+ self,
109
+ active_adapter=active_adapter,
110
+ x=x,
111
+ result=result,
112
+ **variant_kwargs,
113
+ **kwargs,
114
+ )
115
+ if requires_conversion:
116
+ result = result.to(expected_dtype)
117
+
118
+ return result
unsloth_compiled_cache/Linear_peft_forward.py ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ 2026.6.7
3
+ 2026.6.9
4
+ 5.5.0
5
+ 1.7.0
6
+ __UNSLOTH_VERSIONING__
7
+ """
8
+
9
+ # Unsloth auto generated code
10
+ # Copyright 2023-present Daniel Han-Chen, Michael Han-Chen & the Unsloth team. All rights reserved.
11
+ #
12
+ # This program is free software: you can redistribute it and/or modify
13
+ # it under the terms of the GNU Lesser General Public License as published by
14
+ # the Free Software Foundation, either version 3 of the License, or
15
+ # (at your option) any later version.
16
+ #
17
+ # This program is distributed in the hope that it will be useful,
18
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ # GNU General Public License for more details.
21
+ #
22
+ # You should have received a copy of the GNU Lesser General Public License
23
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
24
+
25
+
26
+ try:
27
+ from peft.tuners.lora.layer import VARIANT_KWARG_KEYS
28
+ except ImportError:
29
+ VARIANT_KWARG_KEYS = ['alora_offsets']
30
+ torch_compile_options = {'epilogue_fusion': True, 'max_autotune': False, 'shape_padding': True, 'trace.enabled': False, 'triton.cudagraphs': False, 'debug': False, 'dce': True, 'memory_planning': True, 'coordinate_descent_tuning': False, 'trace.graph_diagram': False, 'compile_threads': 4, 'group_fusion': True, 'disable_progress': True, 'verbose_progress': False, 'triton.multi_kernel': 0, 'triton.use_block_ptr': False, 'triton.enable_persistent_tma_matmul': True, 'triton.autotune_at_compile_time': False, 'triton.cooperative_reductions': False, 'cuda.compile_opt_level': '-O2', 'cuda.enable_cuda_lto': True, 'combo_kernels': False, 'benchmark_combo_kernel': True, 'combo_kernel_foreach_dynamic_shapes': True}
31
+ from torch import Tensor
32
+ import torch
33
+ import torch.nn as nn
34
+ from torch.nn import functional as F
35
+ from unsloth_zoo.temporary_patches.common import torch_compile
36
+ from typing import Any, List, Optional, Tuple, Union, Dict, Set, Callable
37
+ from peft.tuners.lora.variants import (Any, torch)
38
+
39
+
40
+ torch_addmm = torch.addmm
41
+ torch_add = torch.add
42
+ # @torch.compile(fullgraph = False, dynamic = True, options = torch_compile_options)
43
+ def lora_forward(result, lora_A, lora_B, dropout, x, scaling):
44
+ # Use result.dtype (bfloat16 from base layer) since x may have been cast to float32
45
+ # by _cast_input_dtype when autocast is disabled
46
+ target_dtype = result.dtype
47
+ xA = dropout(x).to(target_dtype) @ lora_A.weight.to(target_dtype).t()
48
+ # output = result + scaling * xA @ lora_B.weight.t()
49
+ shape = result.shape
50
+ output = torch_addmm(
51
+ result.view(-1, shape[-1]),
52
+ xA.view(-1, xA.shape[-1]),
53
+ lora_B.weight.to(target_dtype).t(),
54
+ alpha = scaling,
55
+ beta = 1,
56
+ ).view(shape)
57
+
58
+ bias = lora_B.bias
59
+ if bias is not None:
60
+ output = torch_add(
61
+ output,
62
+ bias.to(target_dtype),
63
+ alpha = scaling,
64
+ )
65
+ return output
66
+ pass
67
+
68
+ def unsloth_forward(self, x: torch.Tensor, *args: Any, **kwargs: Any) -> torch.Tensor:
69
+
70
+ adapter_names = kwargs.pop("adapter_names", None)
71
+ variant_kwargs = {k: kwargs.pop(k, None) for k in VARIANT_KWARG_KEYS} # don't pass these to base_layer
72
+
73
+ if self.disable_adapters:
74
+ if self.merged:
75
+ self.unmerge()
76
+ if not torch.is_autocast_enabled() and hasattr(self.base_layer, 'weight') and self.base_layer.weight is not None and not hasattr(self.base_layer.weight, 'quant_state') and x.dtype != self.base_layer.weight.dtype:
77
+ x = x.to(self.base_layer.weight.dtype)
78
+ result = self.base_layer(x, *args, **kwargs)
79
+ elif adapter_names is not None:
80
+ result = self._mixed_batch_forward(x, *args, adapter_names=adapter_names, **variant_kwargs, **kwargs)
81
+ elif self.merged:
82
+ if not torch.is_autocast_enabled() and hasattr(self.base_layer, 'weight') and self.base_layer.weight is not None and not hasattr(self.base_layer.weight, 'quant_state') and x.dtype != self.base_layer.weight.dtype:
83
+ x = x.to(self.base_layer.weight.dtype)
84
+ result = self.base_layer(x, *args, **kwargs)
85
+ else:
86
+ if not torch.is_autocast_enabled() and hasattr(self.base_layer, 'weight') and self.base_layer.weight is not None and not hasattr(self.base_layer.weight, 'quant_state') and x.dtype != self.base_layer.weight.dtype:
87
+ x = x.to(self.base_layer.weight.dtype)
88
+ result = self.base_layer(x, *args, **kwargs)
89
+ torch_result_dtype = result.dtype
90
+
91
+ lora_A_keys = self.lora_A.keys()
92
+ for active_adapter in self.active_adapters:
93
+ if active_adapter not in lora_A_keys:
94
+ continue
95
+
96
+ lora_A = self.lora_A[active_adapter]
97
+ lora_B = self.lora_B[active_adapter]
98
+ dropout = self.lora_dropout[active_adapter]
99
+ scaling = self.scaling[active_adapter]
100
+ if not torch.is_autocast_enabled(): result, x = result.to(lora_A.weight.dtype), x.to(lora_A.weight.dtype)
101
+ if active_adapter not in self.lora_variant: # vanilla LoRA
102
+ return lora_forward(result, lora_A, lora_B, dropout, x, scaling).to(torch_result_dtype)
103
+ else:
104
+ result = self.lora_variant[active_adapter].forward(
105
+ self,
106
+ active_adapter=active_adapter,
107
+ x=x,
108
+ result=result,
109
+ **variant_kwargs,
110
+ **kwargs,
111
+ )
112
+
113
+ result = result.to(torch_result_dtype)
114
+
115
+ return result