You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: add comprehensive omni multimodal example for Gemma-4
- Wrapped the existing Qwen3-VL image loading example in a `<details>` block to improve README readability and save vertical space.
- Introduced a complete, production-ready "Omni MultiModal" example demonstrating simultaneous Vision and Audio processing using the `Gemma4ChatHandler`.
- Added a universal `build_media_payload` helper function to dynamically route and encode local files into OpenAI-compatible `image_url` and `input_audio` payload structures.
- Added crucial documentation clarifying multimodal capability differences across Gemma-4 variants (E2B/E4B supporting full audio/vision vs. 31B/26BA4B supporting vision only).
Signed-off-by: JamePeng <jame_peng@sina.com>
**Note**: Multi-modal models also support tool calling and JSON mode.
902
902
903
+
903
904
## Loading a Local Image With Qwen3VL(Thinking/Instruct)
904
905
905
-
This script demonstrates how to load a local image, encode it as a base64 Data URI, and pass it to a local Qwen3-VL model (with the 'force_reasoning' parameter enabled for thinking model, disabled for instruct model) for processing using the llama-cpp-python library.
906
+
<summary>This script demonstrates how to load a local image, encode it as a base64 Data URI, and pass it to a local Qwen3-VL model (with the 'force_reasoning' parameter enabled for thinking model, disabled for instruct model) for processing using the llama-cpp-python library.</summary><br>
Below is a complete, production-ready example demonstrating how to dynamically route and process both image and audio files. It includes a universal media processor that automatically converts local files into the correct payload structure (Data URIs for images, and `input_audio`for audio files).
1064
+
1065
+
>**⚠️ IMPORTANT: GEMMA-4 MODEL CAPABILITIES & LIMITATIONS**
1066
+
>***Gemma4 E2B / E4B:** Supports Full Multimodal (Vision + Audio + Text). `enable_thinking`**MUST** be `True`(default).
1067
+
>***Gemma4 31B / 26BA4B:** Supports Vision + Text ONLY (Audio is NOT supported). `enable_thinking` can be toggled (`True` or `False`).
1068
+
1069
+
```python
1070
+
from llama_cpp import Llama
1071
+
from llama_cpp.llama_chat_format import Gemma4ChatHandler
1072
+
import base64
1073
+
import os
1074
+
1075
+
# Model and multimodal projection paths
1076
+
MODEL_PATH = r"/path/to/Gemma-4-E4B-It-BF16.gguf"
1077
+
# BF16 mmproj is required for audio. Other quantizations are known to have degraded performance.
0 commit comments