only warn about prepare causal attention mask when transformers<=4.52.4 (#2867)
This commit is contained in:
parent
a74e44cb65
commit
95f4dc6137
1 changed files with 7 additions and 6 deletions
|
|
@ -152,12 +152,13 @@ def _fast_prepare_inputs_for_generation(self, input_ids, attention_mask=None, **
|
|||
)
|
||||
else:
|
||||
attention_mask = attention_mask[:,[-1]]
|
||||
logger.warning_once(
|
||||
f"{self.__class__.__name__} has no `_prepare_4d_causal_attention_mask_with_cache_position` method "
|
||||
"defined in its base modeling class. Compiled forward passes will be sub-optimal. If you're "
|
||||
"writing code, see Llama for an example implementation. If you're a user, please report this "
|
||||
"issue on GitHub."
|
||||
)
|
||||
if transformers_version <= Version("4.52.4"):
|
||||
logger.warning_once(
|
||||
f"{self.__class__.__name__} has no `_prepare_4d_causal_attention_mask_with_cache_position` method "
|
||||
"defined in its base modeling class. Compiled forward passes will be sub-optimal. If you're "
|
||||
"writing code, see Llama for an example implementation. If you're a user, please report this "
|
||||
"issue on GitHub."
|
||||
)
|
||||
|
||||
if "cache_position" in kwargs:
|
||||
kwargs["position_ids"] = kwargs["cache_position"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue