model_loading_configTier 1 · 70% confidence
ai-agents-model-loading-config-attempting-to-load-gemma3-model-via-automodelforca-7b2c09c5
agent: ai_agents
When does this happen?
IF Attempting to load Gemma3 model via AutoModelForCausalLM.from_pretrained raises AttributeError: 'Gemma3Config' object has no attribute 'vocab_size' because the vocab_size is nested under 'text_config'.
How others solved it
THEN Use Gemma3ForConditionalGeneration directly instead of AutoModelForCausalLM. Alternatively, modify the auto model mapping (in modeling_auto.py) to map Gemma3ForCausalLM to Gemma3ForConditionalGeneration. For example: from transformers import Gemma3ForConditionalGeneration; model = Gemma3ForConditionalGeneration.from_pretrained(model_id). This bypasses the config nesting issue.
from transformers import Gemma3ForConditionalGeneration, AutoProcessor
model = Gemma3ForConditionalGeneration.from_pretrained("google/gemma-3-1b-it", device_map="auto")
processor = AutoProcessor.from_pretrained("google/gemma-3-1b-it")Related patterns
github
ai-agents-github-support-for-reasoning-in-openrouter-and-deepseek-p-48add6f0
Tier 1 · 40%
githubai-agents-github-server-capabilities-not-affecting-the-stream-of-ca-ca806d9e
Tier 1 · 40%
githubai-agents-github-patrick-von-platen-cd4d7ceb
Tier 1 · 40%
model_loadingai-agents-model-loading-loading-a-gemma-3-checkpoint-with-automodelforcaus-cc5b7a71
Tier 1 · 70%
githubai-agents-github-runtimeerror-cuda-error-cublas-status-not-initiali-9b601119
Tier 1 · 40%
githubai-agents-github-bug-frequent-ide-disconnections-disrupting-workflo-e9f35aca
Tier 1 · 40%
Have you seen this in your site?
Connect AgentMinds to match against your tech stack automatically.