Sothay commited on
Commit
76f76f8
·
verified ·
1 Parent(s): 077b045

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ 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
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,181 +1,210 @@
1
  ---
2
- license: gemma
 
3
  pipeline_tag: text-generation
4
- language:
5
- - en
6
- - km
7
  tags:
8
- - customs
9
- - hs-code
10
- - classification
11
- - cambodia
12
- - gemma
13
  - unsloth
14
- - qlora
15
- base_model:
16
- - unsloth/gemma-4-E4B-it
17
  ---
18
 
19
- # Gemma‑4 HS Code Classifier (Cambodia Customs)
20
 
21
- A **Gemma‑4‑E4B‑it** model fine‑tuned with QLoRA to classify product descriptions into **8‑digit HS codes** and return corresponding Cambodian trade rates (Customs Duty, Special Tax, VAT, Excise Tax).
22
 
23
- Built with **[Unsloth](https://github.com/unslothai/unsloth)** for fast, memory‑efficient fine‑tuning on a single T4 GPU.
24
 
25
- ---
26
 
27
- ## 🎯 What it does
28
 
29
- Given a plain‑English product description, the model generates:
30
 
31
- ```text
32
- HS Code: 61091000
33
- Unit: PIECE
34
- Customs Duty: 25%
35
- Special Tax: 0%
36
- VAT: 10%
37
- Excise Tax: 0%
38
- ```
39
 
40
- **⚠️ Important**: The rates in the text are generated by the model and **may be wrong**.
41
- For production, always use the included **lookup table** (`hs_code_lookup.json`) – see [Production use](#-production-use) below.
42
 
43
- ---
44
 
45
- ## 🚀 Quick start (in Colab or locally)
46
-
47
- This repository contains **only the LoRA adapter**, not the full model.
48
- Loading it will automatically download the base model (`unsloth/gemma-4-E4B-it`) and apply the adapter in 4-bit.
49
-
50
- ```python
51
- from unsloth import FastModel
52
-
53
- model, tokenizer = FastModel.from_pretrained(
54
- "Sothay/gemma4-hscode-classifier", # LoRA adapter on Hugging Face
55
- load_in_4bit = True, # required – the adapter was trained in 4-bit
56
- max_seq_length = 1024,
57
- )
58
-
59
- # ---------- Inference with the authoritative lookup table (recommended) ----------
60
- import json, re
61
-
62
- with open("hs_code_lookup.json") as f:
63
- rate_lookup = json.load(f)
64
-
65
- def predict_hs_code(description: str) -> dict:
66
- system_prompt = (
67
- "You are a customs compliance AI. Classify the product description to its "
68
- "correct 8-digit HS code and output the corresponding trade rates (Customs Duty, "
69
- "Special Tax, VAT, Excise Tax) and unit."
70
- )
71
- messages = [
72
- {"role": "system", "content": [{"type": "text", "text": system_prompt}]},
73
- {"role": "user", "content": [{"type": "text", "text": f"Description: {description}"}]},
74
- ]
75
- inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to("cuda")
76
- out = model.generate(inputs, max_new_tokens=80, do_sample=False)
77
- text = tokenizer.decode(out[0][inputs.shape[1]:], skip_special_tokens=True)
78
-
79
- m = re.search(r"HS Code:\s*([0-9]{4,10})", text)
80
- code = m.group(1) if m else None
81
- if code and code in rate_lookup:
82
- return {"hs_code": code, "source": "lookup_table", **rate_lookup[code]}
83
- return {"hs_code": code, "source": "model_only_UNVERIFIED", "raw_output": text}
84
-
85
- print(predict_hs_code("Men's cotton knitted T-shirt"))
86
- ```
87
 
88
- ---
89
 
90
- ## 🧠 Training details
91
 
92
- - **Base model**: `unsloth/gemma-4-E4B-it` (4‑bit QLoRA)
93
- - **Adapter rank**: r=16, alpha=16, targeting all language & attention layers
94
- - **Gradient checkpointing**: Unsloth’s own implementation (avoids Gemma‑4 KV‑shared layer bug)
95
- - **Dataset**: Custom Cambodian HS‑code dataset (`hs_code.csv`) with descriptions, codes, and official rates
96
- - Cleaned, deduplicated, split into 90/10 train/validation
97
- - Chat roles fixed to system/user/assistant (Gemma‑4 standard)
98
- - **Training config**: 3 epochs, effective batch size 8, learning rate 2e‑4, linear schedule, eval & save every epoch, best model loaded
99
- - **Hardware**: Google Colab T4 (16 GB) – peak memory ~10 GB thanks to QLoRA
100
- - **Accuracy**: Evaluated on held‑out examples (exact HS‑code match) – see model card for current numbers
101
 
102
- ---
103
 
104
- ## ⚖️ Production use
105
 
106
- > **Always use the lookup table – never trust the model’s generated rates.**
107
 
108
- The model is a **classifier**: description HS code.
109
- Rates are fetched deterministically from `hs_code_lookup.json`, a file extracted from the same official tariff data used during training.
110
 
111
- Why?
112
- - A causal LM recalling a rate from memory will occasionally hallucinate – a customs tool with confident, wrong numbers is worse than one that says “I don’t know”.
113
- - The lookup table guarantees 100% accuracy on rates once the HS code is correct.
114
 
115
- The `hs_code_lookup.json` file is included in this repository and can be downloaded via:
116
 
117
- ```python
118
- from huggingface_hub import hf_hub_download
119
- hf_hub_download("Sothay/gemma4-hscode-classifier", "hs_code_lookup.json")
120
- ```
121
 
122
- ---
123
 
124
- ## 📦 Files in this repository
125
 
126
- | File | Description |
127
- |------|-------------|
128
- | `adapter_model.safetensors` | LoRA adapter weights (few MB) |
129
- | `adapter_config.json` | Adapter configuration (references base model) |
130
- | `tokenizer.json`, `tokenizer_config.json` | Tokenizer files |
131
- | `hs_code_lookup.json` | Authoritative rate table for production inference |
132
- | `README.md` | This file |
133
 
134
- > **Note**: Only the adapter is stored here – the full Gemma‑4 base model is automatically fetched from Unsloth when you call `FastModel.from_pretrained`.
135
- > If you need a **merged, full‑precision model** (for vLLM, TGI, etc.), generate it locally with Unsloth:
136
- > ```python
137
- > model.save_pretrained_merged("merged_fp16", tokenizer, save_method="merged_16bit")
138
- > ```
139
 
140
- ---
141
 
142
- ## 🦙 Ollama / llama.cpp (GGUF)
143
 
144
- Export a quantized GGUF directly from the loaded adapter:
145
 
146
- ```python
147
- model.save_pretrained_gguf("gguf_model", tokenizer, quantization_method="q4_k_m")
148
- ```
149
 
150
- Then use with Ollama (see [`Modelfile` example](https://ollama.com) set temperature 0, deterministic sampling).
151
 
152
- ---
153
 
154
- ## 📊 Example predictions
155
 
156
- | Description | Predicted HS Code | Unit | CD | ST | VAT | ET |
157
- |-------------|-------------------|------|----|----|-----|----|
158
- | Toyota Hilux pickup, diesel 2.8L | 8704 | u | 35% | 50% | 10% | 0% |
159
- | iPhone 15 Pro Max 256GB | 8517 | u | 0% | 0% | 10% | 0% |
160
- | Heineken beer 330ml can | 2203 | l | 35% | 30% | 10% | 0% |
161
 
162
- *(Rates from lookup table – not generated by the model.)*
163
 
164
- ---
165
 
166
- ## 📝 License
167
 
168
- This model is a derivative of **Gemma‑4‑E4B‑it** and is subject to the [Gemma license](https://ai.google.dev/gemma/terms).
169
- The HS‑code dataset and lookup table are the property of their respective owners.
170
 
171
- ---
172
 
173
- ## 🙏 Acknowledgments
174
 
175
- - [Unsloth](https://github.com/unslothai/unsloth) made QLoRA + Gemma‑4 on a T4 effortless
176
- - [Google DeepMind](https://deepmind.google) – for the Gemma family of models
177
 
178
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
 
180
- **Author**: [Sothay](https://huggingface.co/Sothay)
181
- **Model card version**: 1.1
 
1
  ---
2
+ base_model: unsloth/gemma-4-e4b-it-unsloth-bnb-4bit
3
+ library_name: peft
4
  pipeline_tag: text-generation
 
 
 
5
  tags:
6
+ - base_model:adapter:unsloth/gemma-4-e4b-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
 
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-e4b-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": 16,
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": 16,
34
+ "rank_pattern": {},
35
+ "revision": null,
36
+ "target_modules": "(?:.*?(?:language|text).*?(?:self_attn|attention|attn|mixer|mlp|feed_forward|ffn|dense|mixer).*?(?:k_proj|q_proj|v_proj|o_proj|gate_proj|up_proj|down_proj|per_layer_input_gate|per_layer_projection|linear|embedding_projection|relative_k_proj))|(?:\\bmodel\\.layers\\.[\\d]{1,}\\.(?:self_attn|attention|attn|mixer|mlp|feed_forward|ffn|dense|mixer)\\.(?:(?:k_proj|q_proj|v_proj|o_proj|gate_proj|up_proj|down_proj|per_layer_input_gate|per_layer_projection|linear|embedding_projection|relative_k_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
+ }
adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bba0d91e84702ea1f3e70ef79b9bc6cad1609565db42f57222fc8c51a64ef153
3
+ size 146888168
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 -%}
processor_config.json ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "audio_ms_per_token": 40,
3
+ "audio_seq_length": 750,
4
+ "feature_extractor": {
5
+ "dither": 0.0,
6
+ "feature_extractor_type": "Gemma4AudioFeatureExtractor",
7
+ "feature_size": 128,
8
+ "fft_length": 512,
9
+ "fft_overdrive": false,
10
+ "frame_length": 320,
11
+ "hop_length": 160,
12
+ "input_scale_factor": 1.0,
13
+ "max_frequency": 8000.0,
14
+ "mel_floor": 0.001,
15
+ "min_frequency": 0.0,
16
+ "padding_side": "right",
17
+ "padding_value": 0.0,
18
+ "per_bin_mean": null,
19
+ "per_bin_stddev": null,
20
+ "preemphasis": 0.0,
21
+ "preemphasis_htk_flavor": true,
22
+ "return_attention_mask": true,
23
+ "sampling_rate": 16000
24
+ },
25
+ "image_processor": {
26
+ "do_convert_rgb": true,
27
+ "do_normalize": false,
28
+ "do_rescale": true,
29
+ "do_resize": true,
30
+ "image_mean": [
31
+ 0.0,
32
+ 0.0,
33
+ 0.0
34
+ ],
35
+ "image_processor_type": "Gemma4ImageProcessor",
36
+ "image_seq_length": 280,
37
+ "image_std": [
38
+ 1.0,
39
+ 1.0,
40
+ 1.0
41
+ ],
42
+ "max_soft_tokens": 280,
43
+ "patch_size": 16,
44
+ "pooling_kernel_size": 3,
45
+ "resample": 3,
46
+ "rescale_factor": 0.00392156862745098
47
+ },
48
+ "image_seq_length": 280,
49
+ "processor_class": "Gemma4Processor",
50
+ "video_processor": {
51
+ "do_convert_rgb": true,
52
+ "do_normalize": true,
53
+ "do_rescale": true,
54
+ "do_resize": true,
55
+ "do_sample_frames": true,
56
+ "image_mean": [
57
+ 0.0,
58
+ 0.0,
59
+ 0.0
60
+ ],
61
+ "image_std": [
62
+ 1.0,
63
+ 1.0,
64
+ 1.0
65
+ ],
66
+ "max_soft_tokens": 70,
67
+ "num_frames": 32,
68
+ "patch_size": 16,
69
+ "pooling_kernel_size": 3,
70
+ "resample": 3,
71
+ "rescale_factor": 0.00392156862745098,
72
+ "return_metadata": false,
73
+ "video_processor_type": "Gemma4VideoProcessor"
74
+ }
75
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cc8d3a0ce36466ccc1278bf987df5f71db1719b9ca6b4118264f45cb627bfe0f
3
+ size 32169626
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
+ }