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 failure on DeBERTa(base/v2/sew_d) fp16 training with ONNX Runtime #18585

Merged
merged 3 commits into from
Aug 17, 2022

Conversation

JingyaHuang
Copy link
Contributor

@JingyaHuang JingyaHuang commented Aug 11, 2022

Context

It was reported in optimum huggingface/optimum#305 that the mixed-precision training on DeBERTa with optimum.onnxruntime.ORTTrainer is broken.

After investigation, the break comes from mismatched inputs dtype for some Matmul nodes. In #18272, some sqrt results are cast to fp32, and they need to be re-casted to fp16 before Matmul ops, and this PR is supposed to correct the dtype.

Besides, this PR also fix the tracing of DeBERTa which haven't been fixed in #18272

Fixes #huggingface/optimum#305
Fixes #18199

Who can review?

@michaelbenayoun @LysandreJik @sgugger

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Aug 11, 2022

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

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 for fixing!

@JingyaHuang JingyaHuang marked this pull request as ready for review August 11, 2022 16:16
@LysandreJik LysandreJik requested a review from lewtun August 16, 2022 07:29
Copy link
Member

@lewtun lewtun 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 for fixing this @JingyaHuang - the changes also LGTM 🚀 !

@lewtun lewtun merged commit 86d0b26 into huggingface:main Aug 17, 2022
@JingyaHuang JingyaHuang deleted the fix-deberta-fp16 branch August 22, 2022 08:22
oneraghavan pushed a commit to oneraghavan/transformers that referenced this pull request Sep 26, 2022
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.

Exported DeBERTa ONNX model is incorrect
4 participants