Fix transformers 5.6 remote-code load
Browse files- modeling_kimi_k25.py: add direct relative import of configuration_deepseek so transformers 5.6 fetches the 2-level-deep file into the dynamic-module cache (get_class_from_dynamic_module previously failed with FileNotFoundError).
- modeling_deepseek.py: drop is_torch_fx_available import + dead fx-wrap block (symbol removed in transformers 5.x).
- modeling_deepseek.py +0 -7
- modeling_kimi_k25.py +1 -0
modeling_deepseek.py
CHANGED
|
@@ -44,7 +44,6 @@ from transformers.utils import (add_start_docstrings,
|
|
| 44 |
is_flash_attn_2_available,
|
| 45 |
is_flash_attn_greater_or_equal_2_10, logging,
|
| 46 |
replace_return_docstrings)
|
| 47 |
-
from transformers.utils.import_utils import is_torch_fx_available
|
| 48 |
|
| 49 |
from .configuration_deepseek import DeepseekV3Config
|
| 50 |
|
|
@@ -55,12 +54,6 @@ if is_flash_attn_2_available():
|
|
| 55 |
|
| 56 |
# This makes `_prepare_4d_causal_attention_mask` a leaf function in the FX graph.
|
| 57 |
# It means that the function will not be traced through and simply appear as a node in the graph.
|
| 58 |
-
if is_torch_fx_available():
|
| 59 |
-
if not is_torch_greater_or_equal_than_1_13:
|
| 60 |
-
import torch.fx
|
| 61 |
-
|
| 62 |
-
_prepare_4d_causal_attention_mask = torch.fx.wrap(
|
| 63 |
-
_prepare_4d_causal_attention_mask)
|
| 64 |
|
| 65 |
logger = logging.get_logger(__name__)
|
| 66 |
|
|
|
|
| 44 |
is_flash_attn_2_available,
|
| 45 |
is_flash_attn_greater_or_equal_2_10, logging,
|
| 46 |
replace_return_docstrings)
|
|
|
|
| 47 |
|
| 48 |
from .configuration_deepseek import DeepseekV3Config
|
| 49 |
|
|
|
|
| 54 |
|
| 55 |
# This makes `_prepare_4d_causal_attention_mask` a leaf function in the FX graph.
|
| 56 |
# It means that the function will not be traced through and simply appear as a node in the graph.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
logger = logging.get_logger(__name__)
|
| 59 |
|
modeling_kimi_k25.py
CHANGED
|
@@ -64,6 +64,7 @@ from transformers.models.llava.modeling_llava import \
|
|
| 64 |
from transformers.utils import is_flash_attn_2_available
|
| 65 |
|
| 66 |
from .configuration_kimi_k25 import KimiK25Config
|
|
|
|
| 67 |
from .modeling_deepseek import DeepseekV3ForCausalLM
|
| 68 |
|
| 69 |
# Flash attention imports
|
|
|
|
| 64 |
from transformers.utils import is_flash_attn_2_available
|
| 65 |
|
| 66 |
from .configuration_kimi_k25 import KimiK25Config
|
| 67 |
+
from .configuration_deepseek import DeepseekV3Config # noqa: F401 (ensure dynamic-module fetch)
|
| 68 |
from .modeling_deepseek import DeepseekV3ForCausalLM
|
| 69 |
|
| 70 |
# Flash attention imports
|