KEMBAR78
[ONNX] Remove enable_fake_mode and exporter_legacy by justinchuby · Pull Request #161222 · pytorch/pytorch · GitHub
Skip to content

Conversation

@justinchuby
Copy link
Collaborator

@justinchuby justinchuby commented Aug 21, 2025

Remove enable_fake_mode and exporter_legacy entirely. Even though this is bc breaking, enable_fake_mode is no longer compatible with the latest version of transformers, and so it is no longer useful.

cc @titaiwangms

Signed-off-by: Justin Chu <justinchu@microsoft.com>
@justinchuby justinchuby added module: onnx Related to torch.onnx topic: bc breaking topic category suppress-bc-linter Suppresses the failures of API backward-compatibility linter (Lint/bc_linter) labels Aug 21, 2025
@pytorch-bot
Copy link

pytorch-bot bot commented Aug 21, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/161222

Note: Links to docs will display an error until the docs builds have been completed.

⏳ No Failures, 12 Pending

As of commit 9e08dfe with merge base bbc7c03 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot bot added the release notes: onnx torch.onnx related changes that should show up in the release notes label Aug 21, 2025
Signed-off-by: Justin Chu <justinchu@microsoft.com>
@justinchuby justinchuby added the topic: docs topic category label Aug 21, 2025
@justinchuby justinchuby requested a review from Copilot August 21, 2025 23:37
@justinchuby justinchuby removed the fx label Aug 21, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR removes the enable_fake_mode function and legacy exporter infrastructure from PyTorch's ONNX export module. The removal addresses compatibility issues with the latest transformers library versions and simplifies the codebase by eliminating deprecated functionality.

  • Removes enable_fake_mode function and related fake tensor export capabilities
  • Deletes legacy FX-based serialization and patching utilities
  • Removes corresponding test cases and documentation references

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
torch/onnx/_internal/fx/serialization.py Entire file deleted - contained external data serialization utilities
torch/onnx/_internal/fx/patcher.py Entire file deleted - contained PyTorch patching context manager
torch/onnx/_internal/fx/passes/_utils.py Entire file deleted - contained FX pass utility functions
torch/onnx/_internal/fx/init.py Entire file deleted - package initialization
torch/onnx/_internal/_exporter_legacy.py Entire file deleted - contained enable_fake_mode implementation
torch/onnx/init.py Removes enable_fake_mode import and export
test/onnx/exporter/test_api.py Removes fake tensor export tests, reorganizes remaining tests
docs/source/onnx_export.md Removes enable_fake_mode documentation reference
docs/source/onnx.md Removes enable_fake_mode documentation reference

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@justinchuby justinchuby added this to the 2.9.0 milestone Aug 21, 2025
Signed-off-by: Justin Chu <justinchu@microsoft.com>
Copy link
Collaborator

@titaiwangms titaiwangms left a comment

Choose a reason for hiding this comment

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

Why is it no longer compatible with latest transformers? What's the error?

@justinchuby
Copy link
Collaborator Author

Why is it no longer compatible with latest transformers? What's the error?

I got a module not found error - but I need to double check if it is due to my environment

@justinchuby
Copy link
Collaborator Author

I got transformers.modeling_utils was not found. Maybe it needs to be imported differently because the source code was still there. In any case there are better weights to get a config-only model, and we should not encode too much knowledge about hf libraries as patches here.

@justinchuby
Copy link
Collaborator Author

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Aug 22, 2025
@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@justinchuby
Copy link
Collaborator Author

@pytorchbot merge -f "all relevant tests passed"

@pytorchmergebot
Copy link
Collaborator

The merge job was canceled or timed out. This most often happen if two merge requests were issued for the same PR, or if merge job was waiting for more than 6 hours for tests to finish. In later case, please do not hesitate to reissue the merge command
For more information see pytorch-bot wiki.

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@justinchuby justinchuby deleted the justinchu/patchers branch August 22, 2025 22:17
markc-614 pushed a commit to markc-614/pytorch that referenced this pull request Sep 17, 2025
Remove enable_fake_mode and exporter_legacy entirely. Even though this is bc breaking, `enable_fake_mode` is no longer compatible with the latest version of transformers, and so it is no longer useful.

Pull Request resolved: pytorch#161222
Approved by: https://github.com/titaiwangms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged module: onnx Related to torch.onnx open source release notes: onnx torch.onnx related changes that should show up in the release notes suppress-bc-linter Suppresses the failures of API backward-compatibility linter (Lint/bc_linter) topic: bc breaking topic category topic: docs topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants