Upload folder using huggingface_hub
Browse files- README.md +308 -152
- chat_template.jinja +47 -0
- config.json +37 -3
- generation_config.json +2 -5
- model-00001-of-00002.safetensors +1 -1
- model.safetensors.index.json +1 -0
- tokenizer_config.json +32 -32
README.md
CHANGED
|
@@ -34,7 +34,7 @@ tags:
|
|
| 34 |
<a href="https://discord.gg/unsloth">
|
| 35 |
<img src="https://github.com/unslothai/unsloth/raw/main/images/Discord%20button.png" width="173">
|
| 36 |
</a>
|
| 37 |
-
<a href="https://docs.unsloth.ai/
|
| 38 |
<img src="https://raw.githubusercontent.com/unslothai/unsloth/refs/heads/main/images/documentation%20green%20button.png" width="143">
|
| 39 |
</a>
|
| 40 |
</div>
|
|
@@ -53,7 +53,7 @@ tags:
|
|
| 53 |
issues): [MedGemma](https://github.com/google-health/medgemma)
|
| 54 |
* Quick start notebook: [GitHub](https://github.com/google-health/medgemma/blob/main/notebooks/quick_start_with_hugging_face.ipynb)
|
| 55 |
* Fine-tuning notebook: [GitHub](https://github.com/google-health/medgemma/blob/main/notebooks/fine_tune_with_hugging_face.ipynb)
|
| 56 |
-
*
|
| 57 |
* Support: See [Contact](https://developers.google.com/health-ai-developer-foundations/medgemma/get-started.md#contact)
|
| 58 |
* License: The use of MedGemma is governed by the [Health AI Developer
|
| 59 |
Foundations terms of
|
|
@@ -70,32 +70,50 @@ This section describes the MedGemma model and how to use it.
|
|
| 70 |
MedGemma is a collection of [Gemma 3](https://ai.google.dev/gemma/docs/core)
|
| 71 |
variants that are trained for performance on medical text and image
|
| 72 |
comprehension. Developers can use MedGemma to accelerate building
|
| 73 |
-
healthcare-based AI applications. MedGemma currently comes in
|
| 74 |
-
multimodal version and
|
| 75 |
-
|
| 76 |
-
MedGemma
|
| 77 |
-
that has been
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
|
|
|
|
|
|
| 82 |
|
| 83 |
MedGemma 4B is available in both pre-trained (suffix: `-pt`) and
|
| 84 |
instruction-tuned (suffix `-it`) versions. The instruction-tuned version is a
|
| 85 |
-
better starting point for most applications. The pre-trained version
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
MedGemma 27B has
|
| 89 |
-
|
| 90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
MedGemma variants have been evaluated on a range of clinically relevant
|
| 93 |
-
benchmarks to illustrate their baseline performance. These
|
| 94 |
-
benchmark datasets and curated datasets. Developers can fine-tune
|
| 95 |
-
variants for improved performance. Consult the Intended
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
|
| 100 |
### How to use
|
| 101 |
|
|
@@ -104,14 +122,6 @@ model locally on GPU. If you want to use the model at scale, we recommend that
|
|
| 104 |
you create a production version using [Model
|
| 105 |
Garden](https://cloud.google.com/model-garden).
|
| 106 |
|
| 107 |
-
|
| 108 |
-
First, install the Transformers library. Gemma 3 is supported starting from
|
| 109 |
-
transformers 4.50.0.
|
| 110 |
-
|
| 111 |
-
```sh
|
| 112 |
-
$ pip install -U transformers
|
| 113 |
-
```
|
| 114 |
-
|
| 115 |
First, install the Transformers library. Gemma 3 is supported starting from
|
| 116 |
transformers 4.50.0.
|
| 117 |
|
|
@@ -146,8 +156,8 @@ messages = [
|
|
| 146 |
{
|
| 147 |
"role": "user",
|
| 148 |
"content": [
|
| 149 |
-
{"type": "text", "text": "Describe this X-ray"}
|
| 150 |
-
{"type": "image", "image": image}
|
| 151 |
]
|
| 152 |
}
|
| 153 |
]
|
|
@@ -213,43 +223,47 @@ See the following Colab notebooks for examples of how to use MedGemma:
|
|
| 213 |
|
| 214 |
* To give the model a quick try, running it locally with weights from Hugging
|
| 215 |
Face, see [Quick start notebook in
|
| 216 |
-
Colab](https://colab.research.google.com/github/google-health/medgemma/blob/main/notebooks/quick_start_with_hugging_face.ipynb).
|
| 217 |
-
|
|
|
|
| 218 |
|
| 219 |
-
* For an example of fine-tuning the model, see the [Fine-tuning notebook in
|
| 220 |
Colab](https://colab.research.google.com/github/google-health/medgemma/blob/main/notebooks/fine_tune_with_hugging_face.ipynb).
|
|
|
|
|
|
|
| 221 |
|
| 222 |
### Model architecture overview
|
| 223 |
|
| 224 |
The MedGemma model is built based on [Gemma 3](https://ai.google.dev/gemma/) and
|
| 225 |
-
uses the same decoder-only transformer architecture as Gemma 3
|
| 226 |
about the architecture, consult the Gemma 3 [model
|
| 227 |
card](https://ai.google.dev/gemma/docs/core/model_card_3).
|
| 228 |
|
| 229 |
### Technical specifications
|
| 230 |
|
| 231 |
* **Model type**: Decoder-only Transformer architecture, see the [Gemma 3
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
* **Modalities**:
|
| 235 |
-
* **
|
|
|
|
| 236 |
* **Context length**: Supports long context, at least 128K tokens
|
| 237 |
-
* **Key publication**:
|
| 238 |
-
* **Model created**:
|
| 239 |
-
|
|
|
|
| 240 |
|
| 241 |
### Citation
|
| 242 |
|
| 243 |
-
|
| 244 |
-
|
| 245 |
|
| 246 |
```none
|
| 247 |
-
@
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
note = {Accessed: [Insert Date Accessed, e.g., 2025-05-20]}
|
| 253 |
}
|
| 254 |
```
|
| 255 |
|
|
@@ -276,33 +290,42 @@ report generation, visual question answering, and text-based tasks.
|
|
| 276 |
|
| 277 |
#### Imaging evaluations
|
| 278 |
|
| 279 |
-
The multimodal performance of MedGemma 4B
|
| 280 |
-
benchmarks, focusing on radiology, dermatology,
|
| 281 |
-
and multimodal clinical reasoning.
|
| 282 |
|
| 283 |
MedGemma 4B outperforms the base Gemma 3 4B model across all tested multimodal
|
| 284 |
health benchmarks.
|
| 285 |
|
| 286 |
-
| Task and metric |
|
| 287 |
| :---- | :---- | :---- |
|
| 288 |
| **Medical image classification** | | |
|
| 289 |
-
| MIMIC CXR \-
|
| 290 |
-
| CheXpert CXR \-
|
| 291 |
-
|
|
|
|
|
|
|
|
|
|
|
| 292 |
| **Visual question answering** | | |
|
| 293 |
-
|
|
| 294 |
-
| VQA-
|
| 295 |
-
|
|
| 296 |
-
|
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 306 |
|
| 307 |
#### Chest X-ray report generation
|
| 308 |
|
|
@@ -312,15 +335,17 @@ F1 metric](https://arxiv.org/abs/2106.14463). We compare the MedGemma
|
|
| 312 |
pre-trained checkpoint with our previous best model for CXR report generation,
|
| 313 |
[PaliGemma 2](https://arxiv.org/abs/2412.03555).
|
| 314 |
|
| 315 |
-
| Metric | MedGemma 4B (pre-trained) | PaliGemma 2 3B (tuned for CXR) | PaliGemma 2 10B (tuned for CXR) |
|
| 316 |
-
| :---- | :---- | :---- | :---- |
|
| 317 |
-
|
|
| 318 |
-
|
|
|
|
| 319 |
|
| 320 |
-
The instruction-tuned versions of MedGemma 4B and
|
| 321 |
-
scores (
|
| 322 |
compared to the MIMIC ground truth reports. Further fine-tuning on MIMIC reports
|
| 323 |
-
|
|
|
|
| 324 |
|
| 325 |
#### Text evaluations
|
| 326 |
|
|
@@ -330,18 +355,30 @@ text-only benchmarks for medical knowledge and reasoning.
|
|
| 330 |
The MedGemma models outperform their respective base Gemma models across all
|
| 331 |
tested text-only health benchmarks.
|
| 332 |
|
| 333 |
-
| Metric |
|
| 334 |
-
| :---- | :---- | :---- |
|
| 335 |
-
| MedQA (4-op) |
|
| 336 |
-
| MedMCQA |
|
| 337 |
-
| PubMedQA |
|
| 338 |
-
| MMLU Med
|
| 339 |
-
| MedXpertQA (text only) |
|
| 340 |
-
| AfriMed-QA
|
| 341 |
|
| 342 |
For all MedGemma 27B results, [test-time
|
| 343 |
scaling](https://arxiv.org/abs/2501.19393) is used to improve performance.
|
| 344 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 345 |
### Ethics and safety evaluation
|
| 346 |
|
| 347 |
#### Evaluation approach
|
|
@@ -405,23 +442,88 @@ medical image modalities. These include both open benchmark datasets and curated
|
|
| 405 |
datasets, with a focus on expert human evaluations for tasks like CXR report
|
| 406 |
generation and radiology VQA.
|
| 407 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 408 |
#### Source
|
| 409 |
|
| 410 |
MedGemma utilizes a combination of public and private datasets.
|
| 411 |
|
| 412 |
This model was trained on diverse public datasets including MIMIC-CXR (chest
|
| 413 |
-
X-rays and reports),
|
| 414 |
-
|
| 415 |
-
(
|
| 416 |
-
|
| 417 |
-
|
|
|
|
| 418 |
|
| 419 |
Additionally, multiple diverse proprietary datasets were licensed and
|
| 420 |
incorporated (described next).
|
| 421 |
|
| 422 |
### Data Ownership and Documentation
|
| 423 |
|
| 424 |
-
* [
|
| 425 |
for Computational Physiology and Beth Israel Deaconess Medical Center
|
| 426 |
(BIDMC).
|
| 427 |
* [Slake-VQA](https://www.med-vqa.com/slake/): The Hong Kong Polytechnic
|
|
@@ -457,81 +559,125 @@ incorporated (described next).
|
|
| 457 |
created by a research team led by Jason J. Lau, Soumya Gayen, Asma Ben
|
| 458 |
Abacha, and Dina Demner-Fushman and their affiliated institutions (the US
|
| 459 |
National Library of Medicine and National Institutes of Health)
|
|
|
|
|
|
|
| 460 |
* [MedExpQA](https://www.sciencedirect.com/science/article/pii/S0933365724001805):
|
| 461 |
This dataset was created by researchers at the HiTZ Center (Basque Center
|
| 462 |
for Language Technology and Artificial Intelligence).
|
| 463 |
* [MedXpertQA](https://huggingface.co/datasets/TsinghuaC3I/MedXpertQA): This
|
| 464 |
dataset was developed by researchers at Tsinghua University (Beijing, China)
|
| 465 |
and Shanghai Artificial Intelligence Laboratory (Shanghai, China).
|
|
|
|
|
|
|
|
|
|
| 466 |
|
| 467 |
In addition to the public datasets listed above, MedGemma was also trained on
|
| 468 |
-
de-identified
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
* Radiology dataset 1
|
| 472 |
-
body parts from a US-based radiology outpatient diagnostic center
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
|
|
|
|
| 476 |
condition images (both clinical and dermatoscopic) from Colombia.
|
| 477 |
-
* Dermatology dataset 2
|
| 478 |
clinical and dermatoscopic) from Australia.
|
| 479 |
-
* Dermatology dataset 3
|
| 480 |
from an internal data collection effort.
|
| 481 |
-
* Pathology dataset 1
|
| 482 |
-
images created in collaboration with an academic research hospital and
|
| 483 |
biobank in Europe. Comprises de-identified colon, prostate, and lymph nodes.
|
| 484 |
-
* Pathology dataset 2
|
| 485 |
-
IHC whole slide images created by a commercial biobank in the United
|
| 486 |
-
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
| 492 |
-
and stain types,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 493 |
|
| 494 |
### Data citation
|
| 495 |
|
| 496 |
-
* MIMIC-CXR Johnson, A., Pollard, T., Mark, R., Berkowitz, S., & Horng,
|
| 497 |
-
(2024). MIMIC-CXR Database (version 2.1.0). PhysioNet.
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
|
| 508 |
-
|
| 509 |
-
|
| 510 |
-
|
| 511 |
-
|
| 512 |
-
|
| 513 |
-
*
|
| 514 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 515 |
Algorithms for Detection of Lymph Node Metastases in Women With Breast
|
| 516 |
-
Cancer
|
| 517 |
-
|
| 518 |
-
* Mendeley Digital Knee X-Ray
|
| 519 |
-
"Digital Knee X-ray Images", Mendeley Data, V1, doi:
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
|
| 524 |
-
|
| 525 |
-
|
| 526 |
-
|
| 527 |
-
|
| 528 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 529 |
|
| 530 |
### De-identification/anonymization:
|
| 531 |
|
| 532 |
-
Google and
|
| 533 |
de-identified to ensure the protection of individual research participants and
|
| 534 |
-
patient privacy
|
| 535 |
|
| 536 |
## Implementation information
|
| 537 |
|
|
@@ -562,8 +708,8 @@ textual), however the model was pre-trained using chest X-ray, pathology,
|
|
| 562 |
dermatology, and fundus images. Examples of tasks within MedGemma's training
|
| 563 |
include visual question answering pertaining to medical images, such as
|
| 564 |
radiographs, or providing answers to textual medical questions. Full details of
|
| 565 |
-
all the tasks MedGemma has been evaluated can be found in
|
| 566 |
-
|
| 567 |
|
| 568 |
### Benefits
|
| 569 |
|
|
@@ -596,7 +742,7 @@ of multiple images.
|
|
| 596 |
MedGemma has not been evaluated or optimized for multi-turn applications.
|
| 597 |
|
| 598 |
MedGemma's training may make it more sensitive to the specific prompt used than
|
| 599 |
-
Gemma 3
|
| 600 |
|
| 601 |
When adapting MedGemma developer should consider the following:
|
| 602 |
|
|
@@ -612,4 +758,14 @@ When adapting MedGemma developer should consider the following:
|
|
| 612 |
overestimating its true ability to generalize to novel medical concepts.
|
| 613 |
Developers should validate MedGemma on datasets not publicly available or
|
| 614 |
otherwise made available to non-institutional researchers to mitigate this
|
| 615 |
-
risk.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
<a href="https://discord.gg/unsloth">
|
| 35 |
<img src="https://github.com/unslothai/unsloth/raw/main/images/Discord%20button.png" width="173">
|
| 36 |
</a>
|
| 37 |
+
<a href="https://docs.unsloth.ai/">
|
| 38 |
<img src="https://raw.githubusercontent.com/unslothai/unsloth/refs/heads/main/images/documentation%20green%20button.png" width="143">
|
| 39 |
</a>
|
| 40 |
</div>
|
|
|
|
| 53 |
issues): [MedGemma](https://github.com/google-health/medgemma)
|
| 54 |
* Quick start notebook: [GitHub](https://github.com/google-health/medgemma/blob/main/notebooks/quick_start_with_hugging_face.ipynb)
|
| 55 |
* Fine-tuning notebook: [GitHub](https://github.com/google-health/medgemma/blob/main/notebooks/fine_tune_with_hugging_face.ipynb)
|
| 56 |
+
* Concept applications built using MedGemma: [Collection](https://huggingface.co/collections/google/medgemma-concept-apps-686ea036adb6d51416b0928a)
|
| 57 |
* Support: See [Contact](https://developers.google.com/health-ai-developer-foundations/medgemma/get-started.md#contact)
|
| 58 |
* License: The use of MedGemma is governed by the [Health AI Developer
|
| 59 |
Foundations terms of
|
|
|
|
| 70 |
MedGemma is a collection of [Gemma 3](https://ai.google.dev/gemma/docs/core)
|
| 71 |
variants that are trained for performance on medical text and image
|
| 72 |
comprehension. Developers can use MedGemma to accelerate building
|
| 73 |
+
healthcare-based AI applications. MedGemma currently comes in three variants: a
|
| 74 |
+
4B multimodal version and 27B text-only and multimodal versions.
|
| 75 |
+
|
| 76 |
+
Both MedGemma multimodal versions utilize a
|
| 77 |
+
[SigLIP](https://arxiv.org/abs/2303.15343) image encoder that has been
|
| 78 |
+
specifically pre-trained on a variety of de-identified medical data, including
|
| 79 |
+
chest X-rays, dermatology images, ophthalmology images, and histopathology
|
| 80 |
+
slides. Their LLM components are trained on a diverse set of medical data,
|
| 81 |
+
including medical text, medical question-answer pairs, FHIR-based electronic
|
| 82 |
+
health record data (27B multimodal only), radiology images, histopathology
|
| 83 |
+
patches, ophthalmology images, and dermatology images.
|
| 84 |
|
| 85 |
MedGemma 4B is available in both pre-trained (suffix: `-pt`) and
|
| 86 |
instruction-tuned (suffix `-it`) versions. The instruction-tuned version is a
|
| 87 |
+
better starting point for most applications. The pre-trained version is
|
| 88 |
+
available for those who want to experiment more deeply with the models.
|
| 89 |
+
|
| 90 |
+
MedGemma 27B multimodal has pre-training on medical image, medical record and
|
| 91 |
+
medical record comprehension tasks. MedGemma 27B text-only has been trained
|
| 92 |
+
exclusively on medical text. Both models have been optimized for inference-time
|
| 93 |
+
computation on medical reasoning. This means it has slightly higher performance
|
| 94 |
+
on some text benchmarks than MedGemma 27B multimodal. Users who want to work
|
| 95 |
+
with a single model for both medical text, medical record and medical image
|
| 96 |
+
tasks are better suited for MedGemma 27B multimodal. Those that only need text
|
| 97 |
+
use-cases may be better served with the text-only variant. Both MedGemma 27B
|
| 98 |
+
variants are only available in instruction-tuned versions.
|
| 99 |
|
| 100 |
MedGemma variants have been evaluated on a range of clinically relevant
|
| 101 |
+
benchmarks to illustrate their baseline performance. These evaluations are based
|
| 102 |
+
on both open benchmark datasets and curated datasets. Developers can fine-tune
|
| 103 |
+
MedGemma variants for improved performance. Consult the [Intended
|
| 104 |
+
Use](https://developers.google.com/health-ai-developer-foundations/medgemma/model-card#intended_use)
|
| 105 |
+
section below for more details.
|
| 106 |
+
|
| 107 |
+
MedGemma is optimized for medical applications that involve a text generation
|
| 108 |
+
component. For medical image-based applications that do not involve text
|
| 109 |
+
generation, such as data-efficient classification, zero-shot classification, or
|
| 110 |
+
content-based or semantic image retrieval, the [MedSigLIP image
|
| 111 |
+
encoder](https://developers.google.com/health-ai-developer-foundations/medsiglip/model-card)
|
| 112 |
+
is recommended. MedSigLIP is based on the same image encoder that powers
|
| 113 |
+
MedGemma.
|
| 114 |
+
|
| 115 |
+
Please consult the [MedGemma Technical Report](https://arxiv.org/abs/2507.05201)
|
| 116 |
+
for more details.
|
| 117 |
|
| 118 |
### How to use
|
| 119 |
|
|
|
|
| 122 |
you create a production version using [Model
|
| 123 |
Garden](https://cloud.google.com/model-garden).
|
| 124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
First, install the Transformers library. Gemma 3 is supported starting from
|
| 126 |
transformers 4.50.0.
|
| 127 |
|
|
|
|
| 156 |
{
|
| 157 |
"role": "user",
|
| 158 |
"content": [
|
| 159 |
+
{"type": "text", "text": "Describe this X-ray"},
|
| 160 |
+
{"type": "image", "image": image}
|
| 161 |
]
|
| 162 |
}
|
| 163 |
]
|
|
|
|
| 223 |
|
| 224 |
* To give the model a quick try, running it locally with weights from Hugging
|
| 225 |
Face, see [Quick start notebook in
|
| 226 |
+
Colab](https://colab.research.google.com/github/google-health/medgemma/blob/main/notebooks/quick_start_with_hugging_face.ipynb).
|
| 227 |
+
Note that you will need to use Colab Enterprise to obtain adequate GPU
|
| 228 |
+
resources to run either 27B model without quantization.
|
| 229 |
|
| 230 |
+
* For an example of fine-tuning the 4B model, see the [Fine-tuning notebook in
|
| 231 |
Colab](https://colab.research.google.com/github/google-health/medgemma/blob/main/notebooks/fine_tune_with_hugging_face.ipynb).
|
| 232 |
+
The 27B models can be fine tuned in a similar manner but will require more
|
| 233 |
+
time and compute resources than the 4B model.
|
| 234 |
|
| 235 |
### Model architecture overview
|
| 236 |
|
| 237 |
The MedGemma model is built based on [Gemma 3](https://ai.google.dev/gemma/) and
|
| 238 |
+
uses the same decoder-only transformer architecture as Gemma 3\. To read more
|
| 239 |
about the architecture, consult the Gemma 3 [model
|
| 240 |
card](https://ai.google.dev/gemma/docs/core/model_card_3).
|
| 241 |
|
| 242 |
### Technical specifications
|
| 243 |
|
| 244 |
* **Model type**: Decoder-only Transformer architecture, see the [Gemma 3
|
| 245 |
+
Technical
|
| 246 |
+
Report](https://storage.googleapis.com/deepmind-media/gemma/Gemma3Report.pdf)
|
| 247 |
+
* **Input Modalities**: Text, vision
|
| 248 |
+
* **Output Modality:** Text only
|
| 249 |
+
* **Attention mechanism**: Grouped-query attention (GQA)
|
| 250 |
* **Context length**: Supports long context, at least 128K tokens
|
| 251 |
+
* **Key publication**: https://arxiv.org/abs/2507.05201
|
| 252 |
+
* **Model created**: July 9, 2025
|
| 253 |
+
|
| 254 |
+
* **Model version**: 1.0.1
|
| 255 |
|
| 256 |
### Citation
|
| 257 |
|
| 258 |
+
When using this model, please cite: Sellergren et al. "MedGemma Technical
|
| 259 |
+
Report." *arXiv preprint arXiv:2507.05201* (2025).
|
| 260 |
|
| 261 |
```none
|
| 262 |
+
@article{sellergren2025medgemma,
|
| 263 |
+
title={MedGemma Technical Report},
|
| 264 |
+
author={Sellergren, Andrew and Kazemzadeh, Sahar and Jaroensri, Tiam and Kiraly, Atilla and Traverse, Madeleine and Kohlberger, Timo and Xu, Shawn and Jamil, Fayaz and Hughes, CΓan and Lau, Charles and others},
|
| 265 |
+
journal={arXiv preprint arXiv:2507.05201},
|
| 266 |
+
year={2025}
|
|
|
|
| 267 |
}
|
| 268 |
```
|
| 269 |
|
|
|
|
| 290 |
|
| 291 |
#### Imaging evaluations
|
| 292 |
|
| 293 |
+
The multimodal performance of MedGemma 4B and 27B multimodal was evaluated
|
| 294 |
+
across a range of benchmarks, focusing on radiology, dermatology,
|
| 295 |
+
histopathology, ophthalmology, and multimodal clinical reasoning.
|
| 296 |
|
| 297 |
MedGemma 4B outperforms the base Gemma 3 4B model across all tested multimodal
|
| 298 |
health benchmarks.
|
| 299 |
|
| 300 |
+
| Task and metric | Gemma 3 4B | MedGemma 4B |
|
| 301 |
| :---- | :---- | :---- |
|
| 302 |
| **Medical image classification** | | |
|
| 303 |
+
| MIMIC CXR\*\* \- macro F1 for top 5 conditions | 81.2 | 88.9 |
|
| 304 |
+
| CheXpert CXR \- macro F1 for top 5 conditions | 32.6 | 48.1 |
|
| 305 |
+
| CXR14 \- macro F1 for 3 conditions | 32.0 | 50.1 |
|
| 306 |
+
| PathMCQA\* (histopathology, internal\*\*) \- Accuracy | 37.1 | 69.8 |
|
| 307 |
+
| US-DermMCQA\* \- Accuracy | 52.5 | 71.8 |
|
| 308 |
+
| EyePACS\* (fundus, internal) \- Accuracy | 14.4 | 64.9 |
|
| 309 |
| **Visual question answering** | | |
|
| 310 |
+
| SLAKE (radiology) \- Tokenized F1 | 40.2 | 72.3 |
|
| 311 |
+
| VQA-RAD\*\*\* (radiology) \- Tokenized F1 | 33.6 | 49.9 |
|
| 312 |
+
| **Knowledge and reasoning** | | | | |
|
| 313 |
+
| MedXpertQA (text \+ multimodal questions) \- Accuracy | 16.4 | 18.8 |
|
| 314 |
+
|
| 315 |
+
*Internal datasets. US-DermMCQA is described in [Liu (2020, Nature
|
| 316 |
+
medicine)](https://www.nature.com/articles/s41591-020-0842-3), presented as a
|
| 317 |
+
4-way MCQ per example for skin condition classification. PathMCQA is based on
|
| 318 |
+
multiple datasets, presented as 3-9 way MCQ per example for identification,
|
| 319 |
+
grading, and subtype for breast, cervical, and prostate cancer. EyePACS is a
|
| 320 |
+
dataset of fundus images with classification labels based on 5-level diabetic
|
| 321 |
+
retinopathy severity (None, Mild, Moderate, Severe, Proliferative). More details
|
| 322 |
+
in the [MedGemma Technical Report](https://arxiv.org/abs/2507.05201).
|
| 323 |
+
|
| 324 |
+
**Based on radiologist adjudicated labels, described in [Yang (2024,
|
| 325 |
+
arXiv)](https://arxiv.org/pdf/2405.03162) Section A.1.1.
|
| 326 |
+
|
| 327 |
+
***Based on "balanced split," described in [Yang (2024,
|
| 328 |
+
arXiv)](https://arxiv.org/pdf/2405.03162).
|
| 329 |
|
| 330 |
#### Chest X-ray report generation
|
| 331 |
|
|
|
|
| 335 |
pre-trained checkpoint with our previous best model for CXR report generation,
|
| 336 |
[PaliGemma 2](https://arxiv.org/abs/2412.03555).
|
| 337 |
|
| 338 |
+
| Metric | MedGemma 4B (pre-trained) | MedGemma 4B (tuned for CXR)| PaliGemma 2 3B (tuned for CXR) | PaliGemma 2 10B (tuned for CXR) |
|
| 339 |
+
| :---- | :---- | :---- | :---- | :---- |
|
| 340 |
+
| MIMIC CXR \- RadGraph F1 | 29.5 | 30.3 |28.8 | 29.5 |
|
| 341 |
+
|
| 342 |
+
|
| 343 |
|
| 344 |
+
The instruction-tuned versions of MedGemma 4B and MedGemma 27B achieve lower
|
| 345 |
+
scores (21.9 and 21.3, respectively) due to the differences in reporting style
|
| 346 |
compared to the MIMIC ground truth reports. Further fine-tuning on MIMIC reports
|
| 347 |
+
enables users to achieve improved performance, as shown by the improved
|
| 348 |
+
performance of the MedGemma 4B model that was tuned for CXR.
|
| 349 |
|
| 350 |
#### Text evaluations
|
| 351 |
|
|
|
|
| 355 |
The MedGemma models outperform their respective base Gemma models across all
|
| 356 |
tested text-only health benchmarks.
|
| 357 |
|
| 358 |
+
| Metric | Gemma 3 4B | MedGemma 4B |
|
| 359 |
+
| :---- | :---- | :---- |
|
| 360 |
+
| MedQA (4-op) | 50.7 | 64.4 |
|
| 361 |
+
| MedMCQA | 45.4 | 55.7 |
|
| 362 |
+
| PubMedQA | 68.4 | 73.4 |
|
| 363 |
+
| MMLU Med | 67.2 | 70.0 |
|
| 364 |
+
| MedXpertQA (text only) | 11.6 | 14.2 |
|
| 365 |
+
| AfriMed-QA (25 question test set) | 48.0 | 52.0 |
|
| 366 |
|
| 367 |
For all MedGemma 27B results, [test-time
|
| 368 |
scaling](https://arxiv.org/abs/2501.19393) is used to improve performance.
|
| 369 |
|
| 370 |
+
#### Medical record evaluations
|
| 371 |
+
|
| 372 |
+
All models were evaluated on a question answer dataset from synthetic FHIR data
|
| 373 |
+
to answer questions about patient records. MedGemma 27B multimodal's
|
| 374 |
+
FHIR-specific training gives it significant improvement over other MedGemma and
|
| 375 |
+
Gemma models.
|
| 376 |
+
|
| 377 |
+
| Metric | Gemma 3 4B | MedGemma 4B |
|
| 378 |
+
| :---- | :---- | :---- |
|
| 379 |
+
| EHRQA | 70.9 | 67.6 |
|
| 380 |
+
|
| 381 |
+
|
| 382 |
### Ethics and safety evaluation
|
| 383 |
|
| 384 |
#### Evaluation approach
|
|
|
|
| 442 |
datasets, with a focus on expert human evaluations for tasks like CXR report
|
| 443 |
generation and radiology VQA.
|
| 444 |
|
| 445 |
+
### Ethics and safety evaluation
|
| 446 |
+
|
| 447 |
+
#### Evaluation approach
|
| 448 |
+
|
| 449 |
+
Our evaluation methods include structured evaluations and internal red-teaming
|
| 450 |
+
testing of relevant content policies. Red-teaming was conducted by a number of
|
| 451 |
+
different teams, each with different goals and human evaluation metrics. These
|
| 452 |
+
models were evaluated against a number of different categories relevant to
|
| 453 |
+
ethics and safety, including:
|
| 454 |
+
|
| 455 |
+
* **Child safety**: Evaluation of text-to-text and image-to-text prompts
|
| 456 |
+
covering child safety policies, including child sexual abuse and
|
| 457 |
+
exploitation.
|
| 458 |
+
* **Content safety:** Evaluation of text-to-text and image-to-text prompts
|
| 459 |
+
covering safety policies, including harassment, violence and gore, and hate
|
| 460 |
+
speech.
|
| 461 |
+
* **Representational harms**: Evaluation of text-to-text and image-to-text
|
| 462 |
+
prompts covering safety policies, including bias, stereotyping, and harmful
|
| 463 |
+
associations or inaccuracies.
|
| 464 |
+
* **General medical harms:** Evaluation of text-to-text and image-to-text
|
| 465 |
+
prompts covering safety policies, including information quality and harmful
|
| 466 |
+
associations or inaccuracies.
|
| 467 |
+
|
| 468 |
+
In addition to development level evaluations, we conduct "assurance evaluations"
|
| 469 |
+
which are our "arms-length" internal evaluations for responsibility governance
|
| 470 |
+
decision making. They are conducted separately from the model development team,
|
| 471 |
+
to inform decision making about release. High-level findings are fed back to the
|
| 472 |
+
model team, but prompt sets are held out to prevent overfitting and preserve the
|
| 473 |
+
results' ability to inform decision making. Notable assurance evaluation results
|
| 474 |
+
are reported to our Responsibility & Safety Council as part of release review.
|
| 475 |
+
|
| 476 |
+
#### Evaluation results
|
| 477 |
+
|
| 478 |
+
For all areas of safety testing, we saw safe levels of performance across the
|
| 479 |
+
categories of child safety, content safety, and representational harms. All
|
| 480 |
+
testing was conducted without safety filters to evaluate the model capabilities
|
| 481 |
+
and behaviors. For text-to-text, image-to-text, and audio-to-text, and across
|
| 482 |
+
both MedGemma model sizes, the model produced minimal policy violations. A
|
| 483 |
+
limitation of our evaluations was that they included primarily English language
|
| 484 |
+
prompts.
|
| 485 |
+
|
| 486 |
+
## Data card
|
| 487 |
+
|
| 488 |
+
### Dataset overview
|
| 489 |
+
|
| 490 |
+
#### Training
|
| 491 |
+
|
| 492 |
+
The base Gemma models are pre-trained on a large corpus of text and code data.
|
| 493 |
+
MedGemma multimodal variants utilize a
|
| 494 |
+
[SigLIP](https://arxiv.org/abs/2303.15343) image encoder that has been
|
| 495 |
+
specifically pre-trained on a variety of de-identified medical data, including
|
| 496 |
+
radiology images, histopathology images, ophthalmology images, and dermatology
|
| 497 |
+
images. Their LLM component is trained on a diverse set of medical data,
|
| 498 |
+
including medical text, medical question-answer pairs, FHIR-based electronic
|
| 499 |
+
health record data (27B multimodal only), radiology images, histopathology
|
| 500 |
+
patches, ophthalmology images, and dermatology images.
|
| 501 |
+
|
| 502 |
+
#### Evaluation
|
| 503 |
+
|
| 504 |
+
MedGemma models have been evaluated on a comprehensive set of clinically
|
| 505 |
+
relevant benchmarks, including over 22 datasets across 6 different tasks and 4
|
| 506 |
+
medical image modalities. These benchmarks include both open and internal
|
| 507 |
+
datasets.
|
| 508 |
+
|
| 509 |
#### Source
|
| 510 |
|
| 511 |
MedGemma utilizes a combination of public and private datasets.
|
| 512 |
|
| 513 |
This model was trained on diverse public datasets including MIMIC-CXR (chest
|
| 514 |
+
X-rays and reports), ChestImaGenome: Set of bounding boxes linking image
|
| 515 |
+
findings with anatomical regions for MIMIC-CXR (MedGemma 27B multimodal only),
|
| 516 |
+
SLAKE (multimodal medical images and questions), PAD-UFES-20 (skin lesion images
|
| 517 |
+
and data), SCIN (dermatology images), TCGA (cancer genomics data), CAMELYON
|
| 518 |
+
(lymph node histopathology images), PMC-OA (biomedical literature with images),
|
| 519 |
+
and Mendeley Digital Knee X-Ray (knee X-rays).
|
| 520 |
|
| 521 |
Additionally, multiple diverse proprietary datasets were licensed and
|
| 522 |
incorporated (described next).
|
| 523 |
|
| 524 |
### Data Ownership and Documentation
|
| 525 |
|
| 526 |
+
* [MIMIC-CXR](https://physionet.org/content/mimic-cxr/2.1.0/): MIT Laboratory
|
| 527 |
for Computational Physiology and Beth Israel Deaconess Medical Center
|
| 528 |
(BIDMC).
|
| 529 |
* [Slake-VQA](https://www.med-vqa.com/slake/): The Hong Kong Polytechnic
|
|
|
|
| 559 |
created by a research team led by Jason J. Lau, Soumya Gayen, Asma Ben
|
| 560 |
Abacha, and Dina Demner-Fushman and their affiliated institutions (the US
|
| 561 |
National Library of Medicine and National Institutes of Health)
|
| 562 |
+
* [Chest ImaGenome](https://physionet.org/content/chest-imagenome/1.0.0/): IBM
|
| 563 |
+
Research.
|
| 564 |
* [MedExpQA](https://www.sciencedirect.com/science/article/pii/S0933365724001805):
|
| 565 |
This dataset was created by researchers at the HiTZ Center (Basque Center
|
| 566 |
for Language Technology and Artificial Intelligence).
|
| 567 |
* [MedXpertQA](https://huggingface.co/datasets/TsinghuaC3I/MedXpertQA): This
|
| 568 |
dataset was developed by researchers at Tsinghua University (Beijing, China)
|
| 569 |
and Shanghai Artificial Intelligence Laboratory (Shanghai, China).
|
| 570 |
+
* [HealthSearchQA](https://huggingface.co/datasets/katielink/healthsearchqa):
|
| 571 |
+
This dataset consists of consisting of 3,173 commonly searched consumer
|
| 572 |
+
questions
|
| 573 |
|
| 574 |
In addition to the public datasets listed above, MedGemma was also trained on
|
| 575 |
+
de-identified, licensed datasets or datasets collected internally at Google from
|
| 576 |
+
consented participants.
|
| 577 |
+
|
| 578 |
+
* **Radiology dataset 1:** De-identified dataset of different CT studies
|
| 579 |
+
across body parts from a US-based radiology outpatient diagnostic center
|
| 580 |
+
network.
|
| 581 |
+
* **Ophthalmology dataset 1 (EyePACS):** De-identified dataset of fundus
|
| 582 |
+
images from diabetic retinopathy screening.
|
| 583 |
+
* **Dermatology dataset 1:** De-identified dataset of teledermatology skin
|
| 584 |
condition images (both clinical and dermatoscopic) from Colombia.
|
| 585 |
+
* **Dermatology dataset 2:** De-identified dataset of skin cancer images (both
|
| 586 |
clinical and dermatoscopic) from Australia.
|
| 587 |
+
* **Dermatology dataset 3:** De-identified dataset of non-diseased skin images
|
| 588 |
from an internal data collection effort.
|
| 589 |
+
* **Pathology dataset 1:** De-identified dataset of histopathology H\&E whole
|
| 590 |
+
slide images created in collaboration with an academic research hospital and
|
| 591 |
biobank in Europe. Comprises de-identified colon, prostate, and lymph nodes.
|
| 592 |
+
* **Pathology dataset 2:** De-identified dataset of lung histopathology H\&E
|
| 593 |
+
and IHC whole slide images created by a commercial biobank in the United
|
| 594 |
+
States.
|
| 595 |
+
* **Pathology dataset 3:** De-identified dataset of prostate and lymph node
|
| 596 |
+
H\&E and IHC histopathology whole slide images created by a contract
|
| 597 |
+
research organization in the United States.
|
| 598 |
+
* **Pathology dataset 4:** De-identified dataset of histopathology whole slide
|
| 599 |
+
images created in collaboration with a large, tertiary teaching hospital in
|
| 600 |
+
the United States. Comprises a diverse set of tissue and stain types,
|
| 601 |
+
predominantly H\&E.
|
| 602 |
+
* **EHR dataset 1:** Question/answer dataset drawn from synthetic FHIR records
|
| 603 |
+
created by [Synthea.](https://synthetichealth.github.io/synthea/) The test
|
| 604 |
+
set includes 19 unique patients with 200 questions per patient divided into
|
| 605 |
+
10 different categories.
|
| 606 |
|
| 607 |
### Data citation
|
| 608 |
|
| 609 |
+
* **MIMIC-CXR:** Johnson, A., Pollard, T., Mark, R., Berkowitz, S., & Horng,
|
| 610 |
+
S. (2024). MIMIC-CXR Database (version 2.1.0). PhysioNet.
|
| 611 |
+
[https://physionet.org/content/mimic-cxr/2.1.0/](https://physionet.org/content/mimic-cxr/2.1.0/)
|
| 612 |
+
*and* Johnson, Alistair E. W., Tom J. Pollard, Seth J. Berkowitz, Nathaniel
|
| 613 |
+
R. Greenbaum, Matthew P. Lungren, Chih-Ying Deng, Roger G. Mark, and Steven
|
| 614 |
+
Horng. 2019\. "MIMIC-CXR, a de-Identified Publicly Available Database of
|
| 615 |
+
Chest Radiographs with Free-Text Reports." *Scientific Data 6* (1): 1β8.
|
| 616 |
+
|
| 617 |
+
* **SLAKE:** Liu, Bo, Li-Ming Zhan, Li Xu, Lin Ma, Yan Yang, and Xiao-Ming Wu.
|
| 618 |
+
2021.SLAKE: A Semantically-Labeled Knowledge-Enhanced Dataset for Medical
|
| 619 |
+
Visual Question Answering."
|
| 620 |
+
[http://arxiv.org/abs/2102.09542](http://arxiv.org/abs/2102.09542).
|
| 621 |
+
|
| 622 |
+
* **PAD-UEFS-20:** Pacheco, Andre GC, et al. "PAD-UFES-20: A skin lesion
|
| 623 |
+
dataset composed of patient data and clinical images collected from
|
| 624 |
+
smartphones." *Data in brief* 32 (2020): 106221\.
|
| 625 |
+
|
| 626 |
+
* **SCIN:** Ward, Abbi, Jimmy Li, Julie Wang, Sriram Lakshminarasimhan, Ashley
|
| 627 |
+
Carrick, Bilson Campana, Jay Hartford, et al. 2024\. "Creating an Empirical
|
| 628 |
+
Dermatology Dataset Through Crowdsourcing With Web Search Advertisements."
|
| 629 |
+
*JAMA Network Open 7* (11): e2446615βe2446615.
|
| 630 |
+
|
| 631 |
+
* **TCGA:** The results shown here are in whole or part based upon data
|
| 632 |
+
generated by the TCGA Research Network:
|
| 633 |
+
[https://www.cancer.gov/tcga](https://www.cancer.gov/tcga).
|
| 634 |
+
|
| 635 |
+
* **CAMELYON16:** Ehteshami Bejnordi, Babak, Mitko Veta, Paul Johannes van
|
| 636 |
+
Diest, Bram van Ginneken, Nico Karssemeijer, Geert Litjens, Jeroen A. W. M.
|
| 637 |
+
van der Laak, et al. 2017\. "Diagnostic Assessment of Deep Learning
|
| 638 |
Algorithms for Detection of Lymph Node Metastases in Women With Breast
|
| 639 |
+
Cancer." *JAMA 318* (22): 2199β2210.
|
| 640 |
+
|
| 641 |
+
* **Mendeley Digital Knee X-Ray:** Gornale, Shivanand; Patravali, Pooja
|
| 642 |
+
(2020), "Digital Knee X-ray Images", Mendeley Data, V1, doi:
|
| 643 |
+
10.17632/t9ndx37v5h.1
|
| 644 |
+
|
| 645 |
+
* **VQA-RAD:** Lau, Jason J., Soumya Gayen, Asma Ben Abacha, and Dina
|
| 646 |
+
Demner-Fushman. 2018\. "A Dataset of Clinically Generated Visual Questions
|
| 647 |
+
and Answers about Radiology Images." *Scientific Data 5* (1): 1β10.
|
| 648 |
+
|
| 649 |
+
* **Chest ImaGenome:** Wu, J., Agu, N., Lourentzou, I., Sharma, A., Paguio,
|
| 650 |
+
J., Yao, J. S., Dee, E. C., Mitchell, W., Kashyap, S., Giovannini, A., Celi,
|
| 651 |
+
L. A., Syeda-Mahmood, T., & Moradi, M. (2021). Chest ImaGenome Dataset
|
| 652 |
+
(version 1.0.0). PhysioNet. RRID:SCR\_007345.
|
| 653 |
+
[https://doi.org/10.13026/wv01-y230](https://doi.org/10.13026/wv01-y230)
|
| 654 |
+
|
| 655 |
+
* **MedQA:** Jin, Di, Eileen Pan, Nassim Oufattole, Wei-Hung Weng, Hanyi Fang,
|
| 656 |
+
and Peter Szolovits. 2020\. "What Disease Does This Patient Have? A
|
| 657 |
+
Large-Scale Open Domain Question Answering Dataset from Medical Exams."
|
| 658 |
+
[http://arxiv.org/abs/2009.13081](http://arxiv.org/abs/2009.13081).
|
| 659 |
+
|
| 660 |
+
* **AfrimedQA:** Olatunji, Tobi, Charles Nimo, Abraham Owodunni, Tassallah
|
| 661 |
+
Abdullahi, Emmanuel Ayodele, Mardhiyah Sanni, Chinemelu Aka, et al. 2024\.
|
| 662 |
+
"AfriMed-QA: A Pan-African, Multi-Specialty, Medical Question-Answering
|
| 663 |
+
Benchmark Dataset."
|
| 664 |
+
[http://arxiv.org/abs/2411.15640](http://arxiv.org/abs/2411.15640).
|
| 665 |
+
|
| 666 |
+
* **MedExpQA:** Alonso, I., Oronoz, M., & Agerri, R. (2024). MedExpQA:
|
| 667 |
+
Multilingual Benchmarking of Large Language Models for Medical Question
|
| 668 |
+
Answering. *arXiv preprint arXiv:2404.05590*. Retrieved from
|
| 669 |
+
[https://arxiv.org/abs/2404.05590](https://arxiv.org/abs/2404.05590)
|
| 670 |
+
|
| 671 |
+
* **MedXpertQA:** Zuo, Yuxin, Shang Qu, Yifei Li, Zhangren Chen, Xuekai Zhu,
|
| 672 |
+
Ermo Hua, Kaiyan Zhang, Ning Ding, and Bowen Zhou. 2025\. "MedXpertQA:
|
| 673 |
+
Benchmarking Expert-Level Medical Reasoning and Understanding."
|
| 674 |
+
[http://arxiv.org/abs/2501.18362](http://arxiv.org/abs/2501.18362).
|
| 675 |
|
| 676 |
### De-identification/anonymization:
|
| 677 |
|
| 678 |
+
Google and its partners utilize datasets that have been rigorously anonymized or
|
| 679 |
de-identified to ensure the protection of individual research participants and
|
| 680 |
+
patient privacy.
|
| 681 |
|
| 682 |
## Implementation information
|
| 683 |
|
|
|
|
| 708 |
dermatology, and fundus images. Examples of tasks within MedGemma's training
|
| 709 |
include visual question answering pertaining to medical images, such as
|
| 710 |
radiographs, or providing answers to textual medical questions. Full details of
|
| 711 |
+
all the tasks MedGemma has been evaluated can be found in the [MedGemma
|
| 712 |
+
Technical Report](https://arxiv.org/abs/2507.05201).
|
| 713 |
|
| 714 |
### Benefits
|
| 715 |
|
|
|
|
| 742 |
MedGemma has not been evaluated or optimized for multi-turn applications.
|
| 743 |
|
| 744 |
MedGemma's training may make it more sensitive to the specific prompt used than
|
| 745 |
+
Gemma 3\.
|
| 746 |
|
| 747 |
When adapting MedGemma developer should consider the following:
|
| 748 |
|
|
|
|
| 758 |
overestimating its true ability to generalize to novel medical concepts.
|
| 759 |
Developers should validate MedGemma on datasets not publicly available or
|
| 760 |
otherwise made available to non-institutional researchers to mitigate this
|
| 761 |
+
risk.
|
| 762 |
+
|
| 763 |
+
|
| 764 |
+
### Release notes
|
| 765 |
+
|
| 766 |
+
* May 20, 2025: Initial Release
|
| 767 |
+
* July 9, 2025 Bug Fix: Fixed the subtle degradation in the multimodal
|
| 768 |
+
performance. The issue was due to a missing end-of-image token in the model
|
| 769 |
+
vocabulary, impacting combined text-and-image tasks. This fix reinstates and
|
| 770 |
+
correctly maps that token, ensuring text-only tasks remain unaffected while
|
| 771 |
+
restoring multimodal performance.
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{{ bos_token }}
|
| 2 |
+
{%- if messages[0]['role'] == 'system' -%}
|
| 3 |
+
{%- if messages[0]['content'] is string -%}
|
| 4 |
+
{%- set first_user_prefix = messages[0]['content'] + '
|
| 5 |
+
|
| 6 |
+
' -%}
|
| 7 |
+
{%- else -%}
|
| 8 |
+
{%- set first_user_prefix = messages[0]['content'][0]['text'] + '
|
| 9 |
+
|
| 10 |
+
' -%}
|
| 11 |
+
{%- endif -%}
|
| 12 |
+
{%- set loop_messages = messages[1:] -%}
|
| 13 |
+
{%- else -%}
|
| 14 |
+
{%- set first_user_prefix = "" -%}
|
| 15 |
+
{%- set loop_messages = messages -%}
|
| 16 |
+
{%- endif -%}
|
| 17 |
+
{%- for message in loop_messages -%}
|
| 18 |
+
{%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) -%}
|
| 19 |
+
{{ raise_exception("Conversation roles must alternate user/assistant/user/assistant/...") }}
|
| 20 |
+
{%- endif -%}
|
| 21 |
+
{%- if (message['role'] == 'assistant') -%}
|
| 22 |
+
{%- set role = "model" -%}
|
| 23 |
+
{%- else -%}
|
| 24 |
+
{%- set role = message['role'] -%}
|
| 25 |
+
{%- endif -%}
|
| 26 |
+
{{ '<start_of_turn>' + role + '
|
| 27 |
+
' + (first_user_prefix if loop.first else "") }}
|
| 28 |
+
{%- if message['content'] is string -%}
|
| 29 |
+
{{ message['content'] | trim }}
|
| 30 |
+
{%- elif message['content'] is iterable -%}
|
| 31 |
+
{%- for item in message['content'] -%}
|
| 32 |
+
{%- if item['type'] == 'image' -%}
|
| 33 |
+
{{ '<start_of_image>' }}
|
| 34 |
+
{%- elif item['type'] == 'text' -%}
|
| 35 |
+
{{ item['text'] | trim }}
|
| 36 |
+
{%- endif -%}
|
| 37 |
+
{%- endfor -%}
|
| 38 |
+
{%- else -%}
|
| 39 |
+
{{ raise_exception("Invalid content type") }}
|
| 40 |
+
{%- endif -%}
|
| 41 |
+
{{ '<end_of_turn>
|
| 42 |
+
' }}
|
| 43 |
+
{%- endfor -%}
|
| 44 |
+
{%- if add_generation_prompt -%}
|
| 45 |
+
{{'<start_of_turn>model
|
| 46 |
+
'}}
|
| 47 |
+
{%- endif -%}
|
config.json
CHANGED
|
@@ -15,13 +15,48 @@
|
|
| 15 |
"attention_bias": false,
|
| 16 |
"attention_dropout": 0.0,
|
| 17 |
"attn_logit_softcapping": null,
|
| 18 |
-
"cache_implementation": "hybrid",
|
| 19 |
"final_logit_softcapping": null,
|
| 20 |
"head_dim": 256,
|
| 21 |
"hidden_activation": "gelu_pytorch_tanh",
|
| 22 |
"hidden_size": 2560,
|
| 23 |
"initializer_range": 0.02,
|
| 24 |
"intermediate_size": 10240,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
"max_position_embeddings": 131072,
|
| 26 |
"model_type": "gemma3_text",
|
| 27 |
"num_attention_heads": 8,
|
|
@@ -36,13 +71,12 @@
|
|
| 36 |
},
|
| 37 |
"rope_theta": 1000000,
|
| 38 |
"sliding_window": 1024,
|
| 39 |
-
"sliding_window_pattern": 6,
|
| 40 |
"torch_dtype": "bfloat16",
|
| 41 |
"use_cache": true,
|
| 42 |
"vocab_size": 262208
|
| 43 |
},
|
| 44 |
"torch_dtype": "bfloat16",
|
| 45 |
-
"transformers_version": "4.
|
| 46 |
"unsloth_fixed": true,
|
| 47 |
"vision_config": {
|
| 48 |
"attention_dropout": 0.0,
|
|
|
|
| 15 |
"attention_bias": false,
|
| 16 |
"attention_dropout": 0.0,
|
| 17 |
"attn_logit_softcapping": null,
|
|
|
|
| 18 |
"final_logit_softcapping": null,
|
| 19 |
"head_dim": 256,
|
| 20 |
"hidden_activation": "gelu_pytorch_tanh",
|
| 21 |
"hidden_size": 2560,
|
| 22 |
"initializer_range": 0.02,
|
| 23 |
"intermediate_size": 10240,
|
| 24 |
+
"layer_types": [
|
| 25 |
+
"sliding_attention",
|
| 26 |
+
"sliding_attention",
|
| 27 |
+
"sliding_attention",
|
| 28 |
+
"sliding_attention",
|
| 29 |
+
"sliding_attention",
|
| 30 |
+
"full_attention",
|
| 31 |
+
"sliding_attention",
|
| 32 |
+
"sliding_attention",
|
| 33 |
+
"sliding_attention",
|
| 34 |
+
"sliding_attention",
|
| 35 |
+
"sliding_attention",
|
| 36 |
+
"full_attention",
|
| 37 |
+
"sliding_attention",
|
| 38 |
+
"sliding_attention",
|
| 39 |
+
"sliding_attention",
|
| 40 |
+
"sliding_attention",
|
| 41 |
+
"sliding_attention",
|
| 42 |
+
"full_attention",
|
| 43 |
+
"sliding_attention",
|
| 44 |
+
"sliding_attention",
|
| 45 |
+
"sliding_attention",
|
| 46 |
+
"sliding_attention",
|
| 47 |
+
"sliding_attention",
|
| 48 |
+
"full_attention",
|
| 49 |
+
"sliding_attention",
|
| 50 |
+
"sliding_attention",
|
| 51 |
+
"sliding_attention",
|
| 52 |
+
"sliding_attention",
|
| 53 |
+
"sliding_attention",
|
| 54 |
+
"full_attention",
|
| 55 |
+
"sliding_attention",
|
| 56 |
+
"sliding_attention",
|
| 57 |
+
"sliding_attention",
|
| 58 |
+
"sliding_attention"
|
| 59 |
+
],
|
| 60 |
"max_position_embeddings": 131072,
|
| 61 |
"model_type": "gemma3_text",
|
| 62 |
"num_attention_heads": 8,
|
|
|
|
| 71 |
},
|
| 72 |
"rope_theta": 1000000,
|
| 73 |
"sliding_window": 1024,
|
|
|
|
| 74 |
"torch_dtype": "bfloat16",
|
| 75 |
"use_cache": true,
|
| 76 |
"vocab_size": 262208
|
| 77 |
},
|
| 78 |
"torch_dtype": "bfloat16",
|
| 79 |
+
"transformers_version": "4.53.1",
|
| 80 |
"unsloth_fixed": true,
|
| 81 |
"vision_config": {
|
| 82 |
"attention_dropout": 0.0,
|
generation_config.json
CHANGED
|
@@ -1,13 +1,10 @@
|
|
| 1 |
{
|
|
|
|
| 2 |
"bos_token_id": 2,
|
| 3 |
-
"cache_implementation": "hybrid",
|
| 4 |
-
"do_sample": true,
|
| 5 |
"eos_token_id": [
|
| 6 |
1,
|
| 7 |
106
|
| 8 |
],
|
| 9 |
"pad_token_id": 0,
|
| 10 |
-
"
|
| 11 |
-
"top_p": 0.95,
|
| 12 |
-
"transformers_version": "4.51.3"
|
| 13 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
"bos_token_id": 2,
|
|
|
|
|
|
|
| 4 |
"eos_token_id": [
|
| 5 |
1,
|
| 6 |
106
|
| 7 |
],
|
| 8 |
"pad_token_id": 0,
|
| 9 |
+
"transformers_version": "4.53.1"
|
|
|
|
|
|
|
| 10 |
}
|
model-00001-of-00002.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 4961251752
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:acd1c5fbeda43edbd93f164edc23844da1cb6136d0af5120c7ece561be8fbd01
|
| 3 |
size 4961251752
|
model.safetensors.index.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"metadata": {
|
|
|
|
| 3 |
"total_size": 8600158944
|
| 4 |
},
|
| 5 |
"weight_map": {
|
|
|
|
| 1 |
{
|
| 2 |
"metadata": {
|
| 3 |
+
"total_parameters": 4971331952,
|
| 4 |
"total_size": 8600158944
|
| 5 |
},
|
| 6 |
"weight_map": {
|
tokenizer_config.json
CHANGED
|
@@ -1107,7 +1107,7 @@
|
|
| 1107 |
"special": false
|
| 1108 |
},
|
| 1109 |
"138": {
|
| 1110 |
-
"content": "
|
| 1111 |
"lstrip": false,
|
| 1112 |
"normalized": false,
|
| 1113 |
"rstrip": false,
|
|
@@ -1115,7 +1115,7 @@
|
|
| 1115 |
"special": false
|
| 1116 |
},
|
| 1117 |
"139": {
|
| 1118 |
-
"content": "
|
| 1119 |
"lstrip": false,
|
| 1120 |
"normalized": false,
|
| 1121 |
"rstrip": false,
|
|
@@ -1123,7 +1123,7 @@
|
|
| 1123 |
"special": false
|
| 1124 |
},
|
| 1125 |
"140": {
|
| 1126 |
-
"content": "
|
| 1127 |
"lstrip": false,
|
| 1128 |
"normalized": false,
|
| 1129 |
"rstrip": false,
|
|
@@ -1131,7 +1131,7 @@
|
|
| 1131 |
"special": false
|
| 1132 |
},
|
| 1133 |
"141": {
|
| 1134 |
-
"content": "
|
| 1135 |
"lstrip": false,
|
| 1136 |
"normalized": false,
|
| 1137 |
"rstrip": false,
|
|
@@ -1139,7 +1139,7 @@
|
|
| 1139 |
"special": false
|
| 1140 |
},
|
| 1141 |
"142": {
|
| 1142 |
-
"content": "
|
| 1143 |
"lstrip": false,
|
| 1144 |
"normalized": false,
|
| 1145 |
"rstrip": false,
|
|
@@ -1147,7 +1147,7 @@
|
|
| 1147 |
"special": false
|
| 1148 |
},
|
| 1149 |
"143": {
|
| 1150 |
-
"content": "
|
| 1151 |
"lstrip": false,
|
| 1152 |
"normalized": false,
|
| 1153 |
"rstrip": false,
|
|
@@ -1155,7 +1155,7 @@
|
|
| 1155 |
"special": false
|
| 1156 |
},
|
| 1157 |
"144": {
|
| 1158 |
-
"content": "
|
| 1159 |
"lstrip": false,
|
| 1160 |
"normalized": false,
|
| 1161 |
"rstrip": false,
|
|
@@ -1163,7 +1163,7 @@
|
|
| 1163 |
"special": false
|
| 1164 |
},
|
| 1165 |
"145": {
|
| 1166 |
-
"content": "
|
| 1167 |
"lstrip": false,
|
| 1168 |
"normalized": false,
|
| 1169 |
"rstrip": false,
|
|
@@ -1171,7 +1171,7 @@
|
|
| 1171 |
"special": false
|
| 1172 |
},
|
| 1173 |
"146": {
|
| 1174 |
-
"content": "
|
| 1175 |
"lstrip": false,
|
| 1176 |
"normalized": false,
|
| 1177 |
"rstrip": false,
|
|
@@ -1179,7 +1179,7 @@
|
|
| 1179 |
"special": false
|
| 1180 |
},
|
| 1181 |
"147": {
|
| 1182 |
-
"content": "
|
| 1183 |
"lstrip": false,
|
| 1184 |
"normalized": false,
|
| 1185 |
"rstrip": false,
|
|
@@ -1187,7 +1187,7 @@
|
|
| 1187 |
"special": false
|
| 1188 |
},
|
| 1189 |
"148": {
|
| 1190 |
-
"content": "
|
| 1191 |
"lstrip": false,
|
| 1192 |
"normalized": false,
|
| 1193 |
"rstrip": false,
|
|
@@ -1195,7 +1195,7 @@
|
|
| 1195 |
"special": false
|
| 1196 |
},
|
| 1197 |
"149": {
|
| 1198 |
-
"content": "
|
| 1199 |
"lstrip": false,
|
| 1200 |
"normalized": false,
|
| 1201 |
"rstrip": false,
|
|
@@ -1203,7 +1203,7 @@
|
|
| 1203 |
"special": false
|
| 1204 |
},
|
| 1205 |
"150": {
|
| 1206 |
-
"content": "
|
| 1207 |
"lstrip": false,
|
| 1208 |
"normalized": false,
|
| 1209 |
"rstrip": false,
|
|
@@ -1211,7 +1211,7 @@
|
|
| 1211 |
"special": false
|
| 1212 |
},
|
| 1213 |
"151": {
|
| 1214 |
-
"content": "
|
| 1215 |
"lstrip": false,
|
| 1216 |
"normalized": false,
|
| 1217 |
"rstrip": false,
|
|
@@ -1219,7 +1219,7 @@
|
|
| 1219 |
"special": false
|
| 1220 |
},
|
| 1221 |
"152": {
|
| 1222 |
-
"content": "
|
| 1223 |
"lstrip": false,
|
| 1224 |
"normalized": false,
|
| 1225 |
"rstrip": false,
|
|
@@ -1227,7 +1227,7 @@
|
|
| 1227 |
"special": false
|
| 1228 |
},
|
| 1229 |
"153": {
|
| 1230 |
-
"content": "
|
| 1231 |
"lstrip": false,
|
| 1232 |
"normalized": false,
|
| 1233 |
"rstrip": false,
|
|
@@ -1235,7 +1235,7 @@
|
|
| 1235 |
"special": false
|
| 1236 |
},
|
| 1237 |
"154": {
|
| 1238 |
-
"content": "
|
| 1239 |
"lstrip": false,
|
| 1240 |
"normalized": false,
|
| 1241 |
"rstrip": false,
|
|
@@ -1243,7 +1243,7 @@
|
|
| 1243 |
"special": false
|
| 1244 |
},
|
| 1245 |
"155": {
|
| 1246 |
-
"content": "
|
| 1247 |
"lstrip": false,
|
| 1248 |
"normalized": false,
|
| 1249 |
"rstrip": false,
|
|
@@ -1251,7 +1251,7 @@
|
|
| 1251 |
"special": false
|
| 1252 |
},
|
| 1253 |
"156": {
|
| 1254 |
-
"content": "
|
| 1255 |
"lstrip": false,
|
| 1256 |
"normalized": false,
|
| 1257 |
"rstrip": false,
|
|
@@ -1259,7 +1259,7 @@
|
|
| 1259 |
"special": false
|
| 1260 |
},
|
| 1261 |
"157": {
|
| 1262 |
-
"content": "
|
| 1263 |
"lstrip": false,
|
| 1264 |
"normalized": false,
|
| 1265 |
"rstrip": false,
|
|
@@ -1267,7 +1267,7 @@
|
|
| 1267 |
"special": false
|
| 1268 |
},
|
| 1269 |
"158": {
|
| 1270 |
-
"content": "
|
| 1271 |
"lstrip": false,
|
| 1272 |
"normalized": false,
|
| 1273 |
"rstrip": false,
|
|
@@ -1275,7 +1275,7 @@
|
|
| 1275 |
"special": false
|
| 1276 |
},
|
| 1277 |
"159": {
|
| 1278 |
-
"content": "
|
| 1279 |
"lstrip": false,
|
| 1280 |
"normalized": false,
|
| 1281 |
"rstrip": false,
|
|
@@ -1283,7 +1283,7 @@
|
|
| 1283 |
"special": false
|
| 1284 |
},
|
| 1285 |
"160": {
|
| 1286 |
-
"content": "
|
| 1287 |
"lstrip": false,
|
| 1288 |
"normalized": false,
|
| 1289 |
"rstrip": false,
|
|
@@ -1291,7 +1291,7 @@
|
|
| 1291 |
"special": false
|
| 1292 |
},
|
| 1293 |
"161": {
|
| 1294 |
-
"content": "
|
| 1295 |
"lstrip": false,
|
| 1296 |
"normalized": false,
|
| 1297 |
"rstrip": false,
|
|
@@ -1299,7 +1299,7 @@
|
|
| 1299 |
"special": false
|
| 1300 |
},
|
| 1301 |
"162": {
|
| 1302 |
-
"content": "
|
| 1303 |
"lstrip": false,
|
| 1304 |
"normalized": false,
|
| 1305 |
"rstrip": false,
|
|
@@ -1307,7 +1307,7 @@
|
|
| 1307 |
"special": false
|
| 1308 |
},
|
| 1309 |
"163": {
|
| 1310 |
-
"content": "
|
| 1311 |
"lstrip": false,
|
| 1312 |
"normalized": false,
|
| 1313 |
"rstrip": false,
|
|
@@ -1315,7 +1315,7 @@
|
|
| 1315 |
"special": false
|
| 1316 |
},
|
| 1317 |
"164": {
|
| 1318 |
-
"content": "
|
| 1319 |
"lstrip": false,
|
| 1320 |
"normalized": false,
|
| 1321 |
"rstrip": false,
|
|
@@ -1323,7 +1323,7 @@
|
|
| 1323 |
"special": false
|
| 1324 |
},
|
| 1325 |
"165": {
|
| 1326 |
-
"content": "
|
| 1327 |
"lstrip": false,
|
| 1328 |
"normalized": false,
|
| 1329 |
"rstrip": false,
|
|
@@ -1331,7 +1331,7 @@
|
|
| 1331 |
"special": false
|
| 1332 |
},
|
| 1333 |
"166": {
|
| 1334 |
-
"content": "
|
| 1335 |
"lstrip": false,
|
| 1336 |
"normalized": false,
|
| 1337 |
"rstrip": false,
|
|
@@ -1339,7 +1339,7 @@
|
|
| 1339 |
"special": false
|
| 1340 |
},
|
| 1341 |
"167": {
|
| 1342 |
-
"content": "
|
| 1343 |
"lstrip": false,
|
| 1344 |
"normalized": false,
|
| 1345 |
"rstrip": false,
|
|
@@ -51325,7 +51325,6 @@
|
|
| 51325 |
},
|
| 51326 |
"boi_token": "<start_of_image>",
|
| 51327 |
"bos_token": "<bos>",
|
| 51328 |
-
"chat_template": "{{ bos_token }}\n{%- if messages[0]['role'] == 'system' -%}\n {%- if messages[0]['content'] is string -%}\n {%- set first_user_prefix = messages[0]['content'] + '\n\n' -%}\n {%- else -%}\n {%- set first_user_prefix = messages[0]['content'][0]['text'] + '\n\n' -%}\n {%- endif -%}\n {%- set loop_messages = messages[1:] -%}\n{%- else -%}\n {%- set first_user_prefix = \"\" -%}\n {%- set loop_messages = messages -%}\n{%- endif -%}\n{%- for message in loop_messages -%}\n {%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) -%}\n {{ raise_exception(\"Conversation roles must alternate user/assistant/user/assistant/...\") }}\n {%- endif -%}\n {%- if (message['role'] == 'assistant') -%}\n {%- set role = \"model\" -%}\n {%- else -%}\n {%- set role = message['role'] -%}\n {%- endif -%}\n {{ '<start_of_turn>' + role + '\n' + (first_user_prefix if loop.first else \"\") }}\n {%- if message['content'] is string -%}\n {{ message['content'] | trim }}\n {%- elif message['content'] is iterable -%}\n {%- for item in message['content'] -%}\n {%- if item['type'] == 'image' -%}\n {{ '<start_of_image>' }}\n {%- elif item['type'] == 'text' -%}\n {{ item['text'] | trim }}\n {%- endif -%}\n {%- endfor -%}\n {%- else -%}\n {{ raise_exception(\"Invalid content type\") }}\n {%- endif -%}\n {{ '<end_of_turn>\n' }}\n{%- endfor -%}\n{%- if add_generation_prompt -%}\n {{'<start_of_turn>model\n'}}\n{%- endif -%}\n",
|
| 51329 |
"clean_up_tokenization_spaces": false,
|
| 51330 |
"eoi_token": "<end_of_image>",
|
| 51331 |
"eos_token": "<end_of_turn>",
|
|
@@ -51343,5 +51342,6 @@
|
|
| 51343 |
"spaces_between_special_tokens": false,
|
| 51344 |
"tokenizer_class": "GemmaTokenizer",
|
| 51345 |
"unk_token": "<unk>",
|
| 51346 |
-
"use_default_system_prompt": false
|
|
|
|
| 51347 |
}
|
|
|
|
| 1107 |
"special": false
|
| 1108 |
},
|
| 1109 |
"138": {
|
| 1110 |
+
"content": "ββ",
|
| 1111 |
"lstrip": false,
|
| 1112 |
"normalized": false,
|
| 1113 |
"rstrip": false,
|
|
|
|
| 1115 |
"special": false
|
| 1116 |
},
|
| 1117 |
"139": {
|
| 1118 |
+
"content": "βββ",
|
| 1119 |
"lstrip": false,
|
| 1120 |
"normalized": false,
|
| 1121 |
"rstrip": false,
|
|
|
|
| 1123 |
"special": false
|
| 1124 |
},
|
| 1125 |
"140": {
|
| 1126 |
+
"content": "ββββ",
|
| 1127 |
"lstrip": false,
|
| 1128 |
"normalized": false,
|
| 1129 |
"rstrip": false,
|
|
|
|
| 1131 |
"special": false
|
| 1132 |
},
|
| 1133 |
"141": {
|
| 1134 |
+
"content": "βββββ",
|
| 1135 |
"lstrip": false,
|
| 1136 |
"normalized": false,
|
| 1137 |
"rstrip": false,
|
|
|
|
| 1139 |
"special": false
|
| 1140 |
},
|
| 1141 |
"142": {
|
| 1142 |
+
"content": "ββββββ",
|
| 1143 |
"lstrip": false,
|
| 1144 |
"normalized": false,
|
| 1145 |
"rstrip": false,
|
|
|
|
| 1147 |
"special": false
|
| 1148 |
},
|
| 1149 |
"143": {
|
| 1150 |
+
"content": "βββββββ",
|
| 1151 |
"lstrip": false,
|
| 1152 |
"normalized": false,
|
| 1153 |
"rstrip": false,
|
|
|
|
| 1155 |
"special": false
|
| 1156 |
},
|
| 1157 |
"144": {
|
| 1158 |
+
"content": "ββββββββ",
|
| 1159 |
"lstrip": false,
|
| 1160 |
"normalized": false,
|
| 1161 |
"rstrip": false,
|
|
|
|
| 1163 |
"special": false
|
| 1164 |
},
|
| 1165 |
"145": {
|
| 1166 |
+
"content": "βββββββββ",
|
| 1167 |
"lstrip": false,
|
| 1168 |
"normalized": false,
|
| 1169 |
"rstrip": false,
|
|
|
|
| 1171 |
"special": false
|
| 1172 |
},
|
| 1173 |
"146": {
|
| 1174 |
+
"content": "ββββββββββ",
|
| 1175 |
"lstrip": false,
|
| 1176 |
"normalized": false,
|
| 1177 |
"rstrip": false,
|
|
|
|
| 1179 |
"special": false
|
| 1180 |
},
|
| 1181 |
"147": {
|
| 1182 |
+
"content": "βββββββββββ",
|
| 1183 |
"lstrip": false,
|
| 1184 |
"normalized": false,
|
| 1185 |
"rstrip": false,
|
|
|
|
| 1187 |
"special": false
|
| 1188 |
},
|
| 1189 |
"148": {
|
| 1190 |
+
"content": "ββββββββββββ",
|
| 1191 |
"lstrip": false,
|
| 1192 |
"normalized": false,
|
| 1193 |
"rstrip": false,
|
|
|
|
| 1195 |
"special": false
|
| 1196 |
},
|
| 1197 |
"149": {
|
| 1198 |
+
"content": "βββββββββββββ",
|
| 1199 |
"lstrip": false,
|
| 1200 |
"normalized": false,
|
| 1201 |
"rstrip": false,
|
|
|
|
| 1203 |
"special": false
|
| 1204 |
},
|
| 1205 |
"150": {
|
| 1206 |
+
"content": "ββββββββββββββ",
|
| 1207 |
"lstrip": false,
|
| 1208 |
"normalized": false,
|
| 1209 |
"rstrip": false,
|
|
|
|
| 1211 |
"special": false
|
| 1212 |
},
|
| 1213 |
"151": {
|
| 1214 |
+
"content": "βββββββββββββββ",
|
| 1215 |
"lstrip": false,
|
| 1216 |
"normalized": false,
|
| 1217 |
"rstrip": false,
|
|
|
|
| 1219 |
"special": false
|
| 1220 |
},
|
| 1221 |
"152": {
|
| 1222 |
+
"content": "ββββββββββββββββ",
|
| 1223 |
"lstrip": false,
|
| 1224 |
"normalized": false,
|
| 1225 |
"rstrip": false,
|
|
|
|
| 1227 |
"special": false
|
| 1228 |
},
|
| 1229 |
"153": {
|
| 1230 |
+
"content": "βββββββββββββββββ",
|
| 1231 |
"lstrip": false,
|
| 1232 |
"normalized": false,
|
| 1233 |
"rstrip": false,
|
|
|
|
| 1235 |
"special": false
|
| 1236 |
},
|
| 1237 |
"154": {
|
| 1238 |
+
"content": "ββββββββββββββββββ",
|
| 1239 |
"lstrip": false,
|
| 1240 |
"normalized": false,
|
| 1241 |
"rstrip": false,
|
|
|
|
| 1243 |
"special": false
|
| 1244 |
},
|
| 1245 |
"155": {
|
| 1246 |
+
"content": "βββββββββββββββββββ",
|
| 1247 |
"lstrip": false,
|
| 1248 |
"normalized": false,
|
| 1249 |
"rstrip": false,
|
|
|
|
| 1251 |
"special": false
|
| 1252 |
},
|
| 1253 |
"156": {
|
| 1254 |
+
"content": "ββββββββββββββββββββ",
|
| 1255 |
"lstrip": false,
|
| 1256 |
"normalized": false,
|
| 1257 |
"rstrip": false,
|
|
|
|
| 1259 |
"special": false
|
| 1260 |
},
|
| 1261 |
"157": {
|
| 1262 |
+
"content": "βββββββββββββββββββββ",
|
| 1263 |
"lstrip": false,
|
| 1264 |
"normalized": false,
|
| 1265 |
"rstrip": false,
|
|
|
|
| 1267 |
"special": false
|
| 1268 |
},
|
| 1269 |
"158": {
|
| 1270 |
+
"content": "ββββββββββββββββββββββ",
|
| 1271 |
"lstrip": false,
|
| 1272 |
"normalized": false,
|
| 1273 |
"rstrip": false,
|
|
|
|
| 1275 |
"special": false
|
| 1276 |
},
|
| 1277 |
"159": {
|
| 1278 |
+
"content": "βββββββββββββββββββββββ",
|
| 1279 |
"lstrip": false,
|
| 1280 |
"normalized": false,
|
| 1281 |
"rstrip": false,
|
|
|
|
| 1283 |
"special": false
|
| 1284 |
},
|
| 1285 |
"160": {
|
| 1286 |
+
"content": "ββββββββββββββββββββββββ",
|
| 1287 |
"lstrip": false,
|
| 1288 |
"normalized": false,
|
| 1289 |
"rstrip": false,
|
|
|
|
| 1291 |
"special": false
|
| 1292 |
},
|
| 1293 |
"161": {
|
| 1294 |
+
"content": "βββββββββββββββββββββββββ",
|
| 1295 |
"lstrip": false,
|
| 1296 |
"normalized": false,
|
| 1297 |
"rstrip": false,
|
|
|
|
| 1299 |
"special": false
|
| 1300 |
},
|
| 1301 |
"162": {
|
| 1302 |
+
"content": "ββββββββββββββββββββββββββ",
|
| 1303 |
"lstrip": false,
|
| 1304 |
"normalized": false,
|
| 1305 |
"rstrip": false,
|
|
|
|
| 1307 |
"special": false
|
| 1308 |
},
|
| 1309 |
"163": {
|
| 1310 |
+
"content": "βββββββββββββββββββββββββββ",
|
| 1311 |
"lstrip": false,
|
| 1312 |
"normalized": false,
|
| 1313 |
"rstrip": false,
|
|
|
|
| 1315 |
"special": false
|
| 1316 |
},
|
| 1317 |
"164": {
|
| 1318 |
+
"content": "ββββββββββββββββββββββββββββ",
|
| 1319 |
"lstrip": false,
|
| 1320 |
"normalized": false,
|
| 1321 |
"rstrip": false,
|
|
|
|
| 1323 |
"special": false
|
| 1324 |
},
|
| 1325 |
"165": {
|
| 1326 |
+
"content": "βββββββββββββββββββββββββββββ",
|
| 1327 |
"lstrip": false,
|
| 1328 |
"normalized": false,
|
| 1329 |
"rstrip": false,
|
|
|
|
| 1331 |
"special": false
|
| 1332 |
},
|
| 1333 |
"166": {
|
| 1334 |
+
"content": "ββββββββββββββββββββββββββββββ",
|
| 1335 |
"lstrip": false,
|
| 1336 |
"normalized": false,
|
| 1337 |
"rstrip": false,
|
|
|
|
| 1339 |
"special": false
|
| 1340 |
},
|
| 1341 |
"167": {
|
| 1342 |
+
"content": "βββββββββββββββββββββββββββββββ",
|
| 1343 |
"lstrip": false,
|
| 1344 |
"normalized": false,
|
| 1345 |
"rstrip": false,
|
|
|
|
| 51325 |
},
|
| 51326 |
"boi_token": "<start_of_image>",
|
| 51327 |
"bos_token": "<bos>",
|
|
|
|
| 51328 |
"clean_up_tokenization_spaces": false,
|
| 51329 |
"eoi_token": "<end_of_image>",
|
| 51330 |
"eos_token": "<end_of_turn>",
|
|
|
|
| 51342 |
"spaces_between_special_tokens": false,
|
| 51343 |
"tokenizer_class": "GemmaTokenizer",
|
| 51344 |
"unk_token": "<unk>",
|
| 51345 |
+
"use_default_system_prompt": false,
|
| 51346 |
+
"chat_template": "{{ bos_token }}\n{%- if messages[0]['role'] == 'system' -%}\n {%- if messages[0]['content'] is string -%}\n {%- set first_user_prefix = messages[0]['content'] + '\n\n' -%}\n {%- else -%}\n {%- set first_user_prefix = messages[0]['content'][0]['text'] + '\n\n' -%}\n {%- endif -%}\n {%- set loop_messages = messages[1:] -%}\n{%- else -%}\n {%- set first_user_prefix = \"\" -%}\n {%- set loop_messages = messages -%}\n{%- endif -%}\n{%- for message in loop_messages -%}\n {%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) -%}\n {{ raise_exception(\"Conversation roles must alternate user/assistant/user/assistant/...\") }}\n {%- endif -%}\n {%- if (message['role'] == 'assistant') -%}\n {%- set role = \"model\" -%}\n {%- else -%}\n {%- set role = message['role'] -%}\n {%- endif -%}\n {{ '<start_of_turn>' + role + '\n' + (first_user_prefix if loop.first else \"\") }}\n {%- if message['content'] is string -%}\n {{ message['content'] | trim }}\n {%- elif message['content'] is iterable -%}\n {%- for item in message['content'] -%}\n {%- if item['type'] == 'image' -%}\n {{ '<start_of_image>' }}\n {%- elif item['type'] == 'text' -%}\n {{ item['text'] | trim }}\n {%- endif -%}\n {%- endfor -%}\n {%- else -%}\n {{ raise_exception(\"Invalid content type\") }}\n {%- endif -%}\n {{ '<end_of_turn>\n' }}\n{%- endfor -%}\n{%- if add_generation_prompt -%}\n {{'<start_of_turn>model\n'}}\n{%- endif -%}\n"
|
| 51347 |
}
|