Skip to content

Conversation

GdoongMathew
Copy link
Contributor

@GdoongMathew GdoongMathew commented May 11, 2025

What does this PR do?

Fixes #20810

Before submitting
  • Was this discussed/agreed via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or minor internal changes/refactors)

PR review

Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:

Reviewer checklist
  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

📚 Documentation preview 📚: https://pytorch-lightning--20811.org.readthedocs.build/en/20811/

@github-actions github-actions bot added pl Generic label for PyTorch Lightning package dependencies Pull requests that update a dependency file labels May 11, 2025
@GdoongMathew GdoongMathew changed the title Feat/dynamo export onnx WIP: to_onnx return ONNXProgram May 11, 2025
@GdoongMathew
Copy link
Contributor Author

Hi @Borda , a friendly ping for code review~

BTW, I'm wondering if there's any way to update the typing-extensions requirement during testing so that it could fit with onnxscript? Thanks.

@deependujha
Copy link
Collaborator

seems this to be the cause of issue:

typing-extensions >=4.4.0, <4.14.0

I wonder what could be the reason behind this version pinning.

error:

The conflict is caused by:
    pytorch-lightning 2.5.1rc2 depends on typing-extensions<4.14.0 and ==4.4.0
    pytorch-lightning[extra,strategies,test] 2.5.1rc2 depends on typing-extensions<4.14.0 and ==4.4.0
    lightning-utilities 0.10.0 depends on typing-extensions
    torch 2.1.0 depends on typing-extensions
    onnxscript 0.2.5 depends on typing_extensions>=4.10
    onnxscript 0.2.4 depends on typing_extensions>=4.10
    onnxscript 0.2.3 depends on typing_extensions>=4.10
    onnxscript 0.2.2 depends on typing_extensions>=4.10

@GdoongMathew
Copy link
Contributor Author

seems this to be the cause of issue:

typing-extensions >=4.4.0, <4.14.0

I wonder what could be the reason behind this version pinning.

error:

The conflict is caused by:
    pytorch-lightning 2.5.1rc2 depends on typing-extensions<4.14.0 and ==4.4.0
    pytorch-lightning[extra,strategies,test] 2.5.1rc2 depends on typing-extensions<4.14.0 and ==4.4.0
    lightning-utilities 0.10.0 depends on typing-extensions
    torch 2.1.0 depends on typing-extensions
    onnxscript 0.2.5 depends on typing_extensions>=4.10
    onnxscript 0.2.4 depends on typing_extensions>=4.10
    onnxscript 0.2.3 depends on typing_extensions>=4.10
    onnxscript 0.2.2 depends on typing_extensions>=4.10

Yea, I think that's where the problem is, and there're two solutions for this.

  1. Update the requirement.
  2. Figure out a way to only change the version to fit with onnxscript when testing.

Personally, I'd prefer the second one, but this probably would need some change to the ci config which I not familiar with.

@GdoongMathew GdoongMathew changed the title WIP: to_onnx return ONNXProgram to_onnx return ONNXProgram May 21, 2025
@GdoongMathew
Copy link
Contributor Author

Hi @deependujha all the changes are completed, just left with the requirement part.

And to answer your question, I think it's for testing the compatibility of all the requirements with the lowest supported version.

@github-actions github-actions bot added the fabric lightning.fabric.Fabric label Jun 2, 2025
# Conflicts:
#	.github/workflows/ci-tests-fabric.yml
#	.github/workflows/ci-tests-pytorch.yml
@Borda Borda changed the title to_onnx return ONNXProgram Allow to return ONNXProgram when calling to_onnx(dynamo=True) Aug 8, 2025
@Borda Borda changed the title Allow to return ONNXProgram when calling to_onnx(dynamo=True) Allow to return ONNXProgram when calling to_onnx(dynamo=True) Aug 8, 2025
@github-actions github-actions bot added the docs Documentation related label Aug 8, 2025
@Borda Borda merged commit 577c04d into Lightning-AI:master Aug 12, 2025
136 checks passed
Borda pushed a commit that referenced this pull request Aug 13, 2025
…0811)

* feat: return `ONNXProgram` when exporting with dynamo=True.
* test: add to_onnx(dynamo=True) unittests.
* fix: add ignore filter in pyproject.toml
* fix: change the return type annotation of `to_onnx`.
* test: add parametrized `dynamo` to test `test_if_inference_output_is_valid`.
* test: add difference check in `test_model_return_type`.
* fix: fix unittest.
* test: add test `test_model_onnx_export_missing_onnxscript`.
* feat: enable ONNXProgram export on torch 2.5.0
* extensions

---------

Co-authored-by: Jirka B <[email protected]>
Co-authored-by: Jirka Borovec <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

(cherry picked from commit 577c04d)
Borda pushed a commit that referenced this pull request Aug 13, 2025
…0811)

* feat: return `ONNXProgram` when exporting with dynamo=True.
* test: add to_onnx(dynamo=True) unittests.
* fix: add ignore filter in pyproject.toml
* fix: change the return type annotation of `to_onnx`.
* test: add parametrized `dynamo` to test `test_if_inference_output_is_valid`.
* test: add difference check in `test_model_return_type`.
* fix: fix unittest.
* test: add test `test_model_onnx_export_missing_onnxscript`.
* feat: enable ONNXProgram export on torch 2.5.0
* extensions

---------

Co-authored-by: Jirka B <[email protected]>
Co-authored-by: Jirka Borovec <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

(cherry picked from commit 577c04d)
@GdoongMathew GdoongMathew deleted the feat/dynamo_export_onnx branch August 16, 2025 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continuous Integration dependencies Pull requests that update a dependency file docs Documentation related fabric lightning.fabric.Fabric package pl Generic label for PyTorch Lightning package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow to return ONNXProgram when calling to_onnx(dynamo=True)

3 participants