Regenerate tiny gemma4 from google/gemma-4-E2B-it with non-degenerate outputs
Browse filesRebuilt with wider output-side initialization (std=0.2 on embed_tokens, embed_tokens_per_layer and the vision/audio embedding projections) so the logits no longer sit near a constant vector.
Measured on an image+text prompt, previous revision -> this one:
logit std 0.113 -> 1.130
min per-position std 0.113 -> 1.126
distinct argmax positions 24/273 -> 65/273
sensitivity to the image 0.060 -> 4.66
NaN / Inf 0 / 0 -> 0 / 0
Config fixes toward the original architecture: num_key_value_heads 2->1 (the original is multi-query), text global_head_dim 8->16 (the original keeps head_dim != global_head_dim), vision global_head_dim 64->8 (was left at the full-size value while head_dim was 8), hidden_size_per_layer_input 1->4, vision default_output_length 70->280.
model_type, architectures, sub-config types, special token ids, vocab_size and the layer counts (text 3 / vision 1 / audio 1) are unchanged, so the expected INT8 node counts in tests/openvino/utils_tests.py still hold.
Validated under ONEDNN_MAX_CPU_ISA=AVX2 (the CI runners' ISA): OpenVINO export, forward and generate all pass, and 6/6 gemma4 tests in test_seq2seq.py + test_quantization.py pass.
- config.json +6 -6
- generation_config.json +1 -1
- model.safetensors +2 -2
- processor_config.json +1 -1
- tokenizer_config.json +0 -1
|
@@ -66,11 +66,11 @@
|
|
| 66 |
"eos_token_id": 1,
|
| 67 |
"expert_intermediate_size": null,
|
| 68 |
"final_logit_softcapping": 30.0,
|
| 69 |
-
"global_head_dim":
|
| 70 |
"head_dim": 8,
|
| 71 |
"hidden_activation": "gelu_pytorch_tanh",
|
| 72 |
"hidden_size": 32,
|
| 73 |
-
"hidden_size_per_layer_input":
|
| 74 |
"initializer_range": 0.02,
|
| 75 |
"intermediate_size": 64,
|
| 76 |
"layer_types": [
|
|
@@ -85,7 +85,7 @@
|
|
| 85 |
"num_experts": null,
|
| 86 |
"num_global_key_value_heads": null,
|
| 87 |
"num_hidden_layers": 3,
|
| 88 |
-
"num_key_value_heads":
|
| 89 |
"num_kv_shared_layers": 1,
|
| 90 |
"pad_token_id": 0,
|
| 91 |
"rms_norm_eps": 1e-06,
|
|
@@ -110,7 +110,7 @@
|
|
| 110 |
"vocab_size_per_layer_input": 262144
|
| 111 |
},
|
| 112 |
"tie_word_embeddings": true,
|
| 113 |
-
"transformers_version": "5.5.
|
| 114 |
"video_token_id": 258884,
|
| 115 |
"vision_config": {
|
| 116 |
"_name_or_path": "",
|
|
@@ -118,9 +118,9 @@
|
|
| 118 |
"attention_bias": false,
|
| 119 |
"attention_dropout": 0.0,
|
| 120 |
"chunk_size_feed_forward": 0,
|
| 121 |
-
"default_output_length":
|
| 122 |
"dtype": "float32",
|
| 123 |
-
"global_head_dim":
|
| 124 |
"head_dim": 8,
|
| 125 |
"hidden_activation": "gelu_pytorch_tanh",
|
| 126 |
"hidden_size": 32,
|
|
|
|
| 66 |
"eos_token_id": 1,
|
| 67 |
"expert_intermediate_size": null,
|
| 68 |
"final_logit_softcapping": 30.0,
|
| 69 |
+
"global_head_dim": 16,
|
| 70 |
"head_dim": 8,
|
| 71 |
"hidden_activation": "gelu_pytorch_tanh",
|
| 72 |
"hidden_size": 32,
|
| 73 |
+
"hidden_size_per_layer_input": 4,
|
| 74 |
"initializer_range": 0.02,
|
| 75 |
"intermediate_size": 64,
|
| 76 |
"layer_types": [
|
|
|
|
| 85 |
"num_experts": null,
|
| 86 |
"num_global_key_value_heads": null,
|
| 87 |
"num_hidden_layers": 3,
|
| 88 |
+
"num_key_value_heads": 1,
|
| 89 |
"num_kv_shared_layers": 1,
|
| 90 |
"pad_token_id": 0,
|
| 91 |
"rms_norm_eps": 1e-06,
|
|
|
|
| 110 |
"vocab_size_per_layer_input": 262144
|
| 111 |
},
|
| 112 |
"tie_word_embeddings": true,
|
| 113 |
+
"transformers_version": "5.5.4",
|
| 114 |
"video_token_id": 258884,
|
| 115 |
"vision_config": {
|
| 116 |
"_name_or_path": "",
|
|
|
|
| 118 |
"attention_bias": false,
|
| 119 |
"attention_dropout": 0.0,
|
| 120 |
"chunk_size_feed_forward": 0,
|
| 121 |
+
"default_output_length": 280,
|
| 122 |
"dtype": "float32",
|
| 123 |
+
"global_head_dim": 8,
|
| 124 |
"head_dim": 8,
|
| 125 |
"hidden_activation": "gelu_pytorch_tanh",
|
| 126 |
"hidden_size": 32,
|
|
@@ -8,6 +8,6 @@
|
|
| 8 |
"output_attentions": false,
|
| 9 |
"output_hidden_states": false,
|
| 10 |
"pad_token_id": 0,
|
| 11 |
-
"transformers_version": "5.5.
|
| 12 |
"use_cache": true
|
| 13 |
}
|
|
|
|
| 8 |
"output_attentions": false,
|
| 9 |
"output_hidden_states": false,
|
| 10 |
"pad_token_id": 0,
|
| 11 |
+
"transformers_version": "5.5.4",
|
| 12 |
"use_cache": true
|
| 13 |
}
|
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3f9988219ad792099f3cb4350a70e107f80d5804d75d4b56208fc8f7b2d9852e
|
| 3 |
+
size 49467948
|
|
@@ -13,7 +13,7 @@
|
|
| 13 |
"max_frequency": 8000.0,
|
| 14 |
"mel_floor": 0.001,
|
| 15 |
"min_frequency": 0.0,
|
| 16 |
-
"padding_side": "
|
| 17 |
"padding_value": 0.0,
|
| 18 |
"per_bin_mean": null,
|
| 19 |
"per_bin_stddev": null,
|
|
|
|
| 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,
|
|
@@ -137,6 +137,5 @@
|
|
| 137 |
"str_token": "<|tool_response>",
|
| 138 |
"think_token": "<|think|>",
|
| 139 |
"tokenizer_class": "GemmaTokenizer",
|
| 140 |
-
"truncation_side": "left",
|
| 141 |
"unk_token": "<unk>"
|
| 142 |
}
|
|
|
|
| 137 |
"str_token": "<|tool_response>",
|
| 138 |
"think_token": "<|think|>",
|
| 139 |
"tokenizer_class": "GemmaTokenizer",
|
|
|
|
| 140 |
"unk_token": "<unk>"
|
| 141 |
}
|