warshanks commited on
Commit
ed2dd36
·
verified ·
1 Parent(s): 5837705

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -2,15 +2,15 @@
2
  license: other
3
  license_name: health-ai-developer-foundations
4
  license_link: https://developers.google.com/health-ai-developer-foundations/terms
5
- library_name: mlx
6
- pipeline_tag: text-generation
7
  extra_gated_heading: Access MedGemma on Hugging Face
8
  extra_gated_prompt: To access MedGemma on Hugging Face, you're required to review
9
  and agree to [Health AI Developer Foundation's terms of use](https://developers.google.com/health-ai-developer-foundations/terms).
10
  To do this, please ensure you're logged in to Hugging Face and click below. Requests
11
  are processed immediately.
12
  extra_gated_button_content: Acknowledge license
13
- base_model: google/medgemma-4b-it
14
  tags:
15
  - medical
16
  - radiology
@@ -23,29 +23,14 @@ tags:
23
  ---
24
 
25
  # mlx-community/medgemma-4b-it-bf16
26
-
27
- This model [mlx-community/medgemma-4b-it-bf16](https://huggingface.co/mlx-community/medgemma-4b-it-bf16) was
28
- converted to MLX format from [google/medgemma-4b-it](https://huggingface.co/google/medgemma-4b-it)
29
- using mlx-lm version **0.24.1**.
30
-
31
  ## Use with mlx
32
 
33
  ```bash
34
- pip install mlx-lm
35
  ```
36
 
37
- ```python
38
- from mlx_lm import load, generate
39
-
40
- model, tokenizer = load("mlx-community/medgemma-4b-it-bf16")
41
-
42
- prompt = "hello"
43
-
44
- if tokenizer.chat_template is not None:
45
- messages = [{"role": "user", "content": prompt}]
46
- prompt = tokenizer.apply_chat_template(
47
- messages, add_generation_prompt=True
48
- )
49
-
50
- response = generate(model, tokenizer, prompt=prompt, verbose=True)
51
  ```
 
2
  license: other
3
  license_name: health-ai-developer-foundations
4
  license_link: https://developers.google.com/health-ai-developer-foundations/terms
5
+ library_name: transformers
6
+ pipeline_tag: image-text-to-text
7
  extra_gated_heading: Access MedGemma on Hugging Face
8
  extra_gated_prompt: To access MedGemma on Hugging Face, you're required to review
9
  and agree to [Health AI Developer Foundation's terms of use](https://developers.google.com/health-ai-developer-foundations/terms).
10
  To do this, please ensure you're logged in to Hugging Face and click below. Requests
11
  are processed immediately.
12
  extra_gated_button_content: Acknowledge license
13
+ base_model: google/medgemma-4b-pt
14
  tags:
15
  - medical
16
  - radiology
 
23
  ---
24
 
25
  # mlx-community/medgemma-4b-it-bf16
26
+ This model was converted to MLX format from [`google/medgemma-4b-it`]() using mlx-vlm version **0.1.26**.
27
+ Refer to the [original model card](https://huggingface.co/google/medgemma-4b-it) for more details on the model.
 
 
 
28
  ## Use with mlx
29
 
30
  ```bash
31
+ pip install -U mlx-vlm
32
  ```
33
 
34
+ ```bash
35
+ python -m mlx_vlm.generate --model mlx-community/medgemma-4b-it-bf16 --max-tokens 100 --temperature 0.0 --prompt "Describe this image." --image <path_to_image>
 
 
 
 
 
 
 
 
 
 
 
 
36
  ```
config.json CHANGED
@@ -1,47 +1,235 @@
1
  {
 
2
  "architectures": [
3
  "Gemma3ForConditionalGeneration"
4
  ],
 
 
5
  "boi_token_index": 255999,
 
 
 
 
 
 
 
 
6
  "eoi_token_index": 256000,
7
  "eos_token_id": [
8
  1,
9
  106
10
  ],
 
 
 
 
 
 
 
 
11
  "image_token_index": 262144,
12
  "initializer_range": 0.02,
 
 
 
 
 
 
 
 
 
13
  "mm_tokens_per_image": 256,
14
  "model_type": "gemma3",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  "text_config": {
16
- "attention_bias": false,
17
- "attention_dropout": 0.0,
18
- "attn_logit_softcapping": null,
19
- "cache_implementation": "hybrid",
20
- "final_logit_softcapping": null,
21
- "head_dim": 256,
22
- "hidden_activation": "gelu_pytorch_tanh",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  "hidden_size": 2560,
24
- "initializer_range": 0.02,
25
  "intermediate_size": 10240,
26
- "max_position_embeddings": 131072,
27
- "model_type": "gemma3_text",
28
- "num_attention_heads": 8,
29
  "num_hidden_layers": 34,
 
 
30
  "num_key_value_heads": 4,
31
- "query_pre_attn_scalar": 256,
32
  "rms_norm_eps": 1e-06,
 
 
 
 
 
 
 
 
 
 
33
  "rope_local_base_freq": 10000,
 
34
  "rope_scaling": {
35
  "factor": 8.0,
36
  "rope_type": "linear"
37
- },
38
- "rope_theta": 1000000,
39
- "sliding_window": 1024,
40
- "sliding_window_pattern": 6,
41
- "torch_dtype": "bfloat16",
42
- "use_cache": true,
43
- "vocab_size": 262208
44
  },
45
- "torch_dtype": "bfloat16",
46
- "transformers_version": "4.52.0.dev0"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  }
 
1
  {
2
+ "add_cross_attention": false,
3
  "architectures": [
4
  "Gemma3ForConditionalGeneration"
5
  ],
6
+ "bad_words_ids": null,
7
+ "begin_suppress_tokens": null,
8
  "boi_token_index": 255999,
9
+ "bos_token_id": null,
10
+ "chunk_size_feed_forward": 0,
11
+ "cross_attention_hidden_size": null,
12
+ "decoder_start_token_id": null,
13
+ "diversity_penalty": 0.0,
14
+ "do_sample": false,
15
+ "early_stopping": false,
16
+ "encoder_no_repeat_ngram_size": 0,
17
  "eoi_token_index": 256000,
18
  "eos_token_id": [
19
  1,
20
  106
21
  ],
22
+ "exponential_decay_length_penalty": null,
23
+ "finetuning_task": null,
24
+ "forced_bos_token_id": null,
25
+ "forced_eos_token_id": null,
26
+ "id2label": {
27
+ "0": "LABEL_0",
28
+ "1": "LABEL_1"
29
+ },
30
  "image_token_index": 262144,
31
  "initializer_range": 0.02,
32
+ "is_decoder": false,
33
+ "is_encoder_decoder": false,
34
+ "label2id": {
35
+ "LABEL_0": 0,
36
+ "LABEL_1": 1
37
+ },
38
+ "length_penalty": 1.0,
39
+ "max_length": 20,
40
+ "min_length": 0,
41
  "mm_tokens_per_image": 256,
42
  "model_type": "gemma3",
43
+ "no_repeat_ngram_size": 0,
44
+ "num_beam_groups": 1,
45
+ "num_beams": 1,
46
+ "num_return_sequences": 1,
47
+ "output_attentions": false,
48
+ "output_hidden_states": false,
49
+ "output_scores": false,
50
+ "pad_token_id": null,
51
+ "prefix": null,
52
+ "problem_type": null,
53
+ "pruned_heads": {},
54
+ "remove_invalid_values": false,
55
+ "repetition_penalty": 1.0,
56
+ "return_dict": true,
57
+ "return_dict_in_generate": false,
58
+ "sep_token_id": null,
59
+ "suppress_tokens": null,
60
+ "task_specific_params": null,
61
+ "temperature": 1.0,
62
  "text_config": {
63
+ "return_dict": true,
64
+ "output_hidden_states": false,
65
+ "output_attentions": false,
66
+ "torchscript": false,
67
+ "torch_dtype": "bfloat16",
68
+ "use_bfloat16": false,
69
+ "tf_legacy_loss": false,
70
+ "pruned_heads": {},
71
+ "tie_word_embeddings": true,
72
+ "chunk_size_feed_forward": 0,
73
+ "is_encoder_decoder": false,
74
+ "is_decoder": false,
75
+ "cross_attention_hidden_size": null,
76
+ "add_cross_attention": false,
77
+ "tie_encoder_decoder": false,
78
+ "max_length": 20,
79
+ "min_length": 0,
80
+ "do_sample": false,
81
+ "early_stopping": false,
82
+ "num_beams": 1,
83
+ "num_beam_groups": 1,
84
+ "diversity_penalty": 0.0,
85
+ "temperature": 1.0,
86
+ "top_k": 50,
87
+ "top_p": 1.0,
88
+ "typical_p": 1.0,
89
+ "repetition_penalty": 1.0,
90
+ "length_penalty": 1.0,
91
+ "no_repeat_ngram_size": 0,
92
+ "encoder_no_repeat_ngram_size": 0,
93
+ "bad_words_ids": null,
94
+ "num_return_sequences": 1,
95
+ "output_scores": false,
96
+ "return_dict_in_generate": false,
97
+ "forced_bos_token_id": null,
98
+ "forced_eos_token_id": null,
99
+ "remove_invalid_values": false,
100
+ "exponential_decay_length_penalty": null,
101
+ "suppress_tokens": null,
102
+ "begin_suppress_tokens": null,
103
+ "architectures": null,
104
+ "finetuning_task": null,
105
+ "id2label": {
106
+ "0": "LABEL_0",
107
+ "1": "LABEL_1"
108
+ },
109
+ "label2id": {
110
+ "LABEL_0": 0,
111
+ "LABEL_1": 1
112
+ },
113
+ "tokenizer_class": null,
114
+ "prefix": null,
115
+ "bos_token_id": 2,
116
+ "pad_token_id": 0,
117
+ "eos_token_id": 1,
118
+ "sep_token_id": null,
119
+ "decoder_start_token_id": null,
120
+ "task_specific_params": null,
121
+ "problem_type": null,
122
+ "_name_or_path": "",
123
+ "model_type": "gemma3_text",
124
+ "vocab_size": 262208,
125
+ "max_position_embeddings": 131072,
126
  "hidden_size": 2560,
 
127
  "intermediate_size": 10240,
 
 
 
128
  "num_hidden_layers": 34,
129
+ "num_attention_heads": 8,
130
+ "head_dim": 256,
131
  "num_key_value_heads": 4,
132
+ "initializer_range": 0.02,
133
  "rms_norm_eps": 1e-06,
134
+ "use_cache": true,
135
+ "rope_theta": 1000000,
136
+ "attention_bias": false,
137
+ "attention_dropout": 0.0,
138
+ "hidden_activation": "gelu_pytorch_tanh",
139
+ "query_pre_attn_scalar": 256,
140
+ "sliding_window": 1024,
141
+ "final_logit_softcapping": null,
142
+ "attn_logit_softcapping": null,
143
+ "cache_implementation": "hybrid",
144
  "rope_local_base_freq": 10000,
145
+ "sliding_window_pattern": 6,
146
  "rope_scaling": {
147
  "factor": 8.0,
148
  "rope_type": "linear"
149
+ }
 
 
 
 
 
 
150
  },
151
+ "tf_legacy_loss": false,
152
+ "tie_encoder_decoder": false,
153
+ "tie_word_embeddings": true,
154
+ "tokenizer_class": null,
155
+ "top_k": 50,
156
+ "top_p": 1.0,
157
+ "torchscript": false,
158
+ "transformers_version": "4.52.3",
159
+ "typical_p": 1.0,
160
+ "use_bfloat16": false,
161
+ "vision_config": {
162
+ "return_dict": true,
163
+ "output_hidden_states": false,
164
+ "output_attentions": false,
165
+ "torchscript": false,
166
+ "torch_dtype": "bfloat16",
167
+ "use_bfloat16": false,
168
+ "tf_legacy_loss": false,
169
+ "pruned_heads": {},
170
+ "tie_word_embeddings": true,
171
+ "chunk_size_feed_forward": 0,
172
+ "is_encoder_decoder": false,
173
+ "is_decoder": false,
174
+ "cross_attention_hidden_size": null,
175
+ "add_cross_attention": false,
176
+ "tie_encoder_decoder": false,
177
+ "max_length": 20,
178
+ "min_length": 0,
179
+ "do_sample": false,
180
+ "early_stopping": false,
181
+ "num_beams": 1,
182
+ "num_beam_groups": 1,
183
+ "diversity_penalty": 0.0,
184
+ "temperature": 1.0,
185
+ "top_k": 50,
186
+ "top_p": 1.0,
187
+ "typical_p": 1.0,
188
+ "repetition_penalty": 1.0,
189
+ "length_penalty": 1.0,
190
+ "no_repeat_ngram_size": 0,
191
+ "encoder_no_repeat_ngram_size": 0,
192
+ "bad_words_ids": null,
193
+ "num_return_sequences": 1,
194
+ "output_scores": false,
195
+ "return_dict_in_generate": false,
196
+ "forced_bos_token_id": null,
197
+ "forced_eos_token_id": null,
198
+ "remove_invalid_values": false,
199
+ "exponential_decay_length_penalty": null,
200
+ "suppress_tokens": null,
201
+ "begin_suppress_tokens": null,
202
+ "architectures": null,
203
+ "finetuning_task": null,
204
+ "id2label": {
205
+ "0": "LABEL_0",
206
+ "1": "LABEL_1"
207
+ },
208
+ "label2id": {
209
+ "LABEL_0": 0,
210
+ "LABEL_1": 1
211
+ },
212
+ "tokenizer_class": null,
213
+ "prefix": null,
214
+ "bos_token_id": null,
215
+ "pad_token_id": null,
216
+ "eos_token_id": null,
217
+ "sep_token_id": null,
218
+ "decoder_start_token_id": null,
219
+ "task_specific_params": null,
220
+ "problem_type": null,
221
+ "_name_or_path": "",
222
+ "model_type": "siglip_vision_model",
223
+ "vision_use_head": false,
224
+ "hidden_size": 1152,
225
+ "intermediate_size": 4304,
226
+ "num_hidden_layers": 27,
227
+ "num_attention_heads": 16,
228
+ "num_channels": 3,
229
+ "patch_size": 14,
230
+ "image_size": 896,
231
+ "attention_dropout": 0.0,
232
+ "layer_norm_eps": 1e-06,
233
+ "hidden_act": "gelu_pytorch_tanh"
234
+ }
235
  }
model-00001-of-00002.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:af6a5f148e1b27fd04b7c9bffba42e264edb2ff4c23ddd08be587342748847ab
3
- size 5338068786
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:10de905eb103e7f174d1219fd2fe706234fed4f958a6ebe4ebef8cc3aea01682
3
+ size 5332884576
model-00002-of-00002.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:678d26f73e86683347cfbf3609694846f78c3e16907ac8be6c19aa21ca939512
3
- size 3765020765
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:122cd3312cc3b5449bce2df491ffe388b9e85ab89d0e65142e55a1e5e1e33c4a
3
+ size 4609898146
model.safetensors.index.json CHANGED
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
+ }