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

Pytorch 2.0 compiler #3899

Merged
merged 3 commits into from Mar 28, 2023
Merged

Pytorch 2.0 compiler #3899

merged 3 commits into from Mar 28, 2023

Conversation

ggosline
Copy link

Pytorch 2.0 compiled models fail when used with fastai. Two fixes are necessary to run a basic Convnext model.
fastcore L.eq requires a chack for a function being passed in, and the Flatten layer has to have the Tensorbase type cast removed.
After this a simple model=torch.compile(model) increases training throughput (it/s) by 50%+.
The compiled models can't have layers frozen/unfrozen, so the train head / train all strategy is not useable, but didn't make much difference in my limited tests.

@ggosline ggosline requested a review from jph00 as a code owner March 27, 2023 21:46
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

fastai/layers.py Outdated Show resolved Hide resolved
@jph00 jph00 merged commit 125d2ef into fastai:master Mar 28, 2023
28 checks passed
@jph00
Copy link
Member

jph00 commented Mar 28, 2023

Many thanks for this - and congrats on figuring it out!

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.

None yet

2 participants