-
Notifications
You must be signed in to change notification settings - Fork 483
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
Add Ascend NPU as a backend for single device recipes #2234
base: main
Are you sure you want to change the base?
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/torchtune/2234
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Hi @Nicorgi! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Hi @RdoubleA, @joecummings, @ebsmothers: Could you please help to review this PR and give me some advice? Thank you for your time! 😄 |
It is very helpful for me, nice work! |
torchtune/training/precision.py
Outdated
@@ -33,7 +33,7 @@ def _set_float32_precision(precision: str = "high") -> None: | |||
Args: | |||
precision (str): The setting to determine which datatypes to use for matrix multiplication and convolution operations. | |||
""" | |||
if not torch.cuda.is_available(): # Not relevant for non-CUDA devices | |||
if not torch.cuda.is_available() or not torch.npu.is_available(): # Not relevant for non-CUDA devices |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not use torch.npu for judgment. If torch_npu is not installed, error message: model 'torch' has no attribute 'npu'. Maybe you can use is_npu_available
for judgment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! I have changed my code. Thanks! 😄
change torch.npu.is_available() to is_npu_available in precision.py
Thanks @Nicorgi for the PR! Please give us 1-2 days as we catch up from the holiday backlog, we will review this soon! |
Context
What is the purpose of this PR? Is it to
Changelog
What are the changes made in this PR?
Environment
We have conducted basic usage test in the following environment.
Recipe: eleuther_eval
Recipe: full_finetune_single_device
Recipe: generate
Recipe: dev/generate_v2
Recipe: knowledge_distillation_single_device
Recipe: lora_dpo_single_device
Recipe: lora_finetune_single_device
Recipe: quantize
Feel free to provide valuable improvement suggestions!☺️