SpongeBOB9684 commited on
Commit
92b339f
·
verified ·
1 Parent(s): e36e89e

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 ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model:
3
+ - google/gemma-3-12b-it
4
+ - google/translategemma-12b-it
5
+ library_name: transformers
6
+ tags:
7
+ - mergekit
8
+ - merge
9
+ - translation
10
+ - multimodal
11
+ - gemma-3
12
+ license: gemma
13
+ ---
14
+
15
+ # GemmaTranslate-v3-12B
16
+
17
+ GemmaTranslate-v3-12B is a high-performance, multimodal hybrid model designed for advanced translation and general-purpose assistance. It is a [SLERP](https://en.wikipedia.org/wiki/Slerp) merge of two state-of-the-art models: [Gemma-3-12B-IT](https://huggingface.co/google/gemma-3-12b-it) and [TranslateGemma-12B-IT](https://huggingface.co/google/translategemma-12b-it).
18
+
19
+ By combining the general reasoning and multimodal capabilities of Gemma-3 with the specialized translation expertise of TranslateGemma, this model offers superior performance in multilingual contexts while maintaining the ability to process visual information.
20
+
21
+ ## Model Details
22
+
23
+ - **Architecture:** Gemma-3 (Multimodal, 128K context length)
24
+ - **Merge Method:** SLERP (Spherical Linear Interpolation)
25
+ - **Base Models:**
26
+ - [google/gemma-3-12b-it](https://huggingface.co/google/gemma-3-12b-it)
27
+ - [google/translategemma-12b-it](https://huggingface.co/google/translategemma-12b-it)
28
+ - **Language(s):** Multilingual (Supports 30+ languages)
29
+ - **License:** [Gemma Terms of Use](https://ai.google.dev/gemma/terms)
30
+
31
+ ## Key Features
32
+
33
+ - **Multimodal Capabilities:** Inherits the vision tower and multimodal projector from Gemma-3-12B-IT, enabling image understanding and visual reasoning.
34
+ - **Enhanced Translation:** Optimized for translation tasks by merging with TranslateGemma-12B-IT.
35
+ - **Large Context Window:** Supports up to 128K tokens.
36
+ - **Hybrid Reasoning:** Combines instruction-following capabilities with high-fidelity translation.
37
+
38
+ ## Merge Configuration
39
+
40
+ The following YAML configuration was used to produce this model:
41
+
42
+ ```yaml
43
+ base_model: google/gemma-3-12b-it
44
+ dtype: bfloat16
45
+ merge_method: slerp
46
+ parameters:
47
+ t:
48
+ - filter: vision_tower
49
+ value: 0
50
+ - filter: multi_modal_projector
51
+ value: 0
52
+ - value: 0.5
53
+ models:
54
+ - model: google/gemma-3-12b-it
55
+ - model: google/translategemma-12b-it
56
+ ```
57
+
58
+ *Note: The `vision_tower` and `multi_modal_projector` weights are taken 100% from Gemma-3-12B-IT (`t=0`) to ensure visual stability, while the language model weights are a 50/50 SLERP merge (`t=0.5`).*
59
+
60
+ ## Usage
61
+
62
+ You can use this model with the Hugging Face `transformers` library.
63
+
64
+ ```python
65
+ from transformers import Gemma3ForConditionalGeneration, AutoProcessor
66
+ import torch
67
+
68
+ model_id = "SpongeBOB9684/GemmaTranslate-v3-12B"
69
+
70
+ model = Gemma3ForConditionalGeneration.from_pretrained(
71
+ model_id,
72
+ device_map="auto",
73
+ torch_dtype=torch.bfloat16
74
+ )
75
+ processor = AutoProcessor.from_pretrained(model_id)
76
+
77
+ # Example: Multimodal Translation
78
+ # (Add your image and prompt here)
79
+ prompt = "Translate the text in this image to French and explain its context."
80
+ # inputs = processor(text=prompt, images=image, return_tensors="pt").to(model.device)
81
+
82
+ # Example: Text-only Translation
83
+ prompt = "Translate the following English text to Japanese: 'The future of AI is multimodal.'"
84
+ inputs = processor(text=prompt, return_tensors="pt").to(model.device)
85
+
86
+ output = model.generate(**inputs, max_new_tokens=256)
87
+ print(processor.decode(output[0], skip_special_tokens=True))
88
+ ```
89
+
90
+ ## License
91
+
92
+ This model is subject to the [Gemma Terms of Use](https://ai.google.dev/gemma/terms). By using this model, you agree to the terms and conditions specified by Google.
added_tokens.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "<image_soft_token>": 262144
3
+ }
config.json ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Gemma3ForConditionalGeneration"
4
+ ],
5
+ "boi_token_index": 255999,
6
+ "dtype": "bfloat16",
7
+ "eoi_token_index": 256000,
8
+ "eos_token_id": [
9
+ 1,
10
+ 106
11
+ ],
12
+ "image_token_index": 262144,
13
+ "initializer_range": 0.02,
14
+ "mm_tokens_per_image": 256,
15
+ "model_type": "gemma3",
16
+ "text_config": {
17
+ "_sliding_window_pattern": 6,
18
+ "attention_bias": false,
19
+ "attention_dropout": 0.0,
20
+ "attn_logit_softcapping": null,
21
+ "bos_token_id": 2,
22
+ "eos_token_id": 1,
23
+ "final_logit_softcapping": null,
24
+ "head_dim": 256,
25
+ "hidden_activation": "gelu_pytorch_tanh",
26
+ "hidden_size": 3840,
27
+ "initializer_range": 0.02,
28
+ "intermediate_size": 15360,
29
+ "layer_types": [
30
+ "sliding_attention",
31
+ "sliding_attention",
32
+ "sliding_attention",
33
+ "sliding_attention",
34
+ "sliding_attention",
35
+ "full_attention",
36
+ "sliding_attention",
37
+ "sliding_attention",
38
+ "sliding_attention",
39
+ "sliding_attention",
40
+ "sliding_attention",
41
+ "full_attention",
42
+ "sliding_attention",
43
+ "sliding_attention",
44
+ "sliding_attention",
45
+ "sliding_attention",
46
+ "sliding_attention",
47
+ "full_attention",
48
+ "sliding_attention",
49
+ "sliding_attention",
50
+ "sliding_attention",
51
+ "sliding_attention",
52
+ "sliding_attention",
53
+ "full_attention",
54
+ "sliding_attention",
55
+ "sliding_attention",
56
+ "sliding_attention",
57
+ "sliding_attention",
58
+ "sliding_attention",
59
+ "full_attention",
60
+ "sliding_attention",
61
+ "sliding_attention",
62
+ "sliding_attention",
63
+ "sliding_attention",
64
+ "sliding_attention",
65
+ "full_attention",
66
+ "sliding_attention",
67
+ "sliding_attention",
68
+ "sliding_attention",
69
+ "sliding_attention",
70
+ "sliding_attention",
71
+ "full_attention",
72
+ "sliding_attention",
73
+ "sliding_attention",
74
+ "sliding_attention",
75
+ "sliding_attention",
76
+ "sliding_attention",
77
+ "full_attention"
78
+ ],
79
+ "max_position_embeddings": 131072,
80
+ "model_type": "gemma3_text",
81
+ "num_attention_heads": 16,
82
+ "num_hidden_layers": 48,
83
+ "num_key_value_heads": 8,
84
+ "pad_token_id": 0,
85
+ "query_pre_attn_scalar": 256,
86
+ "rms_norm_eps": 1e-06,
87
+ "rope_parameters": {
88
+ "full_attention": {
89
+ "factor": 8.0,
90
+ "rope_theta": 1000000.0,
91
+ "rope_type": "linear"
92
+ },
93
+ "sliding_attention": {
94
+ "rope_theta": 10000.0,
95
+ "rope_type": "default"
96
+ }
97
+ },
98
+ "sliding_window": 1024,
99
+ "tie_word_embeddings": true,
100
+ "use_bidirectional_attention": false,
101
+ "use_cache": true,
102
+ "vocab_size": 262208
103
+ },
104
+ "tie_word_embeddings": true,
105
+ "transformers_version": "5.3.0",
106
+ "vision_config": {
107
+ "attention_dropout": 0.0,
108
+ "hidden_act": "gelu_pytorch_tanh",
109
+ "hidden_size": 1152,
110
+ "image_size": 896,
111
+ "intermediate_size": 4304,
112
+ "layer_norm_eps": 1e-06,
113
+ "model_type": "siglip_vision_model",
114
+ "num_attention_heads": 16,
115
+ "num_channels": 3,
116
+ "num_hidden_layers": 27,
117
+ "patch_size": 14,
118
+ "vision_use_head": false
119
+ }
120
+ }
mergekit_config.yml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ base_model: google/gemma-3-12b-it
2
+ dtype: bfloat16
3
+ merge_method: slerp
4
+ parameters:
5
+ t:
6
+ - filter: vision_tower
7
+ value: 0
8
+ - filter: multi_modal_projector
9
+ value: 0
10
+ - value: 0.5
11
+ models:
12
+ - model: google/gemma-3-12b-it
13
+ - model: google/translategemma-12b-it
model-00001-of-00005.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7f3e18123fa0b54a16ae974b93b03081bbdd13fa7822fa69cd363e2387568147
3
+ size 4939493432
model-00002-of-00005.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:806c02c2f374018fe2bc88d44910c4d8ac9b4710836ae7aa479c595d4c27e195
3
+ size 4931296656
model-00003-of-00005.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3f225dbe2eb3fe72da6295e2f23c213ba2ef7ebe5b3ff36722e76bdc24facb3f
3
+ size 4931296656
model-00004-of-00005.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e7e97639bac28d3dbddea3781d595c42996869fc4110c930cd0e515857a72a07
3
+ size 4931296656
model-00005-of-00005.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9009d97341ee98d41cbb63e04a654fe5ea2f634daf39a0a4cb9725143dfac7c4
3
+ size 4641409680
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
preprocessor_config.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_convert_rgb": null,
3
+ "do_normalize": true,
4
+ "do_pan_and_scan": null,
5
+ "do_rescale": true,
6
+ "do_resize": true,
7
+ "image_mean": [
8
+ 0.5,
9
+ 0.5,
10
+ 0.5
11
+ ],
12
+ "image_processor_type": "Gemma3ImageProcessor",
13
+ "image_seq_length": 256,
14
+ "image_std": [
15
+ 0.5,
16
+ 0.5,
17
+ 0.5
18
+ ],
19
+ "pan_and_scan_max_num_crops": null,
20
+ "pan_and_scan_min_crop_size": null,
21
+ "pan_and_scan_min_ratio_to_activate": null,
22
+ "processor_class": "Gemma3Processor",
23
+ "resample": 2,
24
+ "rescale_factor": 0.00392156862745098,
25
+ "size": {
26
+ "height": 896,
27
+ "width": 896
28
+ }
29
+ }
processor_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "image_seq_length": 256,
3
+ "processor_class": "Gemma3Processor"
4
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "boi_token": "<start_of_image>",
3
+ "bos_token": {
4
+ "content": "<bos>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false
9
+ },
10
+ "eoi_token": "<end_of_image>",
11
+ "eos_token": {
12
+ "content": "<eos>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false
17
+ },
18
+ "image_token": "<image_soft_token>",
19
+ "pad_token": {
20
+ "content": "<pad>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false
25
+ },
26
+ "unk_token": {
27
+ "content": "<unk>",
28
+ "lstrip": false,
29
+ "normalized": false,
30
+ "rstrip": false,
31
+ "single_word": false
32
+ }
33
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4667f2089529e8e7657cfb6d1c19910ae71ff5f28aa7ab2ff2763330affad795
3
+ size 33384568
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1299c11d7cf632ef3b4e11937501358ada021bbdf7c47638d13c0ee982f2e79c
3
+ size 4689074
tokenizer_config.json ADDED
The diff for this file is too large to render. See raw diff