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

remove cpu restriction for bnb training #3062

Merged
merged 5 commits into from
Sep 30, 2024
Merged

Conversation

jiqing-feng
Copy link
Contributor

Refer to cpu_bnb, we will support bnb 8bit and 4bit training on CPU.

@BenjaminBossan
Copy link
Member

Would it make sense to add a version check on bitsandbytes before exempting CPU usage from raising, for those users who are still using older versions?

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@jiqing-feng
Copy link
Contributor Author

Would it make sense to add a version check on bitsandbytes before exempting CPU usage from raising, for those users who are still using older versions?

Hi @BenjaminBossan , thanks for your review, I have fixed it. As transformers has supported CPU BNB path. I think we can start to review this PR.

Copy link
Member

@SunMarc SunMarc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @jiqing-feng ! Left a suggestion

Comment on lines 1447 to 1451
try:
from transformers.utils import is_bitsandbytes_multi_backend_available
bnb_multi_backends = is_bitsandbytes_multi_backend_available()
except ImportError:
bnb_multi_backends = False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not use the transformers import in accelerate. You can just create the same function in accelerate. This way, we don't need to have the try/catch also.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Done.

Copy link
Member

@SunMarc SunMarc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for iterating !

@jiqing-feng
Copy link
Contributor Author

Hi @SunMarc . Thanks, can you merge it since all tests passed?

@SunMarc
Copy link
Member

SunMarc commented Sep 27, 2024

Oh just a small nit before merging ! Also, I don't think this is specific to 8-bit training,

@SunMarc SunMarc changed the title rm cpu restriction for 8-bit training remove cpu restriction for bnb training Sep 27, 2024
@jiqing-feng
Copy link
Contributor Author

Oh just a small nit before merging ! Also, I don't think this is specific to 8-bit training,

Yes, I have added 4-bit in the log.

@jiqing-feng
Copy link
Contributor Author

Oh just a small nit before merging ! Also, I don't think this is specific to 8-bit training,

Yes, I have added 4-bit in the log.

Please let me know if there is anything I need to change, thx!

@SunMarc
Copy link
Member

SunMarc commented Sep 30, 2024

Nothing ! I was just waiting the CI to finish. Merging !

@SunMarc SunMarc merged commit 5060574 into huggingface:main Sep 30, 2024
25 checks passed
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.

4 participants