transformers
347b9fc9 - Fix Pyright type narrowing: assert EncoderDecoderCache in encoder-decoder branch

Commit
89 days ago
Fix Pyright type narrowing: assert EncoderDecoderCache in encoder-decoder branch Pyright infers `cache` as `StaticCache | EncoderDecoderCache` after the conditional reassignment, so accessing `.self_attention_cache` / `.cross_attention_cache` inside the guarded `if self.config.is_encoder_decoder` block raises unresolved-attribute errors. Adding an `assert isinstance` narrows the type without changing runtime behaviour. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Author
Parents
Loading