Skip to content

Transformers 4.53 support, SmolLM3 and Fix old Transformers support#2319

Merged
IlyasMoutawwakil merged 31 commits into
mainfrom
transformers-4.53
Jul 23, 2025
Merged

Transformers 4.53 support, SmolLM3 and Fix old Transformers support#2319
IlyasMoutawwakil merged 31 commits into
mainfrom
transformers-4.53

Conversation

@IlyasMoutawwakil
Copy link
Copy Markdown
Member

What does this PR do?

Fixes # (issue)

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

Who can review?

Comment thread optimum/exporters/onnx/model_patcher.py Outdated
Comment on lines +361 to +365
if is_transformers_version(">=", "4.53"):
from transformers.integrations.executorch import sdpa_mask_without_vmap
from transformers.masking_utils import AttentionMaskInterface

AttentionMaskInterface.register("sdpa", sdpa_mask_without_vmap)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using the patching spec here doesn't work because the original object is referenced in a dictionary in the AttentionMaskInterface

@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@IlyasMoutawwakil IlyasMoutawwakil marked this pull request as ready for review July 10, 2025 20:44
Comment thread tests/exporters/tflite/test_export_cli.py
Copy link
Copy Markdown
Collaborator

@echarlaix echarlaix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @IlyasMoutawwakil thanks a lot !

Comment thread optimum/exporters/base.py
def __init_subclass__(cls, **kwargs):
super().__init_subclass__(**kwargs)
logger.warning(
"The `ExportConfig` class is deprecated and will be removed in a future version. "
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread optimum/exporters/onnx/model_patcher.py
Comment thread optimum/exporters/onnx/model_patcher.py Outdated
@bil-ash
Copy link
Copy Markdown

bil-ash commented Jul 15, 2025

Would be nice if gemma3n(multimodal) support is also added along with this PR.

@IlyasMoutawwakil
Copy link
Copy Markdown
Member Author

Hi @bil-ash ! unfortunately it won't be that simple because optimum's onnx exporter doesn't support multimodal decoders yet.
Would love to review a PR, ideally taking inspiration from optimum's openvino exporter.
I will be adding SmolLM3 however.

@IlyasMoutawwakil IlyasMoutawwakil changed the title Transformers 4.53 support Transformers 4.53 support and SmolLM3 Jul 15, 2025
@DWarez
Copy link
Copy Markdown

DWarez commented Jul 18, 2025

hi, is there an eta for the merging of this PR? I'd like to use the sdpa_mask_without_vmap function (thanks a lot for that). That patching allows the export of gemma3-text, which has been required quite a bit in the issues 👀

DWarez added a commit to DWarez/optimum that referenced this pull request Jul 18, 2025
Comment thread optimum/exporters/onnx/__main__.py
Comment thread optimum/exporters/onnx/model_patcher.py
@IlyasMoutawwakil IlyasMoutawwakil changed the title Transformers 4.53 support and SmolLM3 Transformers 4.53 support, SmolLM3 and Fix old Transformers support Jul 22, 2025
@IlyasMoutawwakil IlyasMoutawwakil merged commit 53f39a6 into main Jul 23, 2025
46 of 49 checks passed
@IlyasMoutawwakil IlyasMoutawwakil deleted the transformers-4.53 branch July 23, 2025 10:33
IlyasMoutawwakil added a commit to huggingface/optimum-onnx that referenced this pull request Jul 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants