Skip to content

fix: split local-tokenizer extras for SentencePiece-only installs - #2812

Open
a2105z wants to merge 1 commit into
googleapis:mainfrom
a2105z:fix/split-local-tokenizer-extras
Open

fix: split local-tokenizer extras for SentencePiece-only installs#2812
a2105z wants to merge 1 commit into
googleapis:mainfrom
a2105z:fix/split-local-tokenizer-extras

Conversation

@a2105z

@a2105z a2105z commented Aug 4, 2026

Copy link
Copy Markdown

Summary

  • Fixes #2728: google-genai[local-tokenizer] no longer installs the full Hugging Face / PyTorch / CUDA stack for SentencePiece-backed models (for example gemini-2.5-flash).
  • Adds google-genai[local-tokenizer-gemma4] for Gemma 4–backed models that still need transformers, torch, torchvision, and pillow.
  • Improves the Gemma 4 missing-dependency error to point at the new extra, and documents both extras in the README / LocalTokenizer docstring.

Test plan

  • pytest google/genai/tests/local_tokenizer/
  • Confirm local-tokenizer extras contain only sentencepiece + protobuf
  • Docs/README updated for local-tokenizer vs local-tokenizer-gemma4
  • CI green
  • Optional: install-size check — [local-tokenizer] stays lightweight vs [local-tokenizer-gemma4]

Keep google-genai[local-tokenizer] limited to sentencepiece/protobuf so
Gemini 2.x models do not pull the Hugging Face PyTorch stack. Move
torch/transformers/pillow into local-tokenizer-gemma4 and point Gemma 4
import errors at that extra. Fixes googleapis#2728.
@a2105z

a2105z commented Aug 4, 2026

Copy link
Copy Markdown
Author

@Venkaiahbabuneelam this PR splits local-tokenizer so SentencePiece-only installs stay light and moves the Gemma 4 stack behind local-tokenizer-gemma4; whenever you have a moment, I would really appreciate your review — thank you for your time.

@Venkaiahbabuneelam Venkaiahbabuneelam self-assigned this Aug 4, 2026
@Venkaiahbabuneelam Venkaiahbabuneelam added the size:L Code changes between 40-100 lines label Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L Code changes between 40-100 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

local-tokenizer extra installs the full PyTorch/CUDA stack for SentencePiece-only models

2 participants