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

Update unsloth for torch.cuda.amp deprecation #2042

Merged
merged 7 commits into from
Nov 13, 2024

Conversation

bursteratom
Copy link
Collaborator

Description

torch.cuda.amp is deprecated in newer version of Pytorch. This PR updates unsloth.py to reflect that. Fixes issue#2015

Motivation and Context

axolotl/src/axolotl/utils/gradient_checkpointing/unsloth.py:28: FutureWarning: torch.cuda.amp.custom_fwd(args...)is deprecated. Please usetorch.amp.custom_fwd(args..., device_type='cuda')instead. axolotl/src/axolotl/utils/gradient_checkpointing/unsloth.py:39: FutureWarning:torch.cuda.amp.custom_bwd(args...)is deprecated. Please usetorch.amp.custom_bwd(args..., device_type='cuda') instead. 10.10.10.2: @torch.cuda.amp.custom_bwd

How has this been tested?

manually imported unsloth and now there are no more warning of deprecation

Screenshots (if appropriate)

Types of changes

Social Handles (Optional)

@winglian
Copy link
Collaborator

it seems that these changes causes some subset of the test matrix to take significantly longer to complete.

@bursteratom bursteratom requested a review from winglian November 13, 2024 14:10
@bursteratom
Copy link
Collaborator Author

it seems that these changes causes some subset of the test matrix to take significantly longer to complete.
@winglian
I removed partial wrapper and used torch.amp 's internal torch.amp.custom_fwd(device_type="cuda") , let's see if this helps with the speed

@bursteratom bursteratom merged commit 342935c into main Nov 13, 2024
11 checks passed
@winglian winglian deleted the update-unsloth_decorator branch November 13, 2024 20:21
bursteratom added a commit that referenced this pull request Nov 18, 2024
* update deprecated unsloth tirch cuda amp  decorator

* WIP fix torch.cuda.amp deprecation

* lint

* laxing torch version requirement

* remove use of partial

* remove use of partial

* lint

---------

Co-authored-by: sunny <sunnyliu19981005@gmail.com>
djsaunde pushed a commit that referenced this pull request Dec 17, 2024
* update deprecated unsloth tirch cuda amp  decorator

* WIP fix torch.cuda.amp deprecation

* lint

* laxing torch version requirement

* remove use of partial

* remove use of partial

* lint

---------

Co-authored-by: sunny <sunnyliu19981005@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unsloth decorators are deprecated
2 participants