Instructions to use google/gemma-4-12B-it with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use google/gemma-4-12B-it with Transformers:
# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("google/gemma-4-12B-it") model = AutoModelForMultimodalLM.from_pretrained("google/gemma-4-12B-it", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- AMD Developer Cloud
Update README.md
Browse files
README.md
CHANGED
|
@@ -174,7 +174,7 @@ outputs = model.generate(**inputs, max_new_tokens=1024)
|
|
| 174 |
response = processor.decode(outputs[0][input_len:], skip_special_tokens=False)
|
| 175 |
|
| 176 |
# Parse output
|
| 177 |
-
processor.parse_response(response)
|
| 178 |
```
|
| 179 |
|
| 180 |
To enable reasoning, set `enable_thinking=True` and the `parse_response` function will take care of parsing the thinking output.
|
|
@@ -234,7 +234,7 @@ outputs = model.generate(**inputs, max_new_tokens=512)
|
|
| 234 |
response = processor.decode(outputs[0][input_len:], skip_special_tokens=False)
|
| 235 |
|
| 236 |
# Parse output
|
| 237 |
-
processor.parse_response(response)
|
| 238 |
```
|
| 239 |
|
| 240 |
</details>
|
|
@@ -292,7 +292,7 @@ outputs = model.generate(**inputs, max_new_tokens=512)
|
|
| 292 |
response = processor.decode(outputs[0][input_len:], skip_special_tokens=False)
|
| 293 |
|
| 294 |
# Parse output
|
| 295 |
-
processor.parse_response(response)
|
| 296 |
```
|
| 297 |
|
| 298 |
</details>
|
|
@@ -351,7 +351,7 @@ outputs = model.generate(**inputs, max_new_tokens=512)
|
|
| 351 |
response = processor.decode(outputs[0][input_len:], skip_special_tokens=False)
|
| 352 |
|
| 353 |
# Parse output
|
| 354 |
-
processor.parse_response(response)
|
| 355 |
```
|
| 356 |
|
| 357 |
</details>
|
|
|
|
| 174 |
response = processor.decode(outputs[0][input_len:], skip_special_tokens=False)
|
| 175 |
|
| 176 |
# Parse output
|
| 177 |
+
processor.parse_response(response, prefix=inputs["input_ids"])
|
| 178 |
```
|
| 179 |
|
| 180 |
To enable reasoning, set `enable_thinking=True` and the `parse_response` function will take care of parsing the thinking output.
|
|
|
|
| 234 |
response = processor.decode(outputs[0][input_len:], skip_special_tokens=False)
|
| 235 |
|
| 236 |
# Parse output
|
| 237 |
+
processor.parse_response(response, prefix=inputs["input_ids"])
|
| 238 |
```
|
| 239 |
|
| 240 |
</details>
|
|
|
|
| 292 |
response = processor.decode(outputs[0][input_len:], skip_special_tokens=False)
|
| 293 |
|
| 294 |
# Parse output
|
| 295 |
+
processor.parse_response(response, prefix=inputs["input_ids"])
|
| 296 |
```
|
| 297 |
|
| 298 |
</details>
|
|
|
|
| 351 |
response = processor.decode(outputs[0][input_len:], skip_special_tokens=False)
|
| 352 |
|
| 353 |
# Parse output
|
| 354 |
+
processor.parse_response(response, prefix=inputs["input_ids"])
|
| 355 |
```
|
| 356 |
|
| 357 |
</details>
|