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:
# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("google/gemma-4-E2B") model = AutoModelForMultimodalLM.from_pretrained("google/gemma-4-E2B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Fix: add required prefix argument to parse_response across all usage snippets
#11
by turab1 - opened
README.md
CHANGED
|
@@ -170,7 +170,7 @@ outputs = model.generate(**inputs, max_new_tokens=1024)
|
|
| 170 |
response = processor.decode(outputs[0][input_len:], skip_special_tokens=False)
|
| 171 |
|
| 172 |
# Parse output
|
| 173 |
-
processor.parse_response(response)
|
| 174 |
```
|
| 175 |
|
| 176 |
To enable reasoning, set `enable_thinking=True` and the `parse_response` function will take care of parsing the thinking output.
|
|
@@ -230,7 +230,7 @@ outputs = model.generate(**inputs, max_new_tokens=512)
|
|
| 230 |
response = processor.decode(outputs[0][input_len:], skip_special_tokens=False)
|
| 231 |
|
| 232 |
# Parse output
|
| 233 |
-
processor.parse_response(response)
|
| 234 |
```
|
| 235 |
|
| 236 |
</details>
|
|
@@ -288,7 +288,7 @@ outputs = model.generate(**inputs, max_new_tokens=512)
|
|
| 288 |
response = processor.decode(outputs[0][input_len:], skip_special_tokens=False)
|
| 289 |
|
| 290 |
# Parse output
|
| 291 |
-
processor.parse_response(response)
|
| 292 |
```
|
| 293 |
|
| 294 |
</details>
|
|
@@ -347,7 +347,7 @@ outputs = model.generate(**inputs, max_new_tokens=512)
|
|
| 347 |
response = processor.decode(outputs[0][input_len:], skip_special_tokens=False)
|
| 348 |
|
| 349 |
# Parse output
|
| 350 |
-
processor.parse_response(response)
|
| 351 |
```
|
| 352 |
|
| 353 |
</details>
|
|
|
|
| 170 |
response = processor.decode(outputs[0][input_len:], skip_special_tokens=False)
|
| 171 |
|
| 172 |
# Parse output
|
| 173 |
+
processor.parse_response(response, prefix=inputs["input_ids"])
|
| 174 |
```
|
| 175 |
|
| 176 |
To enable reasoning, set `enable_thinking=True` and the `parse_response` function will take care of parsing the thinking output.
|
|
|
|
| 230 |
response = processor.decode(outputs[0][input_len:], skip_special_tokens=False)
|
| 231 |
|
| 232 |
# Parse output
|
| 233 |
+
processor.parse_response(response, prefix=inputs["input_ids"])
|
| 234 |
```
|
| 235 |
|
| 236 |
</details>
|
|
|
|
| 288 |
response = processor.decode(outputs[0][input_len:], skip_special_tokens=False)
|
| 289 |
|
| 290 |
# Parse output
|
| 291 |
+
processor.parse_response(response, prefix=inputs["input_ids"])
|
| 292 |
```
|
| 293 |
|
| 294 |
</details>
|
|
|
|
| 347 |
response = processor.decode(outputs[0][input_len:], skip_special_tokens=False)
|
| 348 |
|
| 349 |
# Parse output
|
| 350 |
+
processor.parse_response(response, prefix=inputs["input_ids"])
|
| 351 |
```
|
| 352 |
|
| 353 |
</details>
|