Skip to content

Conversation

@Ankit-06679
Copy link

Add Gemma3 VLM Support for ONNX Export

🎯 Overview

This PR adds comprehensive support for Gemma3 Vision Language Model (VLM) variants in the ONNX export functionality, enabling users to export both Gemma2 base models and PaliGemma VLM models to ONNX format.

1. Gemma2 Base Model Support

  • Model Type: gemma2
  • ONNX Config: models.gemma2.Gemma2OnnxConfig
  • Supported Features:
    • default - Basic inference
    • default-with-past - Optimized inference with KV cache
    • causal-lm - Causal language modeling
    • causal-lm-with-past - Optimized causal LM with KV cache
    • sequence-classification - Text classification
    • token-classification - Token-level classification

2. PaliGemma VLM Support

  • Model Type: paligemma
  • ONNX Config: models.paligemma.PaliGemmaOnnxConfig
  • Supported Features:
    • default - Basic inference
    • vision2seq-lm - Vision-to-sequence language modeling

- Add Gemma3OnnxConfig class with proper configuration
- Register gemma3 model type for text generation and classification tasks
- Add Gemma3 to supported architectures and test mappings
- Set minimum transformers version requirement to 4.50.0
- Follow same pattern as existing Gemma/Gemma2 implementations

Fixes: ValueError when exporting Gemma3 models to ONNX format
Resolves: 'gemma3 model, that is a custom or unsupported architecture' error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant