Add files using upload-large-folder tool
Browse files- .gitattributes +2 -0
- README.md +546 -0
- added_tokens.json +3 -0
- genai_config.json +50 -0
- model.onnx +3 -0
- model.onnx.data +3 -0
- special_tokens_map.json +33 -0
- tokenizer.json +3 -0
- tokenizer.model +3 -0
- tokenizer_config.json +0 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,5 @@ 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
|
| 37 |
+
model.onnx.data filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,546 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 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: onnxruntime-genai
|
| 6 |
+
pipeline_tag: image-text-to-text
|
| 7 |
+
base_model:
|
| 8 |
+
- unsloth/medgemma-4b-pt
|
| 9 |
+
tags:
|
| 10 |
+
- medical
|
| 11 |
+
- radiology
|
| 12 |
+
- clinical-reasoning
|
| 13 |
+
- dermatology
|
| 14 |
+
- pathology
|
| 15 |
+
- ophthalmology
|
| 16 |
+
- chest-x-ray
|
| 17 |
+
- onnx
|
| 18 |
+
- onnxruntime-genai
|
| 19 |
+
- onnxruntime
|
| 20 |
+
|
| 21 |
+
---
|
| 22 |
+
# MedGemma model card
|
| 23 |
+
|
| 24 |
+
**Model documentation:** [MedGemma](https://developers.google.com/health-ai-developer-foundations/medgemma)
|
| 25 |
+
|
| 26 |
+
**Resources:**
|
| 27 |
+
|
| 28 |
+
* Model on Google Cloud Model Garden: [MedGemma](https://console.cloud.google.com/vertex-ai/publishers/google/model-garden/medgemma)
|
| 29 |
+
* Model on Hugging Face: [MedGemma](https://huggingface.co/collections/google/medgemma-release-680aade845f90bec6a3f60c4)
|
| 30 |
+
* GitHub repository (supporting code, Colab notebooks, discussions, and
|
| 31 |
+
issues): [MedGemma](https://github.com/google-health/medgemma)
|
| 32 |
+
* Quick start notebook: [GitHub](https://github.com/google-health/medgemma/blob/main/notebooks/quick_start_with_hugging_face.ipynb)
|
| 33 |
+
* Fine-tuning notebook: [GitHub](https://github.com/google-health/medgemma/blob/main/notebooks/fine_tune_with_hugging_face.ipynb)
|
| 34 |
+
* [Patient Education Demo built using MedGemma](https://huggingface.co/spaces/google/rad_explain)
|
| 35 |
+
* Support: See [Contact](https://developers.google.com/health-ai-developer-foundations/medgemma/get-started.md#contact)
|
| 36 |
+
* License: The use of MedGemma is governed by the [Health AI Developer
|
| 37 |
+
Foundations terms of
|
| 38 |
+
use](https://developers.google.com/health-ai-developer-foundations/terms).
|
| 39 |
+
**Author:** Google
|
| 40 |
+
|
| 41 |
+
## Model information
|
| 42 |
+
|
| 43 |
+
This section describes the MedGemma model and how to use it.
|
| 44 |
+
|
| 45 |
+
### Description
|
| 46 |
+
|
| 47 |
+
MedGemma is a collection of [Gemma 3](https://ai.google.dev/gemma/docs/core)
|
| 48 |
+
variants that are trained for performance on medical text and image
|
| 49 |
+
comprehension. Developers can use MedGemma to accelerate building
|
| 50 |
+
healthcare-based AI applications. MedGemma currently comes in two variants: a 4B
|
| 51 |
+
multimodal version and a 27B text-only version.
|
| 52 |
+
|
| 53 |
+
MedGemma 4B utilizes a [SigLIP](https://arxiv.org/abs/2303.15343) image encoder
|
| 54 |
+
that has been specifically pre-trained on a variety of de-identified medical
|
| 55 |
+
data, including chest X-rays, dermatology images, ophthalmology images, and
|
| 56 |
+
histopathology slides. Its LLM component is trained on a diverse set of medical
|
| 57 |
+
data, including radiology images, histopathology patches, ophthalmology images,
|
| 58 |
+
and dermatology images.
|
| 59 |
+
|
| 60 |
+
MedGemma 4B is available in both pre-trained (suffix: `-pt`) and
|
| 61 |
+
instruction-tuned (suffix `-it`) versions. The instruction-tuned version is a
|
| 62 |
+
better starting point for most applications. The pre-trained version is
|
| 63 |
+
available for those who want to experiment more deeply with the models.
|
| 64 |
+
|
| 65 |
+
MedGemma 27B has been trained exclusively on medical text and optimized for
|
| 66 |
+
inference-time computation. MedGemma 27B is only available as an
|
| 67 |
+
instruction-tuned model.
|
| 68 |
+
|
| 69 |
+
MedGemma variants have been evaluated on a range of clinically relevant
|
| 70 |
+
benchmarks to illustrate their baseline performance. These include both open
|
| 71 |
+
benchmark datasets and curated datasets. Developers can fine-tune MedGemma
|
| 72 |
+
variants for improved performance. Consult the Intended Use section below for
|
| 73 |
+
more details.
|
| 74 |
+
|
| 75 |
+
A full technical report will be available soon.
|
| 76 |
+
|
| 77 |
+
### How to use
|
| 78 |
+
|
| 79 |
+
Below are some example code snippets to help you quickly get started running the
|
| 80 |
+
model locally on GPU. If you want to use the model at scale, we recommend that
|
| 81 |
+
you create a production version using [Model
|
| 82 |
+
Garden](https://cloud.google.com/model-garden).
|
| 83 |
+
|
| 84 |
+
First, install the Transformers library. Gemma 3 is supported starting from
|
| 85 |
+
transformers 4.50.0.
|
| 86 |
+
|
| 87 |
+
```sh
|
| 88 |
+
$ pip install -U transformers
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
**Run model with the `pipeline` API**
|
| 92 |
+
|
| 93 |
+
```python
|
| 94 |
+
from transformers import pipeline
|
| 95 |
+
from PIL import Image
|
| 96 |
+
import requests
|
| 97 |
+
import torch
|
| 98 |
+
pipe = pipeline(
|
| 99 |
+
"image-text-to-text",
|
| 100 |
+
model="google/medgemma-4b-pt",
|
| 101 |
+
torch_dtype=torch.bfloat16,
|
| 102 |
+
device="cuda",
|
| 103 |
+
)
|
| 104 |
+
# Image attribution: Stillwaterising, CC0, via Wikimedia Commons
|
| 105 |
+
image_url = "https://upload.wikimedia.org/wikipedia/commons/c/c8/Chest_Xray_PA_3-8-2010.png"
|
| 106 |
+
image = Image.open(requests.get(image_url, headers={"User-Agent": "example"}, stream=True).raw)
|
| 107 |
+
output = pipe(
|
| 108 |
+
images=image,
|
| 109 |
+
text="<start_of_image> findings:",
|
| 110 |
+
max_new_tokens=100,
|
| 111 |
+
)
|
| 112 |
+
print(output[0]["generated_text"])
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
**Run the model directly**
|
| 116 |
+
|
| 117 |
+
```python
|
| 118 |
+
# pip install accelerate
|
| 119 |
+
from transformers import AutoProcessor, AutoModelForImageTextToText
|
| 120 |
+
from PIL import Image
|
| 121 |
+
import requests
|
| 122 |
+
import torch
|
| 123 |
+
model_id = "google/medgemma-4b-pt"
|
| 124 |
+
model = AutoModelForImageTextToText.from_pretrained(
|
| 125 |
+
model_id,
|
| 126 |
+
torch_dtype=torch.bfloat16,
|
| 127 |
+
device_map="auto",
|
| 128 |
+
)
|
| 129 |
+
processor = AutoProcessor.from_pretrained(model_id)
|
| 130 |
+
# Image attribution: Stillwaterising, CC0, via Wikimedia Commons
|
| 131 |
+
image_url = "https://upload.wikimedia.org/wikipedia/commons/c/c8/Chest_Xray_PA_3-8-2010.png"
|
| 132 |
+
image = Image.open(
|
| 133 |
+
requests.get(image_url, headers={"User-Agent": "example"}, stream=True).raw
|
| 134 |
+
).convert("RGB")
|
| 135 |
+
prompt = "<start_of_image> findings:"
|
| 136 |
+
inputs = processor(
|
| 137 |
+
text=prompt, images=image, return_tensors="pt"
|
| 138 |
+
).to(model.device, dtype=torch.bfloat16)
|
| 139 |
+
input_len = inputs["input_ids"].shape[-1]
|
| 140 |
+
with torch.inference_mode():
|
| 141 |
+
generation = model.generate(**inputs, max_new_tokens=100, do_sample=False)
|
| 142 |
+
generation = generation[0][input_len:]
|
| 143 |
+
decoded = processor.decode(generation, skip_special_tokens=True)
|
| 144 |
+
print(decoded)
|
| 145 |
+
```
|
| 146 |
+
|
| 147 |
+
### Examples
|
| 148 |
+
|
| 149 |
+
See the following Colab notebooks for examples of how to use MedGemma:
|
| 150 |
+
|
| 151 |
+
* To give the model a quick try, running it locally with weights from Hugging
|
| 152 |
+
Face, see [Quick start notebook in
|
| 153 |
+
Colab](https://colab.research.google.com/github/google-health/medgemma/blob/main/notebooks/quick_start_with_hugging_face.ipynb).
|
| 154 |
+
Note that you will need to use Colab Enterprise to run the 27B model without
|
| 155 |
+
quantization.
|
| 156 |
+
* For an example of fine-tuning the model, see the [Fine-tuning notebook in
|
| 157 |
+
Colab](https://colab.research.google.com/github/google-health/medgemma/blob/main/notebooks/fine_tune_with_hugging_face.ipynb).
|
| 158 |
+
### Model architecture overview
|
| 159 |
+
|
| 160 |
+
The MedGemma model is built based on [Gemma 3](https://ai.google.dev/gemma/) and
|
| 161 |
+
uses the same decoder-only transformer architecture as Gemma 3. To read more
|
| 162 |
+
about the architecture, consult the Gemma 3 [model
|
| 163 |
+
card](https://ai.google.dev/gemma/docs/core/model_card_3).
|
| 164 |
+
|
| 165 |
+
### Technical specifications
|
| 166 |
+
|
| 167 |
+
* **Model type**: Decoder-only Transformer architecture, see the [Gemma 3
|
| 168 |
+
technical
|
| 169 |
+
report](https://storage.googleapis.com/deepmind-media/gemma/Gemma3Report.pdf)
|
| 170 |
+
* **Modalities**: **4B**: Text, vision; **27B**: Text only
|
| 171 |
+
* **Attention mechanism**: Utilizes grouped-query attention (GQA)
|
| 172 |
+
* **Context length**: Supports long context, at least 128K tokens
|
| 173 |
+
* **Key publication**: Coming soon
|
| 174 |
+
* **Model created**: May 20, 2025
|
| 175 |
+
* **Model version**: 1.0.0
|
| 176 |
+
### Citation
|
| 177 |
+
|
| 178 |
+
A technical report is coming soon. In the meantime, if you publish using this
|
| 179 |
+
model, please cite the Hugging Face model page:
|
| 180 |
+
|
| 181 |
+
```none
|
| 182 |
+
@misc{medgemma-hf,
|
| 183 |
+
author = {Google},
|
| 184 |
+
title = {MedGemma Hugging Face}
|
| 185 |
+
howpublished = {\url{https://huggingface.co/collections/google/medgemma-release-680aade845f90bec6a3f60c4}},
|
| 186 |
+
year = {2025},
|
| 187 |
+
note = {Accessed: [Insert Date Accessed, e.g., 2025-05-20]}
|
| 188 |
+
}
|
| 189 |
+
```
|
| 190 |
+
|
| 191 |
+
### Inputs and outputs
|
| 192 |
+
|
| 193 |
+
**Input**:
|
| 194 |
+
|
| 195 |
+
* Text string, such as a question or prompt
|
| 196 |
+
* Images, normalized to 896 x 896 resolution and encoded to 256 tokens each
|
| 197 |
+
* Total input length of 128K tokens
|
| 198 |
+
|
| 199 |
+
**Output**:
|
| 200 |
+
|
| 201 |
+
* Generated text in response to the input, such as an answer to a question,
|
| 202 |
+
analysis of image content, or a summary of a document
|
| 203 |
+
* Total output length of 8192 tokens
|
| 204 |
+
### Performance and validation
|
| 205 |
+
|
| 206 |
+
MedGemma was evaluated across a range of different multimodal classification,
|
| 207 |
+
report generation, visual question answering, and text-based tasks.
|
| 208 |
+
|
| 209 |
+
### Key performance metrics
|
| 210 |
+
|
| 211 |
+
#### Imaging evaluations
|
| 212 |
+
|
| 213 |
+
The multimodal performance of MedGemma 4B was evaluated across a range of
|
| 214 |
+
benchmarks, focusing on radiology, dermatology, histopathology, ophthalmology,
|
| 215 |
+
and multimodal clinical reasoning.
|
| 216 |
+
|
| 217 |
+
MedGemma 4B outperforms the base Gemma 3 4B model across all tested multimodal
|
| 218 |
+
health benchmarks.
|
| 219 |
+
|
| 220 |
+
| Task and metric | MedGemma 4B | Gemma 3 4B |
|
| 221 |
+
| :---- | :---- | :---- |
|
| 222 |
+
| **Medical image classification** | | |
|
| 223 |
+
| MIMIC CXR \- Average F1 for top 5 conditions | 88.9 | 81.1 |
|
| 224 |
+
| CheXpert CXR \- Average F1 for top 5 conditions | 48.1 | 31.2 |
|
| 225 |
+
| DermMCQA\* \- Accuracy | 71.8 | 42.6 |
|
| 226 |
+
| **Visual question answering** | | |
|
| 227 |
+
| SlakeVQA (radiology) \- Tokenized F1 | 62.3 | 38.6 |
|
| 228 |
+
| VQA-Rad\*\* (radiology) \- Tokenized F1 | 49.9 | 38.6 |
|
| 229 |
+
| PathMCQA (histopathology, internal\*\*\*) \- Accuracy | 69.8 | 37.1 |
|
| 230 |
+
| **Knowledge and reasoning** | | |
|
| 231 |
+
| MedXpertQA (text \+ multimodal questions) \- Accuracy | 18.8 | 16.4 |
|
| 232 |
+
*Described in [Liu (2020, Nature
|
| 233 |
+
medicine)](https://www.nature.com/articles/s41591-020-0842-3), presented as a
|
| 234 |
+
4-way MCQ per example for skin condition classification.
|
| 235 |
+
|
| 236 |
+
**Based on "balanced split," described in [Yang (2024,
|
| 237 |
+
arXiv)](https://arxiv.org/pdf/2405.03162).
|
| 238 |
+
***Based on multiple datasets, presented as 3-9 way MCQ per example for
|
| 239 |
+
identification, grading, and subtype for breast, cervical, and prostate cancer.
|
| 240 |
+
#### Chest X-ray report generation
|
| 241 |
+
MedGemma chest X-ray (CXR) report generation performance was evaluated on
|
| 242 |
+
[MIMIC-CXR](https://physionet.org/content/mimic-cxr/2.1.0/) using the [RadGraph
|
| 243 |
+
F1 metric](https://arxiv.org/abs/2106.14463). We compare the MedGemma
|
| 244 |
+
pre-trained checkpoint with our previous best model for CXR report generation,
|
| 245 |
+
[PaliGemma 2](https://arxiv.org/abs/2412.03555).
|
| 246 |
+
| Metric | MedGemma 4B (pre-trained) | PaliGemma 2 3B (tuned for CXR) | PaliGemma 2 10B (tuned for CXR) |
|
| 247 |
+
| :---- | :---- | :---- | :---- |
|
| 248 |
+
| **Chest X-ray report generation** | | | |
|
| 249 |
+
| MIMIC CXR \- RadGraph F1 | 29.5 | 28.8 | 29.5 |
|
| 250 |
+
The instruction-tuned versions of MedGemma 4B and Gemma 3 4B achieve lower
|
| 251 |
+
scores (0.22 and 0.12, respectively) due to the differences in reporting style
|
| 252 |
+
compared to the MIMIC ground truth reports. Further fine-tuning on MIMIC reports
|
| 253 |
+
will enable users to achieve improved performance.
|
| 254 |
+
#### Text evaluations
|
| 255 |
+
MedGemma 4B and text-only MedGemma 27B were evaluated across a range of
|
| 256 |
+
text-only benchmarks for medical knowledge and reasoning.
|
| 257 |
+
The MedGemma models outperform their respective base Gemma models across all
|
| 258 |
+
tested text-only health benchmarks.
|
| 259 |
+
| Metric | MedGemma 27B | Gemma 3 27B | MedGemma 4B | Gemma 3 4B |
|
| 260 |
+
| :---- | :---- | :---- | :---- | :---- |
|
| 261 |
+
| MedQA (4-op) | 89.8 (best-of-5) 87.7 (0-shot) | 74.9 | 64.4 | 50.7 |
|
| 262 |
+
| MedMCQA | 74.2 | 62.6 | 55.7 | 45.4 |
|
| 263 |
+
| PubMedQA | 76.8 | 73.4 | 73.4 | 68.4 |
|
| 264 |
+
| MMLU Med (text only) | 87.0 | 83.3 | 70.0 | 67.2 |
|
| 265 |
+
| MedXpertQA (text only) | 26.7 | 15.7 | 14.2 | 11.6 |
|
| 266 |
+
| AfriMed-QA | 84.0 | 72.0 | 52.0 | 48.0 |
|
| 267 |
+
For all MedGemma 27B results, [test-time
|
| 268 |
+
scaling](https://arxiv.org/abs/2501.19393) is used to improve performance.
|
| 269 |
+
### Ethics and safety evaluation
|
| 270 |
+
#### Evaluation approach
|
| 271 |
+
Our evaluation methods include structured evaluations and internal red-teaming
|
| 272 |
+
testing of relevant content policies. Red-teaming was conducted by a number of
|
| 273 |
+
different teams, each with different goals and human evaluation metrics. These
|
| 274 |
+
models were evaluated against a number of different categories relevant to
|
| 275 |
+
ethics and safety, including:
|
| 276 |
+
* **Child safety**: Evaluation of text-to-text and image-to-text prompts
|
| 277 |
+
covering child safety policies, including child sexual abuse and
|
| 278 |
+
exploitation.
|
| 279 |
+
* **Content safety:** Evaluation of text-to-text and image-to-text prompts
|
| 280 |
+
covering safety policies, including harassment, violence and gore, and hate
|
| 281 |
+
speech.
|
| 282 |
+
* **Representational harms**: Evaluation of text-to-text and image-to-text
|
| 283 |
+
prompts covering safety policies, including bias, stereotyping, and harmful
|
| 284 |
+
associations or inaccuracies.
|
| 285 |
+
* **General medical harms:** Evaluation of text-to-text and image-to-text
|
| 286 |
+
prompts covering safety policies, including information quality and harmful
|
| 287 |
+
associations or inaccuracies.
|
| 288 |
+
In addition to development level evaluations, we conduct "assurance evaluations"
|
| 289 |
+
which are our "arms-length" internal evaluations for responsibility governance
|
| 290 |
+
decision making. They are conducted separately from the model development team,
|
| 291 |
+
to inform decision making about release. High-level findings are fed back to the
|
| 292 |
+
model team, but prompt sets are held out to prevent overfitting and preserve the
|
| 293 |
+
results' ability to inform decision making. Notable assurance evaluation results
|
| 294 |
+
are reported to our Responsibility & Safety Council as part of release review.
|
| 295 |
+
|
| 296 |
+
#### Evaluation results
|
| 297 |
+
|
| 298 |
+
For all areas of safety testing, we saw safe levels of performance across the
|
| 299 |
+
categories of child safety, content safety, and representational harms. All
|
| 300 |
+
testing was conducted without safety filters to evaluate the model capabilities
|
| 301 |
+
and behaviors. For text-to-text, image-to-text, and audio-to-text, and across
|
| 302 |
+
both MedGemma model sizes, the model produced minimal policy violations. A
|
| 303 |
+
limitation of our evaluations was that they included primarily English language
|
| 304 |
+
prompts.
|
| 305 |
+
|
| 306 |
+
## Data card
|
| 307 |
+
|
| 308 |
+
### Dataset overview
|
| 309 |
+
|
| 310 |
+
#### Training
|
| 311 |
+
|
| 312 |
+
The base Gemma models are pre-trained on a large corpus of text and code data.
|
| 313 |
+
MedGemma 4B utilizes a [SigLIP](https://arxiv.org/abs/2303.15343) image encoder
|
| 314 |
+
that has been specifically pre-trained on a variety of de-identified medical
|
| 315 |
+
data, including radiology images, histopathology images, ophthalmology images,
|
| 316 |
+
and dermatology images. Its LLM component is trained on a diverse set of medical
|
| 317 |
+
data, including medical text relevant to radiology images, chest-x rays,
|
| 318 |
+
histopathology patches, ophthalmology images and dermatology images.
|
| 319 |
+
|
| 320 |
+
#### Evaluation
|
| 321 |
+
|
| 322 |
+
MedGemma models have been evaluated on a comprehensive set of clinically
|
| 323 |
+
relevant benchmarks, including over 22 datasets across 5 different tasks and 6
|
| 324 |
+
medical image modalities. These include both open benchmark datasets and curated
|
| 325 |
+
datasets, with a focus on expert human evaluations for tasks like CXR report
|
| 326 |
+
generation and radiology VQA.
|
| 327 |
+
|
| 328 |
+
#### Source
|
| 329 |
+
|
| 330 |
+
MedGemma utilizes a combination of public and private datasets.
|
| 331 |
+
|
| 332 |
+
This model was trained on diverse public datasets including MIMIC-CXR (chest
|
| 333 |
+
X-rays and reports), Slake-VQA (multimodal medical images and questions),
|
| 334 |
+
PAD-UFES-20 (skin lesion images and data), SCIN (dermatology images), TCGA
|
| 335 |
+
(cancer genomics data), CAMELYON (lymph node histopathology images), PMC-OA
|
| 336 |
+
(biomedical literature with images), and Mendeley Digital Knee X-Ray (knee
|
| 337 |
+
X-rays).
|
| 338 |
+
|
| 339 |
+
Additionally, multiple diverse proprietary datasets were licensed and
|
| 340 |
+
incorporated (described next).
|
| 341 |
+
|
| 342 |
+
### Data Ownership and Documentation
|
| 343 |
+
|
| 344 |
+
* [Mimic-CXR](https://physionet.org/content/mimic-cxr/2.1.0/): MIT Laboratory
|
| 345 |
+
for Computational Physiology and Beth Israel Deaconess Medical Center
|
| 346 |
+
(BIDMC).
|
| 347 |
+
* [Slake-VQA](https://www.med-vqa.com/slake/): The Hong Kong Polytechnic
|
| 348 |
+
University (PolyU), with collaborators including West China Hospital of
|
| 349 |
+
Sichuan University and Sichuan Academy of Medical Sciences / Sichuan
|
| 350 |
+
Provincial People's Hospital.
|
| 351 |
+
* [PAD-UFES-20](https://pmc.ncbi.nlm.nih.gov/articles/PMC7479321/): Federal
|
| 352 |
+
University of Espírito Santo (UFES), Brazil, through its Dermatological and
|
| 353 |
+
Surgical Assistance Program (PAD).
|
| 354 |
+
* [SCIN](https://github.com/google-research-datasets/scin): A collaboration
|
| 355 |
+
between Google Health and Stanford Medicine.
|
| 356 |
+
* [TCGA](https://portal.gdc.cancer.gov/) (The Cancer Genome Atlas): A joint
|
| 357 |
+
effort of National Cancer Institute and National Human Genome Research
|
| 358 |
+
Institute. Data from TCGA are available via the Genomic Data Commons (GDC)
|
| 359 |
+
* [CAMELYON](https://camelyon17.grand-challenge.org/Data/): The data was
|
| 360 |
+
collected from Radboud University Medical Center and University Medical
|
| 361 |
+
Center Utrecht in the Netherlands.
|
| 362 |
+
* [PMC-OA (PubMed Central Open Access
|
| 363 |
+
Subset)](https://catalog.data.gov/dataset/pubmed-central-open-access-subset-pmc-oa):
|
| 364 |
+
Maintained by the National Library of Medicine (NLM) and National Center for
|
| 365 |
+
Biotechnology Information (NCBI), which are part of the NIH.
|
| 366 |
+
* [MedQA](https://arxiv.org/pdf/2009.13081): This dataset was created by a
|
| 367 |
+
team of researchers led by Di Jin, Eileen Pan, Nassim Oufattole, Wei-Hung
|
| 368 |
+
Weng, Hanyi Fang, and Peter Szolovits
|
| 369 |
+
* [Mendeley Digital Knee
|
| 370 |
+
X-Ray](https://data.mendeley.com/datasets/t9ndx37v5h/1): This dataset is
|
| 371 |
+
from Rani Channamma University, and is hosted on Mendeley Data.
|
| 372 |
+
* [AfriMed-QA](https://afrimedqa.com/): This data was developed and led by
|
| 373 |
+
multiple collaborating organizations and researchers include key
|
| 374 |
+
contributors: Intron Health, SisonkeBiotik, BioRAMP, Georgia Institute of
|
| 375 |
+
Technology, and MasakhaneNLP.
|
| 376 |
+
* [VQA-RAD](https://www.nature.com/articles/sdata2018251): This dataset was
|
| 377 |
+
created by a research team led by Jason J. Lau, Soumya Gayen, Asma Ben
|
| 378 |
+
Abacha, and Dina Demner-Fushman and their affiliated institutions (the US
|
| 379 |
+
National Library of Medicine and National Institutes of Health)
|
| 380 |
+
* [MedExpQA](https://www.sciencedirect.com/science/article/pii/S0933365724001805):
|
| 381 |
+
This dataset was created by researchers at the HiTZ Center (Basque Center
|
| 382 |
+
for Language Technology and Artificial Intelligence).
|
| 383 |
+
* [MedXpertQA](https://huggingface.co/datasets/TsinghuaC3I/MedXpertQA): This
|
| 384 |
+
dataset was developed by researchers at Tsinghua University (Beijing, China)
|
| 385 |
+
and Shanghai Artificial Intelligence Laboratory (Shanghai, China).
|
| 386 |
+
In addition to the public datasets listed above, MedGemma was also trained on
|
| 387 |
+
de-identified datasets licensed for research or collected internally at Google
|
| 388 |
+
from consented participants.
|
| 389 |
+
|
| 390 |
+
* Radiology dataset 1: De-identified dataset of different CT studies across
|
| 391 |
+
body parts from a US-based radiology outpatient diagnostic center network.
|
| 392 |
+
* Ophthalmology dataset 1: De-identified dataset of fundus images from
|
| 393 |
+
diabetic retinopathy screening.
|
| 394 |
+
* Dermatology dataset 1: De-identified dataset of teledermatology skin
|
| 395 |
+
condition images (both clinical and dermatoscopic) from Colombia.
|
| 396 |
+
* Dermatology dataset 2: De-identified dataset of skin cancer images (both
|
| 397 |
+
clinical and dermatoscopic) from Australia.
|
| 398 |
+
* Dermatology dataset 3: De-identified dataset of non-diseased skin images
|
| 399 |
+
from an internal data collection effort.
|
| 400 |
+
* Pathology dataset 1: De-identified dataset of histopathology H&E whole slide
|
| 401 |
+
images created in collaboration with an academic research hospital and
|
| 402 |
+
biobank in Europe. Comprises de-identified colon, prostate, and lymph nodes.
|
| 403 |
+
* Pathology dataset 2: De-identified dataset of lung histopathology H&E and
|
| 404 |
+
IHC whole slide images created by a commercial biobank in the United States.
|
| 405 |
+
* Pathology dataset 3: De-identified dataset of prostate and lymph node H&E
|
| 406 |
+
and IHC histopathology whole slide images created by a contract research
|
| 407 |
+
organization in the United States.
|
| 408 |
+
* Pathology dataset 4: De-identified dataset of histopathology, predominantly
|
| 409 |
+
H\&E whole slide images created in collaboration with a large, tertiary
|
| 410 |
+
teaching hospital in the United States. Comprises a diverse set of tissue
|
| 411 |
+
and stain types, predominantly H&E.
|
| 412 |
+
### Data citation
|
| 413 |
+
|
| 414 |
+
* **MIMIC-CXR** Johnson, A., Pollard, T., Mark, R., Berkowitz, S., & Horng, S.
|
| 415 |
+
(2024). MIMIC-CXR Database (version 2.1.0). PhysioNet.
|
| 416 |
+
https://physionet.org/content/mimic-cxr/2.1.0/
|
| 417 |
+
*and* Johnson, Alistair E. W., Tom J. Pollard, Seth J. Berkowitz, Nathaniel R.
|
| 418 |
+
Greenbaum, Matthew P. Lungren, Chih-Ying Deng, Roger G. Mark, and Steven
|
| 419 |
+
Horng. 2019. "MIMIC-CXR, a de-Identified Publicly Available Database of
|
| 420 |
+
Chest Radiographs with Free-Text Reports." *Scientific Data 6* (1): 1–8.
|
| 421 |
+
* **SLAKE** Liu, Bo, Li-Ming Zhan, Li Xu, Lin Ma, Yan Yang, and Xiao-Ming Wu.
|
| 422 |
+
2021.SLAKE: A Semantically-Labeled Knowledge-Enhanced Dataset for Medical
|
| 423 |
+
Visual Question Answering." http://arxiv.org/abs/2102.09542.
|
| 424 |
+
* **PAD-UEFS** Pacheco, A. G. C., Lima, G. R., Salomao, A., Krohling, B.,
|
| 425 |
+
Biral, I. P., de Angelo, G. G., Alves, F. O. G., Ju X. M., & P. R. C.
|
| 426 |
+
(2020). PAD-UFES-20: A skin lesion dataset composed of patient data and
|
| 427 |
+
clinical images collected from smartphones. In *Proceedings of the 2020 IEEE
|
| 428 |
+
International Conference on Bioinformatics and Biomedicine (BIBM)* (pp.
|
| 429 |
+
1551-1558). IEEE. https://doi.org/10.1109/BIBM49941.2020.9313241
|
| 430 |
+
* **SCIN** Ward, Abbi, Jimmy Li, Julie Wang, Sriram Lakshminarasimhan, Ashley
|
| 431 |
+
Carrick, Bilson Campana, Jay Hartford, et al. 2024. "Creating an Empirical
|
| 432 |
+
Dermatology Dataset Through Crowdsourcing With Web Search Advertisements."
|
| 433 |
+
*JAMA Network Open 7* (11): e2446615–e2446615.
|
| 434 |
+
* **TCGA** The results shown here are in whole or part based upon data
|
| 435 |
+
generated by the TCGA Research Network: https://www.cancer.gov/tcga.
|
| 436 |
+
* **CAMELYON16** Ehteshami Bejnordi, Babak, Mitko Veta, Paul Johannes van
|
| 437 |
+
Diest, Bram van Ginneken, Nico Karssemeijer, Geert Litjens, Jeroen A. W. M.
|
| 438 |
+
van der Laak, et al. 2017. "Diagnostic Assessment of Deep Learning
|
| 439 |
+
Algorithms for Detection of Lymph Node Metastases in Women With Breast
|
| 440 |
+
Cancer." *JAMA 318* (22): 2199–2210.
|
| 441 |
+
* **MedQA** Jin, Di, Eileen Pan, Nassim Oufattole, Wei-Hung Weng, Hanyi Fang,
|
| 442 |
+
and Peter Szolovits. 2020. "What Disease Does This Patient Have? A
|
| 443 |
+
Large-Scale Open Domain Question Answering Dataset from Medical Exams."
|
| 444 |
+
http://arxiv.org/abs/2009.13081.
|
| 445 |
+
* **Mendeley Digital Knee X-Ray** Gornale, Shivanand; Patravali, Pooja (2020),
|
| 446 |
+
"Digital Knee X-ray Images", Mendeley Data, V1, doi: 10.17632/t9ndx37v5h.1
|
| 447 |
+
* **AfrimedQA** Olatunji, Tobi, Charles Nimo, Abraham Owodunni, Tassallah
|
| 448 |
+
Abdullahi, Emmanuel Ayodele, Mardhiyah Sanni, Chinemelu Aka, et al. 2024.
|
| 449 |
+
"AfriMed-QA: A Pan-African, Multi-Specialty, Medical Question-Answering
|
| 450 |
+
Benchmark Dataset." http://arxiv.org/abs/2411.15640.
|
| 451 |
+
* **VQA-RAD** Lau, Jason J., Soumya Gayen, Asma Ben Abacha, and Dina
|
| 452 |
+
Demner-Fushman. 2018. "A Dataset of Clinically Generated Visual Questions
|
| 453 |
+
and Answers about Radiology Images." *Scientific Data 5* (1): 1–10.
|
| 454 |
+
* **MedexpQA** Alonso, I., Oronoz, M., & Agerri, R. (2024). MedExpQA:
|
| 455 |
+
Multilingual Benchmarking of Large Language Models for Medical Question
|
| 456 |
+
Answering. *arXiv preprint arXiv:2404.05590*. Retrieved from
|
| 457 |
+
https://arxiv.org/abs/2404.05590
|
| 458 |
+
* **MedXpertQA** Zuo, Yuxin, Shang Qu, Yifei Li, Zhangren Chen, Xuekai Zhu,
|
| 459 |
+
Ermo Hua, Kaiyan Zhang, Ning Ding, and Bowen Zhou. 2025. "MedXpertQA:
|
| 460 |
+
Benchmarking Expert-Level Medical Reasoning and Understanding."
|
| 461 |
+
http://arxiv.org/abs/2501.18362.
|
| 462 |
+
### De-identification/anonymization:
|
| 463 |
+
|
| 464 |
+
Google and partnerships utilize datasets that have been rigorously anonymized or
|
| 465 |
+
de-identified to ensure the protection of individual research participants and
|
| 466 |
+
patient privacy
|
| 467 |
+
|
| 468 |
+
## Implementation information
|
| 469 |
+
|
| 470 |
+
Details about the model internals.
|
| 471 |
+
|
| 472 |
+
### Software
|
| 473 |
+
|
| 474 |
+
Training was done using [JAX](https://github.com/jax-ml/jax).
|
| 475 |
+
|
| 476 |
+
JAX allows researchers to take advantage of the latest generation of hardware,
|
| 477 |
+
including TPUs, for faster and more efficient training of large models.
|
| 478 |
+
|
| 479 |
+
## Use and limitations
|
| 480 |
+
|
| 481 |
+
### Intended use
|
| 482 |
+
|
| 483 |
+
MedGemma is an open multimodal generative AI model intended to be used as a
|
| 484 |
+
starting point that enables more efficient development of downstream healthcare
|
| 485 |
+
applications involving medical text and images. MedGemma is intended for
|
| 486 |
+
developers in the life sciences and healthcare space. Developers are responsible
|
| 487 |
+
for training, adapting and making meaningful changes to MedGemma to accomplish
|
| 488 |
+
their specific intended use. MedGemma models can be fine-tuned by developers
|
| 489 |
+
using their own proprietary data for their specific tasks or solutions.
|
| 490 |
+
|
| 491 |
+
MedGemma is based on Gemma 3 and has been further trained on medical images and
|
| 492 |
+
text. MedGemma enables further development in any medical context (image and
|
| 493 |
+
textual), however the model was pre-trained using chest X-ray, pathology,
|
| 494 |
+
dermatology, and fundus images. Examples of tasks within MedGemma's training
|
| 495 |
+
include visual question answering pertaining to medical images, such as
|
| 496 |
+
radiographs, or providing answers to textual medical questions. Full details of
|
| 497 |
+
all the tasks MedGemma has been evaluated can be found in an upcoming technical
|
| 498 |
+
report.
|
| 499 |
+
|
| 500 |
+
### Benefits
|
| 501 |
+
|
| 502 |
+
* Provides strong baseline medical image and text comprehension for models of
|
| 503 |
+
its size.
|
| 504 |
+
* This strong performance makes it efficient to adapt for downstream
|
| 505 |
+
healthcare-based use cases, compared to models of similar size without
|
| 506 |
+
medical data pre-training.
|
| 507 |
+
* This adaptation may involve prompt engineering, grounding, agentic
|
| 508 |
+
orchestration or fine-tuning depending on the use case, baseline validation
|
| 509 |
+
requirements, and desired performance characteristics.
|
| 510 |
+
### Limitations
|
| 511 |
+
|
| 512 |
+
MedGemma is not intended to be used without appropriate validation, adaptation
|
| 513 |
+
and/or making meaningful modification by developers for their specific use case.
|
| 514 |
+
The outputs generated by MedGemma are not intended to directly inform clinical
|
| 515 |
+
diagnosis, patient management decisions, treatment recommendations, or any other
|
| 516 |
+
direct clinical practice applications. Performance benchmarks highlight baseline
|
| 517 |
+
capabilities on relevant benchmarks, but even for image and text domains that
|
| 518 |
+
constitute a substantial portion of training data, inaccurate model output is
|
| 519 |
+
possible. All outputs from MedGemma should be considered preliminary and require
|
| 520 |
+
independent verification, clinical correlation, and further investigation
|
| 521 |
+
through established research and development methodologies.
|
| 522 |
+
|
| 523 |
+
MedGemma's multimodal capabilities have been primarily evaluated on single-image
|
| 524 |
+
tasks. MedGemma has not been evaluated in use cases that involve comprehension
|
| 525 |
+
of multiple images.
|
| 526 |
+
|
| 527 |
+
MedGemma has not been evaluated or optimized for multi-turn applications.
|
| 528 |
+
|
| 529 |
+
MedGemma's training may make it more sensitive to the specific prompt used than
|
| 530 |
+
Gemma 3.
|
| 531 |
+
|
| 532 |
+
When adapting MedGemma developer should consider the following:
|
| 533 |
+
|
| 534 |
+
* **Bias in validation data:** As with any research, developers should ensure
|
| 535 |
+
that any downstream application is validated to understand performance using
|
| 536 |
+
data that is appropriately representative of the intended use setting for
|
| 537 |
+
the specific application (e.g., age, sex, gender, condition, imaging device,
|
| 538 |
+
etc).
|
| 539 |
+
* **Data contamination concerns**: When evaluating the generalization
|
| 540 |
+
capabilities of a large model like MedGemma in a medical context, there is a
|
| 541 |
+
risk of data contamination, where the model might have inadvertently seen
|
| 542 |
+
related medical information during its pre-training, potentially
|
| 543 |
+
overestimating its true ability to generalize to novel medical concepts.
|
| 544 |
+
Developers should validate MedGemma on datasets not publicly available or
|
| 545 |
+
otherwise made available to non-institutional researchers to mitigate this
|
| 546 |
+
risk.
|
added_tokens.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"<image_soft_token>": 262144
|
| 3 |
+
}
|
genai_config.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": {
|
| 3 |
+
"bos_token_id": 2,
|
| 4 |
+
"context_length": 131072,
|
| 5 |
+
"decoder": {
|
| 6 |
+
"session_options": {
|
| 7 |
+
"log_id": "onnxruntime-genai",
|
| 8 |
+
"provider_options": []
|
| 9 |
+
},
|
| 10 |
+
"filename": "model.onnx",
|
| 11 |
+
"head_size": 256,
|
| 12 |
+
"hidden_size": 2560,
|
| 13 |
+
"inputs": {
|
| 14 |
+
"input_ids": "input_ids",
|
| 15 |
+
"attention_mask": "attention_mask",
|
| 16 |
+
"position_ids": "position_ids",
|
| 17 |
+
"past_key_names": "past_key_values.%d.key",
|
| 18 |
+
"past_value_names": "past_key_values.%d.value"
|
| 19 |
+
},
|
| 20 |
+
"outputs": {
|
| 21 |
+
"logits": "logits",
|
| 22 |
+
"present_key_names": "present.%d.key",
|
| 23 |
+
"present_value_names": "present.%d.value"
|
| 24 |
+
},
|
| 25 |
+
"num_attention_heads": 8,
|
| 26 |
+
"num_hidden_layers": 34,
|
| 27 |
+
"num_key_value_heads": 4
|
| 28 |
+
},
|
| 29 |
+
"eos_token_id": 1,
|
| 30 |
+
"pad_token_id": 0,
|
| 31 |
+
"type": "gemma3",
|
| 32 |
+
"vocab_size": 262208
|
| 33 |
+
},
|
| 34 |
+
"search": {
|
| 35 |
+
"diversity_penalty": 0.0,
|
| 36 |
+
"do_sample": true,
|
| 37 |
+
"early_stopping": true,
|
| 38 |
+
"length_penalty": 1.0,
|
| 39 |
+
"max_length": 131072,
|
| 40 |
+
"min_length": 0,
|
| 41 |
+
"no_repeat_ngram_size": 0,
|
| 42 |
+
"num_beams": 1,
|
| 43 |
+
"num_return_sequences": 1,
|
| 44 |
+
"past_present_share_buffer": false,
|
| 45 |
+
"repetition_penalty": 1.0,
|
| 46 |
+
"temperature": 1.0,
|
| 47 |
+
"top_k": 1,
|
| 48 |
+
"top_p": 0.95
|
| 49 |
+
}
|
| 50 |
+
}
|
model.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9cad30c1880b227f881111730256e62c197c3131bd88ef08950217f895f55e65
|
| 3 |
+
size 1012280
|
model.onnx.data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cfef8b96435cd84367c2ab8ab8d442d0acb2aad7ff25487490744ea8512abf34
|
| 3 |
+
size 9237985280
|
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
|
|
|