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

fix issue that amp bf16 does not work for cpu in env with cuda. #906

Merged
merged 1 commit into from
Dec 8, 2022
Merged

fix issue that amp bf16 does not work for cpu in env with cuda. #906

merged 1 commit into from
Dec 8, 2022

Conversation

sywangyi
Copy link
Contributor

@sywangyi sywangyi commented Dec 7, 2022

and num_cpu_threads_per_process is not reset for better performance in cpu only case

Signed-off-by: Wang, Yi A [email protected]

@sywangyi
Copy link
Contributor Author

sywangyi commented Dec 7, 2022

@sgugger @yao-matrix @jiqing-feng please notice the issue

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Dec 7, 2022

The documentation is not available anymore as the PR was closed or merged.

Copy link
Collaborator

@muellerzr muellerzr 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 enhancement! Rather than having an ever-growing conditional, I think we should just pass self.device.type to autocast instead directly to avoid this, since it is already setup based on what was done in accelerate config

src/accelerate/accelerator.py Outdated Show resolved Hide resolved
and num_cpu_threads_per_process is not reset for better performance in cpu only case

Signed-off-by: Wang, Yi A <[email protected]>
Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Thanks a lot!

@sgugger sgugger merged commit 74a8ed9 into huggingface:main Dec 8, 2022
@sywangyi sywangyi deleted the amp_fix_cpu branch December 15, 2022 07:08
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