From fe33b1040ddc16c0e69dd0e86cacaa19f3c71207 Mon Sep 17 00:00:00 2001 From: fxmarty <9808326+fxmarty@users.noreply.github.com> Date: Tue, 16 Jan 2024 17:10:44 +0100 Subject: [PATCH] Clearer error for SDPA when explicitely requested (#28006) * clearer error for sdpa * better message --- src/transformers/modeling_utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/transformers/modeling_utils.py b/src/transformers/modeling_utils.py index e863d880e71f62..c91151f67a04bb 100644 --- a/src/transformers/modeling_utils.py +++ b/src/transformers/modeling_utils.py @@ -1540,8 +1540,9 @@ def _check_and_enable_sdpa(cls, config, hard_check_only: bool = False) -> Pretra if hard_check_only: if not cls._supports_sdpa: raise ValueError( - f"{cls.__name__} does not support an attention implementation through torch.nn.functional.scaled_dot_product_attention yet. Please open an issue on GitHub to " - "request support for this architecture: https://github.com/huggingface/transformers/issues/new" + f"{cls.__name__} does not support an attention implementation through torch.nn.functional.scaled_dot_product_attention yet." + " Please request the support for this architecture: https://github.com/huggingface/transformers/issues/28005. If you believe" + ' this error is a bug, please open an issue in Transformers GitHub repository and load your model with the argument `attn_implementation="eager"` meanwhile. Example: `model = AutoModel.from_pretrained("openai/whisper-tiny", attn_implementation="eager")`' ) if not is_torch_sdpa_available(): raise ImportError(