Skip to content

Commit

Permalink
Remove sdpa available patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Oscilloscope98 committed Jan 22, 2025
1 parent c9b6c94 commit eac7811
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
4 changes: 1 addition & 3 deletions python/llm/src/ipex_llm/transformers/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

from .utils import logger, load_state_dict
from .utils import extract_local_archive_file, get_local_shard_files, load_imatrix_data
from .patches import patch_flash_attn_import, patch_sdpa_available
from .patches import patch_flash_attn_import

patched_training_mode = None

Expand Down Expand Up @@ -108,7 +108,6 @@ class _BaseAutoModelClass:

@classmethod
@patch("transformers.dynamic_module_utils.get_imports", patch_flash_attn_import)
@patch("transformers.modeling_utils.is_torch_sdpa_available", patch_sdpa_available, create=True)
def from_pretrained(cls,
*args,
**kwargs):
Expand Down Expand Up @@ -531,7 +530,6 @@ def load_convert(cls, q_k, optimize_model, *args, **kwargs):

@classmethod
@patch("transformers.dynamic_module_utils.get_imports", patch_flash_attn_import)
@patch("transformers.modeling_utils.is_torch_sdpa_available", patch_sdpa_available, create=True)
def load_low_bit(cls,
pretrained_model_name_or_path,
*model_args,
Expand Down
11 changes: 0 additions & 11 deletions python/llm/src/ipex_llm/transformers/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,3 @@ def patch_flash_attn_import(filename: str) -> List[str]:
if "flash_attn" in imports:
imports.remove("flash_attn")
return imports


def patch_sdpa_available() -> bool:
if IPEXImporter.is_xpu_version_installed():
return False
else:
try:
from transformers.utils import is_torch_sdpa_available
return is_torch_sdpa_available()
except ImportError:
return False

0 comments on commit eac7811

Please sign in to comment.