Skip to content

Commit 053725e

Browse files
committed
use version
1 parent 5723c43 commit 053725e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

onnx_diagnostic/torch_export_patches/patches/patch_transformers.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from dataclasses import dataclass
33
from functools import wraps
44
from typing import Any, Callable, Dict, List, Optional, Tuple
5+
import packaging.version as pv
56
import torch
67
import transformers
78
from transformers.modeling_attn_mask_utils import AttentionMaskConverter
@@ -887,9 +888,11 @@ class patched_Phi4MultimodalRotaryEmbedding(common_RotaryEmbedding):
887888
)
888889

889890

890-
class patched_SmolLM3RotaryEmbedding(common_RotaryEmbedding):
891-
_PATCHES_ = ["forward"]
892-
_PATCHED_CLASS_ = transformers.models.smollm3.modeling_smollm3.SmolLM3RotaryEmbedding
891+
if pv.Version(transformers.__version__) >= pv.Version("4.53"):
892+
893+
class patched_SmolLM3RotaryEmbedding(common_RotaryEmbedding):
894+
_PATCHES_ = ["forward"]
895+
_PATCHED_CLASS_ = transformers.models.smollm3.modeling_smollm3.SmolLM3RotaryEmbedding
893896

894897

895898
class patched_IdeficsEmbedding(torch.nn.Module):

0 commit comments

Comments
 (0)