Initial E4B CoreML bundle — chunks, embeds, PLE, RoPE, tokenizer
Browse files- .gitattributes +1 -0
- README.md +83 -0
- chunk1.mlmodelc/analytics/coremldata.bin +3 -0
- chunk1.mlmodelc/coremldata.bin +3 -0
- chunk1.mlmodelc/model.mil +0 -0
- chunk1.mlmodelc/weights/weight.bin +3 -0
- chunk2.mlmodelc/analytics/coremldata.bin +3 -0
- chunk2.mlmodelc/coremldata.bin +3 -0
- chunk2.mlmodelc/model.mil +0 -0
- chunk2.mlmodelc/weights/weight.bin +3 -0
- chunk3.mlmodelc/analytics/coremldata.bin +3 -0
- chunk3.mlmodelc/coremldata.bin +3 -0
- chunk3.mlmodelc/model.mil +0 -0
- chunk3.mlmodelc/weights/weight.bin +3 -0
- chunk4.mlmodelc/analytics/coremldata.bin +3 -0
- chunk4.mlmodelc/coremldata.bin +3 -0
- chunk4.mlmodelc/model.mil +0 -0
- chunk4.mlmodelc/weights/weight.bin +3 -0
- cos_full.npy +3 -0
- cos_sliding.npy +3 -0
- embed_tokens_per_layer_q8.bin +3 -0
- embed_tokens_per_layer_scales.bin +3 -0
- embed_tokens_q8.bin +3 -0
- embed_tokens_scales.bin +3 -0
- hf_model/config.json +197 -0
- hf_model/generation_config.json +14 -0
- hf_model/tokenizer.json +3 -0
- hf_model/tokenizer_config.json +74 -0
- model_config.json +26 -0
- per_layer_norm_weight.bin +3 -0
- per_layer_projection.bin +3 -0
- sin_full.npy +3 -0
- sin_sliding.npy +3 -0
.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 |
+
hf_model/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: gemma
|
| 3 |
+
base_model: google/gemma-4-E4B-it
|
| 4 |
+
tags:
|
| 5 |
+
- coreml
|
| 6 |
+
- apple-neural-engine
|
| 7 |
+
- gemma
|
| 8 |
+
- text-generation
|
| 9 |
+
pipeline_tag: text-generation
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# Gemma 4 E4B — CoreML (INT4, Apple Neural Engine)
|
| 13 |
+
|
| 14 |
+
CoreML port of [`google/gemma-4-E4B-it`](https://huggingface.co/google/gemma-4-E4B-it) (the
|
| 15 |
+
4B-effective Gemma 4 decoder), chunked into 4 sliding-window-attention (SWA) pieces
|
| 16 |
+
for Apple Neural Engine execution. Produced by
|
| 17 |
+
[john-rocky/CoreML-LLM](https://github.com/john-rocky/CoreML-LLM) via
|
| 18 |
+
`conversion/build_gemma4_bundle.py --model gemma4-e4b --ctx 2048`.
|
| 19 |
+
|
| 20 |
+
## Layout
|
| 21 |
+
|
| 22 |
+
- `chunk{1..4}.mlmodelc/` — multi-function chunks (`decode_q1` + `verify_qK`), INT4 palettized
|
| 23 |
+
- chunk1: L0–11 (own KV), chunk2: L12–23 (emits `kv13_*`/`kv14_*` aliases for producer
|
| 24 |
+
layers L22/L23), chunk3: L24–32 (KV-shared), chunk4: L33–41 + LM head
|
| 25 |
+
- `embed_tokens_q8.bin` + `embed_tokens_scales.bin` — INT8 token embeddings (262144 × 2560)
|
| 26 |
+
- `embed_tokens_per_layer_q8.bin` + `embed_tokens_per_layer_scales.bin` — INT8 PLE
|
| 27 |
+
(262144 × 11776 = nlayers × per_layer_dim)
|
| 28 |
+
- `per_layer_projection.bin`, `per_layer_norm_weight.bin` — fp16 per-layer projection weights
|
| 29 |
+
- `cos_{sliding,full}.npy`, `sin_{sliding,full}.npy` — precomputed RoPE tables
|
| 30 |
+
- `hf_model/tokenizer.json`, `tokenizer_config.json`, `config.json`,
|
| 31 |
+
`generation_config.json` — swift-transformers tokenizer input
|
| 32 |
+
- `model_config.json` — runtime config (hidden_size=2560, num_hidden_layers=42,
|
| 33 |
+
num_key_value_heads=2, sliding_window=512, context_length=2048)
|
| 34 |
+
|
| 35 |
+
## Architecture (vs E2B)
|
| 36 |
+
|
| 37 |
+
| | E2B | E4B |
|
| 38 |
+
|---|---:|---:|
|
| 39 |
+
| num_hidden_layers | 35 | **42** |
|
| 40 |
+
| hidden_size | 1536 | **2560** |
|
| 41 |
+
| num_key_value_heads | 1 | **2** |
|
| 42 |
+
| intermediate_size | 6144 | **10240** |
|
| 43 |
+
| num_kv_shared_layers | 20 | 18 |
|
| 44 |
+
| KV producers (sliding/full) | L13 / L14 | **L22 / L23** |
|
| 45 |
+
| Chunk boundaries | L0-7, L8-14, L15-24, L25-34 | L0-11, L12-23, L24-32, L33-41 |
|
| 46 |
+
|
| 47 |
+
The Swift runtime names the producer-layer KV outputs `kv13_*` / `kv14_*` regardless of
|
| 48 |
+
actual layer index, so the iOS side needs no model-specific wiring.
|
| 49 |
+
|
| 50 |
+
## Usage (Swift)
|
| 51 |
+
|
| 52 |
+
Use via the [john-rocky/CoreML-LLM](https://github.com/john-rocky/CoreML-LLM) app. The
|
| 53 |
+
model picker in `CoreMLLLMChat` will auto-download and run this repo when you select
|
| 54 |
+
"Gemma 4 E4B".
|
| 55 |
+
|
| 56 |
+
Direct load in CoreMLLLM Swift:
|
| 57 |
+
|
| 58 |
+
```swift
|
| 59 |
+
import CoreMLLLM
|
| 60 |
+
|
| 61 |
+
let modelURL = // Documents/Models/gemma4-e4b
|
| 62 |
+
let llm = try await CoreMLLLM.load(from: modelURL)
|
| 63 |
+
for await token in try await llm.stream([.init(role: .user, content: "Hi")]) {
|
| 64 |
+
print(token, terminator: "")
|
| 65 |
+
}
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
## Benchmarks
|
| 69 |
+
|
| 70 |
+
iPhone 17 Pro, INT4 palettized, ctx=2048, baseline (no speculative decoding):
|
| 71 |
+
|
| 72 |
+
| Metric | Value |
|
| 73 |
+
|---|---:|
|
| 74 |
+
| Decode tok/s | **~14 tok/s** |
|
| 75 |
+
| Per-step latency | ~71 ms |
|
| 76 |
+
| Memory (`phys_footprint`) | ~4.5 GB |
|
| 77 |
+
| ANE placement | 100% |
|
| 78 |
+
|
| 79 |
+
## Context length
|
| 80 |
+
|
| 81 |
+
Shipping bundle is ctx=2048. Rebuild with `--ctx 4096` or higher on a sufficiently
|
| 82 |
+
large Mac to extend; the ANE will reject chunks whose declared context differs from
|
| 83 |
+
`model_config.json`.
|
chunk1.mlmodelc/analytics/coremldata.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:eb7d0c074925f5e2b23d70754135276d3b38e5bb2ebf89df153a401e37ef2f57
|
| 3 |
+
size 243
|
chunk1.mlmodelc/coremldata.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5b53fc92f6d11bf88eb63b9a7af4a7211180e3c031115a9abfa20655814727d4
|
| 3 |
+
size 1333
|
chunk1.mlmodelc/model.mil
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
chunk1.mlmodelc/weights/weight.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:67c868123b2e7b2182d97a0aaca1d4e33f861ee446eac5b038bdb9f0e2c6e787
|
| 3 |
+
size 585970432
|
chunk2.mlmodelc/analytics/coremldata.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0c032a454d2eaeea9fd5bfdfe3a2caf53e1a79d401fe8007c986abcc44469a19
|
| 3 |
+
size 243
|
chunk2.mlmodelc/coremldata.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8046d35bb019573a7541c830b6b712d5176c199f51e2b1fec3a17342d86a3ac6
|
| 3 |
+
size 1471
|
chunk2.mlmodelc/model.mil
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
chunk2.mlmodelc/weights/weight.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c6cd92e3945e5e809a15df7a1d9e648fb651e859d733d9589eba817805e2d96d
|
| 3 |
+
size 572196992
|
chunk3.mlmodelc/analytics/coremldata.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:83e107e7d0f531fa20c6861ea0483120a4246adc98daba2bdc9ec015f77bc7ac
|
| 3 |
+
size 243
|
chunk3.mlmodelc/coremldata.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d43e7d6694b27bec11ece3eb5bb8b3b5b185fa8bc0b668980e154952fd36bf0b
|
| 3 |
+
size 940
|
chunk3.mlmodelc/model.mil
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
chunk3.mlmodelc/weights/weight.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:db45f9ce7443de57765ba412a0158ac2ad46a9d2f735fba9376bbdb0aa357b88
|
| 3 |
+
size 412740736
|
chunk4.mlmodelc/analytics/coremldata.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:58c1fb89f6c05774b2ac875839fcc1e5c153cc195cfe223ad9ffb42d2d30ea48
|
| 3 |
+
size 243
|
chunk4.mlmodelc/coremldata.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b78c0ef3198782c4e4060bdf45f682dcb566666e05fee15858a5c2467c05965b
|
| 3 |
+
size 1014
|
chunk4.mlmodelc/model.mil
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
chunk4.mlmodelc/weights/weight.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8f044d109750fec5d781baada3c070cd3d524b674ea68a00c1c99b5e8015cfbb
|
| 3 |
+
size 753797440
|
cos_full.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:767b3a21305a67e3a3fd22e256f2e7385014b32374442b6103fb820c7d9ef1fc
|
| 3 |
+
size 4194432
|
cos_sliding.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a27afac2d0282008c59736cb498f0b49e6f775e0b3847811fdd06be09c6df4a1
|
| 3 |
+
size 2097280
|
embed_tokens_per_layer_q8.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:269eb54aa366e2d73474d7521b376025fa53bd2d72c6d3bc0301b0882c6ae681
|
| 3 |
+
size 2818572288
|
embed_tokens_per_layer_scales.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bc32925fb678b96d96cf804b77c1d137f157a6136b76e6f8a003d69f4e976fea
|
| 3 |
+
size 524288
|
embed_tokens_q8.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b8921fcbb6d8a79c7b304b929f357cdb41905fec75a90bad00dfed071c76fb82
|
| 3 |
+
size 671088640
|
embed_tokens_scales.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a5c20211cbfbb5e5a1059d91c5c1e0493e7630505028459e7843a9b1b41ee854
|
| 3 |
+
size 524288
|
hf_model/config.json
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
"dtype": "bfloat16",
|
| 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 |
+
"dtype": "bfloat16",
|
| 49 |
+
"eoa_token_id": 258883,
|
| 50 |
+
"eoa_token_index": 258883,
|
| 51 |
+
"eoi_token_id": 258882,
|
| 52 |
+
"eos_token_id": [
|
| 53 |
+
1,
|
| 54 |
+
106
|
| 55 |
+
],
|
| 56 |
+
"image_token_id": 258880,
|
| 57 |
+
"initializer_range": 0.02,
|
| 58 |
+
"model_type": "gemma4",
|
| 59 |
+
"text_config": {
|
| 60 |
+
"attention_bias": false,
|
| 61 |
+
"attention_dropout": 0.0,
|
| 62 |
+
"attention_k_eq_v": false,
|
| 63 |
+
"bos_token_id": 2,
|
| 64 |
+
"dtype": "bfloat16",
|
| 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": 2560,
|
| 73 |
+
"hidden_size_per_layer_input": 256,
|
| 74 |
+
"initializer_range": 0.02,
|
| 75 |
+
"intermediate_size": 10240,
|
| 76 |
+
"layer_types": [
|
| 77 |
+
"sliding_attention",
|
| 78 |
+
"sliding_attention",
|
| 79 |
+
"sliding_attention",
|
| 80 |
+
"sliding_attention",
|
| 81 |
+
"sliding_attention",
|
| 82 |
+
"full_attention",
|
| 83 |
+
"sliding_attention",
|
| 84 |
+
"sliding_attention",
|
| 85 |
+
"sliding_attention",
|
| 86 |
+
"sliding_attention",
|
| 87 |
+
"sliding_attention",
|
| 88 |
+
"full_attention",
|
| 89 |
+
"sliding_attention",
|
| 90 |
+
"sliding_attention",
|
| 91 |
+
"sliding_attention",
|
| 92 |
+
"sliding_attention",
|
| 93 |
+
"sliding_attention",
|
| 94 |
+
"full_attention",
|
| 95 |
+
"sliding_attention",
|
| 96 |
+
"sliding_attention",
|
| 97 |
+
"sliding_attention",
|
| 98 |
+
"sliding_attention",
|
| 99 |
+
"sliding_attention",
|
| 100 |
+
"full_attention",
|
| 101 |
+
"sliding_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 |
+
"sliding_attention",
|
| 112 |
+
"full_attention",
|
| 113 |
+
"sliding_attention",
|
| 114 |
+
"sliding_attention",
|
| 115 |
+
"sliding_attention",
|
| 116 |
+
"sliding_attention",
|
| 117 |
+
"sliding_attention",
|
| 118 |
+
"full_attention"
|
| 119 |
+
],
|
| 120 |
+
"max_position_embeddings": 131072,
|
| 121 |
+
"model_type": "gemma4_text",
|
| 122 |
+
"num_attention_heads": 8,
|
| 123 |
+
"num_experts": null,
|
| 124 |
+
"num_global_key_value_heads": null,
|
| 125 |
+
"num_hidden_layers": 42,
|
| 126 |
+
"num_key_value_heads": 2,
|
| 127 |
+
"num_kv_shared_layers": 18,
|
| 128 |
+
"pad_token_id": 0,
|
| 129 |
+
"rms_norm_eps": 1e-06,
|
| 130 |
+
"rope_parameters": {
|
| 131 |
+
"full_attention": {
|
| 132 |
+
"partial_rotary_factor": 0.25,
|
| 133 |
+
"rope_theta": 1000000.0,
|
| 134 |
+
"rope_type": "proportional"
|
| 135 |
+
},
|
| 136 |
+
"sliding_attention": {
|
| 137 |
+
"rope_theta": 10000.0,
|
| 138 |
+
"rope_type": "default"
|
| 139 |
+
}
|
| 140 |
+
},
|
| 141 |
+
"sliding_window": 512,
|
| 142 |
+
"tie_word_embeddings": true,
|
| 143 |
+
"top_k_experts": null,
|
| 144 |
+
"use_bidirectional_attention": null,
|
| 145 |
+
"use_cache": true,
|
| 146 |
+
"use_double_wide_mlp": false,
|
| 147 |
+
"vocab_size": 262144,
|
| 148 |
+
"vocab_size_per_layer_input": 262144
|
| 149 |
+
},
|
| 150 |
+
"tie_word_embeddings": true,
|
| 151 |
+
"transformers_version": "5.5.0.dev0",
|
| 152 |
+
"video_token_id": 258884,
|
| 153 |
+
"vision_config": {
|
| 154 |
+
"_name_or_path": "",
|
| 155 |
+
"architectures": null,
|
| 156 |
+
"attention_bias": false,
|
| 157 |
+
"attention_dropout": 0.0,
|
| 158 |
+
"chunk_size_feed_forward": 0,
|
| 159 |
+
"default_output_length": 280,
|
| 160 |
+
"dtype": "bfloat16",
|
| 161 |
+
"global_head_dim": 64,
|
| 162 |
+
"head_dim": 64,
|
| 163 |
+
"hidden_activation": "gelu_pytorch_tanh",
|
| 164 |
+
"hidden_size": 768,
|
| 165 |
+
"id2label": {
|
| 166 |
+
"0": "LABEL_0",
|
| 167 |
+
"1": "LABEL_1"
|
| 168 |
+
},
|
| 169 |
+
"initializer_range": 0.02,
|
| 170 |
+
"intermediate_size": 3072,
|
| 171 |
+
"is_encoder_decoder": false,
|
| 172 |
+
"label2id": {
|
| 173 |
+
"LABEL_0": 0,
|
| 174 |
+
"LABEL_1": 1
|
| 175 |
+
},
|
| 176 |
+
"max_position_embeddings": 131072,
|
| 177 |
+
"model_type": "gemma4_vision",
|
| 178 |
+
"num_attention_heads": 12,
|
| 179 |
+
"num_hidden_layers": 16,
|
| 180 |
+
"num_key_value_heads": 12,
|
| 181 |
+
"output_attentions": false,
|
| 182 |
+
"output_hidden_states": false,
|
| 183 |
+
"patch_size": 16,
|
| 184 |
+
"pooling_kernel_size": 3,
|
| 185 |
+
"position_embedding_size": 10240,
|
| 186 |
+
"problem_type": null,
|
| 187 |
+
"return_dict": true,
|
| 188 |
+
"rms_norm_eps": 1e-06,
|
| 189 |
+
"rope_parameters": {
|
| 190 |
+
"rope_theta": 100.0,
|
| 191 |
+
"rope_type": "default"
|
| 192 |
+
},
|
| 193 |
+
"standardize": false,
|
| 194 |
+
"use_clipped_linears": true
|
| 195 |
+
},
|
| 196 |
+
"vision_soft_tokens_per_image": 280
|
| 197 |
+
}
|
hf_model/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.dev0"
|
| 14 |
+
}
|
hf_model/tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cc8d3a0ce36466ccc1278bf987df5f71db1719b9ca6b4118264f45cb627bfe0f
|
| 3 |
+
size 32169626
|
hf_model/tokenizer_config.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
"mask_token": "<mask>",
|
| 21 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 22 |
+
"pad_token": "<pad>",
|
| 23 |
+
"padding_side": "left",
|
| 24 |
+
"processor_class": "Gemma4Processor",
|
| 25 |
+
"response_schema": {
|
| 26 |
+
"type": "object",
|
| 27 |
+
"properties": {
|
| 28 |
+
"role": {
|
| 29 |
+
"const": "assistant"
|
| 30 |
+
},
|
| 31 |
+
"thinking": {
|
| 32 |
+
"type": "string"
|
| 33 |
+
},
|
| 34 |
+
"content": {
|
| 35 |
+
"type": "string"
|
| 36 |
+
},
|
| 37 |
+
"tool_calls": {
|
| 38 |
+
"x-regex-iterator": "<\\|tool_call>(.*?)<tool_call\\|>",
|
| 39 |
+
"type": "array",
|
| 40 |
+
"items": {
|
| 41 |
+
"type": "object",
|
| 42 |
+
"properties": {
|
| 43 |
+
"type": {
|
| 44 |
+
"const": "function"
|
| 45 |
+
},
|
| 46 |
+
"function": {
|
| 47 |
+
"type": "object",
|
| 48 |
+
"x-regex": "call\\:(?P<name>\\w+)(?P<arguments>\\{.*\\})",
|
| 49 |
+
"properties": {
|
| 50 |
+
"name": {
|
| 51 |
+
"type": "string"
|
| 52 |
+
},
|
| 53 |
+
"arguments": {
|
| 54 |
+
"type": "object",
|
| 55 |
+
"x-parser": "gemma4-tool-call",
|
| 56 |
+
"additionalProperties": {}
|
| 57 |
+
}
|
| 58 |
+
}
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
},
|
| 64 |
+
"x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?P<content>(?:(?!\\<turn\\|\\>)(?!\\<\\|tool_response\\>).)+)?(?:\\<turn\\|\\>|\\<\\|tool_response\\>)?"
|
| 65 |
+
},
|
| 66 |
+
"soc_token": "<|channel>",
|
| 67 |
+
"sot_token": "<|turn>",
|
| 68 |
+
"stc_token": "<|tool_call>",
|
| 69 |
+
"std_token": "<|tool>",
|
| 70 |
+
"str_token": "<|tool_response>",
|
| 71 |
+
"think_token": "<|think|>",
|
| 72 |
+
"tokenizer_class": "GemmaTokenizer",
|
| 73 |
+
"unk_token": "<unk>"
|
| 74 |
+
}
|
model_config.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_name": "gemma4-e4b",
|
| 3 |
+
"architecture": "gemma4",
|
| 4 |
+
"hidden_size": 2560,
|
| 5 |
+
"num_hidden_layers": 42,
|
| 6 |
+
"num_attention_heads": 8,
|
| 7 |
+
"num_key_value_heads": 2,
|
| 8 |
+
"head_dim": 256,
|
| 9 |
+
"global_head_dim": 512,
|
| 10 |
+
"vocab_size": 262144,
|
| 11 |
+
"context_length": 2048,
|
| 12 |
+
"sliding_window": 512,
|
| 13 |
+
"per_layer_dim": 256,
|
| 14 |
+
"num_layers": 42,
|
| 15 |
+
"embed_scale": 50.59644256269407,
|
| 16 |
+
"per_layer_embed_scale": 16.0,
|
| 17 |
+
"per_layer_model_projection_scale": 0.01976423537605237,
|
| 18 |
+
"per_layer_input_scale": 0.7071067811865475,
|
| 19 |
+
"rms_norm_eps": 1e-06,
|
| 20 |
+
"bos_token_id": 2,
|
| 21 |
+
"eos_token_id": 1,
|
| 22 |
+
"final_logit_softcapping": 30.0,
|
| 23 |
+
"quantization": "int4",
|
| 24 |
+
"compute_units": "CPU_AND_NE",
|
| 25 |
+
"tokenizer_repo": "google/gemma-4-E4B-it"
|
| 26 |
+
}
|
per_layer_norm_weight.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ff67a6ed2e1ac597c28467653c4d67ecd4018f668b1d667af95e564539bd4c10
|
| 3 |
+
size 512
|
per_layer_projection.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a8889e468a6c7e0a43f6ea4a7df18435cf75a5e496415146790f9e0a8a9cd63f
|
| 3 |
+
size 55050240
|
sin_full.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fa9d6aa40ca6b4f02f2be7563be801bc8ed77bcbc06f3aeb46050587401f2b4e
|
| 3 |
+
size 4194432
|
sin_sliding.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b8a996e1172dbb9748de65e1b7cede880e07f89310719215c627cf26faebcd55
|
| 3 |
+
size 2097280
|