Skip to content

Commit ef78cd9

Browse files
committed
fix
1 parent ebf6f2f commit ef78cd9

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

mindone/transformers/generation/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2050,7 +2050,7 @@ def _supports_default_dynamic_cache(cls) -> bool:
20502050
"""
20512051
# NOTE: remove xlnet/reformer when the models are deprecated, non-standard model architecture/cache name
20522052
return not cls._is_stateful and all(
2053-
special_model_name not in cls.__class__.__name__.lower()
2053+
special_model_name not in cls.__name__.lower()
20542054
for special_model_name in [
20552055
"reformer",
20562056
"minimax",

mindone/transformers/models/kyutai_speech_to_text/modeling_kyutai_speech_to_text.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1169,12 +1169,15 @@ def _prepare_model_inputs(
11691169
cache_methods = [
11701170
"_prepare_cache_for_generation",
11711171
"_get_cache",
1172-
"_supports_default_dynamic_cache",
11731172
# "_get_layer_device_map_for_cache_init",
11741173
]
11751174
for method in cache_methods:
11761175
setattr(self.codec_model, method, types.MethodType(getattr(self, method).__func__, self.codec_model))
11771176

1177+
setattr(
1178+
self.codec_model, "_supports_default_dynamic_cache", types.MethodType(lambda x: True, self.codec_model)
1179+
)
1180+
11781181
self.codec_model._prepare_cache_for_generation(
11791182
generation_config=self.codec_model.generation_config,
11801183
model_kwargs=temporary_model_kwargs,

0 commit comments

Comments
 (0)