Skip to content
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

About pytorch 2.0 and pytorch-lightning #15894

Closed
PoPdark opened this issue Dec 3, 2022 · 7 comments
Closed

About pytorch 2.0 and pytorch-lightning #15894

PoPdark opened this issue Dec 3, 2022 · 7 comments
Labels
question Further information is requested release torch.compile

Comments

@PoPdark
Copy link

PoPdark commented Dec 3, 2022

Pytorch 2.0 will be released soon. I am wondering if you have the schedule to follow it? Thank you.

cc @Borda

@PoPdark PoPdark added the needs triage Waiting to be triaged by maintainers label Dec 3, 2022
@awaelchli
Copy link
Contributor

Since 2.0 is completely backward compatible with 1.13, it will just work out of the box with Lightning. In fact, you can try it today from the nightlies. Installation instructions are here.

In time, the team will add 2.0 to the CI testing suite to run all tests against it.

Then there is the big new feature in 2.0 that allows you to compile the model with torch.compile. The expectation is that he users can do that directly on the LightningModule. Some tests will have to be added here.

We can't give you a concrete ETA. So far, Lightning has always released a version shortly after the stable release of each PyTorch version with updated compatibility. We intend to follow that same pattern for 2.0.

@awaelchli awaelchli added question Further information is requested release and removed needs triage Waiting to be triaged by maintainers labels Dec 5, 2022
@Borda
Copy link
Member

Borda commented Dec 5, 2022

Pytorch 2.0 will be released soon. I am wondering if you have the schedule to follow it?

yes we will b testing it as son as they provide some public wheels, but until their official release (March 2023) we have about 4 months :)

@lantiga
Copy link
Collaborator

lantiga commented Dec 7, 2022

Just FYI @PoPdark, support for passing models produced by torch.compile to the Trainer that just landed in Lightning master. It will be included in the upcoming patch release this week.

In order to try it out you'll need to have a recent PyTorch nightly installed alongside lightning.

@lantiga
Copy link
Collaborator

lantiga commented Dec 7, 2022

This went out with 1.8.4 https://github.com/Lightning-AI/lightning/releases/tag/1.8.4, closing the issue

@PoPdark let me know if you have issues trying things out, remember you have to manually get the PyTorch nightlies to get torch.compile

@lantiga lantiga closed this as completed Dec 7, 2022
@yangky11
Copy link

yangky11 commented Dec 8, 2022

Thanks! @lantiga

Does it also work out of the box iftorch.compile is not called manually but the model is created by Lightning CLI?

@lantiga
Copy link
Collaborator

lantiga commented Dec 8, 2022

For now we don't have a Trainer flag (say, compile=True), but we may add it in the future.

So for the time being you need to do things just like the PyTorch docs say:

model = MyModel()
model = torch.compile(model)

trainer = Trainer(...)
trainer.fit(model)

Once we add a trainer flag you'll be able to enable compilation from the Lightning CLI.

@yangky11
Copy link

yangky11 commented Dec 9, 2022

Yep, I think a compile flag in the future would be really helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested release torch.compile
Projects
None yet
Development

No branches or pull requests

5 participants