Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/transformers/generation/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1852,7 +1852,7 @@ def _prepare_cache_for_generation(
# linear attention models always need to pass the config, otherwise it will use an Attention cache for the LinearAttention layers
is_linear_attention = any(
x in ("mamba", "conv", "linear_attention")
for x in getattr(self.config.get_text_config(decoder=True), "layer_types", [])
for x in (getattr(self.config.get_text_config(decoder=True), "layer_types", []) or [])
)
if generation_config.cache_implementation != "dynamic_full" or is_linear_attention:
dynamic_cache_kwargs["config"] = self.config.get_text_config(decoder=True)
Expand Down
Loading