-
Notifications
You must be signed in to change notification settings - Fork 48
Upgrade to PyTorch 2.3. #546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dan-garvey
approved these changes
Mar 26, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small nits but wow this is amazing. 👏 👏
rsuderman
approved these changes
Mar 27, 2024
monorimet
reviewed
Mar 27, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As discussed on Discord, this is a significant upgrade because it is the first stable release that has a fully functional
torch.export.export
with the preferred dynamic shapes support. It is also just prior to nightlies that completely remove support for the old constraints based API, so is therefore a good point to stop for a moment and support both styles.This patch makes a number of API changes:
constraints=
keyword for jittable is used, otherwise not passing it to PyTorch. This should make jittable not immediately incompatible with later nightlies unless if that feature is used.CompiledModule
to directly have an attribute of atorch.export.ExportedProgram
, allowing the user to pre-export with Torch and then construct a compiled module from that (vs thejittable
approach where theCompiledModule
API was directly invoking Torch internals to do so). This defaults to exporting aspublic
if given a name not starting with an underscore and private otherwise. Private ExportedPrograms can be called from procedures just as withjittable
.shark_turbine.aot.export()
now accepts either anCompiledModule
,nn.Module
, a or atorch.export.ExportedProgram
. For the last two, a newexternal_params=
bool is available to control whether parameters are inlined or externalized. For annn.Module
arguments corresponding totorch.export.export
are added. Internally, for annn.Module
, it simply callstorch.export.export
.jittable
is no longer used internally.Some attempt has been made to be backwards compatible with Torch 2.1.0. New features will not work, but we should be able to support a short buffer window where older pinned systems are not completely broken. The repository prior to this patch will be branched to
torch_2.1
.Breaking changes:
functional_trace_tensors
which works a bit better with the infra.