cannot import name 'Gemma3ForConditionalGeneration' from 'transformers'
cannot import name 'Gemma3ForConditionalGeneration' from 'transformers' (C:\Users\ansh1\Transformers\env1\Lib\site-packages\transformers_init_.py)
I have the latest version of python, transformers==4.49.0 but still getting this error
Hi @ansh10dave , To use Gemma-3 models, we need the latest development version of the Transformers library (4.50.0.dev0). we can install it directly from the GitHub branch using: pip install git+https://github.com/huggingface/transformers@v4.49.0-Gemma-3 as mentioned here.
Kindly find the reference gist file. if you have any concerns let us know.
Thank you.
I had the same issue where I couldn’t import Gemma3ForConditionalGeneration even though I was using Transformers 4.49.0. I solved it by force‐reinstalling the GitHub branch that includes Gemma‑3 support. Running the following command fixed the issue for me:
pip install --upgrade --force-reinstall git+https://github.com/huggingface/transformers@v4.49.0-Gemma-3
This command installs the development version of Transformers (specifically the v4.49.0-Gemma-3 branch) that includes the necessary modifications to properly support the Gemma‑3 models.
I hope this helps anyone encountering the same error. Feel free to ask if you have any questions!
Thanks Lavanya, Jaykin. Got it working