Instructions to use google/gemma-4-12B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use google/gemma-4-12B with Transformers:
# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("google/gemma-4-12B") model = AutoModelForMultimodalLM.from_pretrained("google/gemma-4-12B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README
#12
by MaartenGr - opened
README.md
CHANGED
|
@@ -214,7 +214,7 @@ messages = [
|
|
| 214 |
"role": "user",
|
| 215 |
"content": [
|
| 216 |
{"type": "text", "text": "Transcribe the following speech segment in its original language. Follow these specific instructions for formatting the answer:\n* Only output the transcription, with no newlines.\n* When transcribing numbers, write the digits, i.e. write 1.7 and not one point seven, and write 3 instead of three."},
|
| 217 |
-
{"type": "audio", "audio": "https://raw.githubusercontent.com/google-gemma/cookbook/refs/heads/main/
|
| 218 |
]
|
| 219 |
}
|
| 220 |
]
|
|
@@ -271,7 +271,7 @@ Once the model is loaded, you can start generating output by directly referencin
|
|
| 271 |
messages = [
|
| 272 |
{
|
| 273 |
"role": "user", "content": [
|
| 274 |
-
{"type": "image", "url": "https://raw.githubusercontent.com/google-gemma/cookbook/refs/heads/main/
|
| 275 |
{"type": "text", "text": "What is shown in this image?"}
|
| 276 |
]
|
| 277 |
}
|
|
@@ -385,7 +385,7 @@ Compared to Gemma 3, the models use standard `system`, `assistant`, and `user` r
|
|
| 385 |
|
| 386 |
### 3. Multi-Turn Conversations
|
| 387 |
|
| 388 |
-
* **No Thinking Content in History**: In multi-turn conversations, the historical model output should only include the final response. Thoughts from previous model turns must *not be added* before the next user turn begins.
|
| 389 |
|
| 390 |
### 4. Modality order
|
| 391 |
|
|
|
|
| 214 |
"role": "user",
|
| 215 |
"content": [
|
| 216 |
{"type": "text", "text": "Transcribe the following speech segment in its original language. Follow these specific instructions for formatting the answer:\n* Only output the transcription, with no newlines.\n* When transcribing numbers, write the digits, i.e. write 1.7 and not one point seven, and write 3 instead of three."},
|
| 217 |
+
{"type": "audio", "audio": "https://raw.githubusercontent.com/google-gemma/cookbook/refs/heads/main/apps/sample-data/journal1.wav"},
|
| 218 |
]
|
| 219 |
}
|
| 220 |
]
|
|
|
|
| 271 |
messages = [
|
| 272 |
{
|
| 273 |
"role": "user", "content": [
|
| 274 |
+
{"type": "image", "url": "https://raw.githubusercontent.com/google-gemma/cookbook/refs/heads/main/apps/sample-data/GoldenGate.png"},
|
| 275 |
{"type": "text", "text": "What is shown in this image?"}
|
| 276 |
]
|
| 277 |
}
|
|
|
|
| 385 |
|
| 386 |
### 3. Multi-Turn Conversations
|
| 387 |
|
| 388 |
+
* **No Thinking Content in History**: In multi-turn conversations, the historical model output should only include the final response. Thoughts from previous model turns must *not be added* before the next user turn begins, with the exception of tool call turns where thinking content should be preserved.
|
| 389 |
|
| 390 |
### 4. Modality order
|
| 391 |
|