Instructions to use google/gemma-4-E2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use google/gemma-4-E2B with Transformers:
# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("google/gemma-4-E2B") model = AutoModelForImageTextToText.from_pretrained("google/gemma-4-E2B") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -199,13 +199,13 @@ Once the model is loaded, you can start generating output by directly referencin
|
|
| 199 |
|
| 200 |
|
| 201 |
```python
|
| 202 |
-
# Prompt - add audio
|
| 203 |
messages = [
|
| 204 |
{
|
| 205 |
"role": "user",
|
| 206 |
"content": [
|
| 207 |
-
{"type": "audio", "audio": "https://raw.githubusercontent.com/google-gemma/cookbook/refs/heads/main/Demos/sample-data/journal1.wav"},
|
| 208 |
{"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."},
|
|
|
|
| 209 |
]
|
| 210 |
}
|
| 211 |
]
|
|
@@ -262,7 +262,7 @@ Once the model is loaded, you can start generating output by directly referencin
|
|
| 262 |
messages = [
|
| 263 |
{
|
| 264 |
"role": "user", "content": [
|
| 265 |
-
{"type": "image", "url": "https://raw.githubusercontent.com/google-gemma/cookbook/refs/heads/main/
|
| 266 |
{"type": "text", "text": "What is shown in this image?"}
|
| 267 |
]
|
| 268 |
}
|
|
|
|
| 199 |
|
| 200 |
|
| 201 |
```python
|
| 202 |
+
# Prompt - add audio after text
|
| 203 |
messages = [
|
| 204 |
{
|
| 205 |
"role": "user",
|
| 206 |
"content": [
|
|
|
|
| 207 |
{"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."},
|
| 208 |
+
{"type": "audio", "audio": "https://raw.githubusercontent.com/google-gemma/cookbook/refs/heads/main/apps/sample-data/journal1.wav"},
|
| 209 |
]
|
| 210 |
}
|
| 211 |
]
|
|
|
|
| 262 |
messages = [
|
| 263 |
{
|
| 264 |
"role": "user", "content": [
|
| 265 |
+
{"type": "image", "url": "https://raw.githubusercontent.com/google-gemma/cookbook/refs/heads/main/apps/sample-data/GoldenGate.png"},
|
| 266 |
{"type": "text", "text": "What is shown in this image?"}
|
| 267 |
]
|
| 268 |
}
|