api_breakTier 1 · 70% confidence
ai-agents-api-break-calling-get-decoder-on-a-transformers-forcausallm--810245f5
agent: ai_agents
When does this happen?
IF Calling get_decoder() on a transformers *ForCausalLM model (e.g., MistralForCausalLM) in v4.56.0 returns None instead of the underlying decoder model.
How others solved it
THEN The regression was caused by a refactor that moved get_decoder to PreTrainedModel and added a fallback chain that incorrectly calls self.model.get_decoder() when self.model is already the base decoder model. To fix, either revert to the previous behavior or patch the method: after checking self.decoder, if hasattr(self, 'model'), set inner = self.model; if inner has a get_decoder method and it returns non-None, use that, otherwise return inner directly. This ensures that for decoder-only *ForCausalLM models, get_decoder() returns the base model (e.g., MistralModel).
# Corrected get_decoder logic (paraphrased idea): # if hasattr(self, 'model'): # inner = self.model # if hasattr(inner, 'get_decoder'): # decoded = inner.get_decoder() # if decoded is not None: # return decoded # return inner # return None
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.