-
Notifications
You must be signed in to change notification settings - Fork 56
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 RARE (CRNN-seq2seq) README and support O2 training #274
Conversation
mindocr/models/_nn/rnn_cells.py
Outdated
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.
- 可否通过修改amp.py里的white/black list来将RNN层设成半精度?
- 建议rename _nn -> utils,可把自定义的layers 和 helpers放里面
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.
RNNCell应当属于white list, 会把input 自动cast为fp16。但目前mindspore RNNCell会在fp16输入时前向报错,原因是RNNCell内参如weight_ih没有自动转换成fp16,从而当用到MatMul算子时因为两边输入type不对齐而报错。此改动强制将内参和输入转换成统一type,避免这一问题。
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.
了解,那应该在自定义的RNNCell init中加入 cast_fp16的选项?否则如果设成O0的话,该层仍然会半精度计算。
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.
现在RNNCell内参会根据输入的type改变的,如果输入为fp32,那内参会改为fp32,计算会是全精度
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.
_nn 已才成 utils
mindocr/models/_nn/rnn_cells.py
Outdated
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.
- 可否通过修改amp.py里的white/black list来将RNN层设成半精度?
- 建议rename _nn -> utils,可把自定义的layers 和 helpers放里面
Uploaded checkpoint path, can review @SamitHuang @HaoyangLee |
Conflicts are to be solved before merge |
Thank you for your contribution to the MindOCR repo.
Before submitting this PR, please make sure:
Motivation
(Write your motivation for proposed changes here.)
Test Plan
(How should this PR be tested? Do you require special setup to run the test or repro the fixed bug?)
Related Issues and PRs
(Is this PR part of a group of changes? Link the other relevant PRs and Issues here. Use https://help.github.com/en/articles/closing-issues-using-keywords for help on GitHub syntax)