-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Recompute upgrade #47985
Recompute upgrade #47985
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
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.
Modify docs and put the link to comments.
recompute without reentrant, that means use hook to implement the recompute function rather than re-entrant autograd. | ||
""" | ||
|
||
if preserve_rng_state: |
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.
User can't use CPU or other XXPU?
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.
only support GPU to preserve rng state now.
if tracer._amp_dtype == 'float16': | ||
amp_dtype = 'float16' | ||
elif tracer._amp_dtype in ('bfloat16', 'float32'): | ||
amp_dtype = 'bfloat16' |
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.
float32->bfloat16?
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.
fwd_cuda_rng_state_tracker = ( | ||
get_rng_state_tracker().get_states_tracker() | ||
) | ||
tracer = framework._dygraph_tracer() |
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.
Are these functions all internal functions with _?
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.
yes, and only use this way to get tracer from python, the name of _dygraph_tracer is defined by framewark.
@@ -13,6 +13,7 @@ | |||
# limitations under the License. | |||
|
|||
import paddle | |||
import weakref | |||
from paddle.fluid import core |
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.
Don't use fluid now.
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.
DONE
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.
LGTM
from paddle.distributed.fleet.meta_parallel.parallel_layers.random import ( | ||
get_rng_state_tracker, | ||
) | ||
from paddle.framework import core, in_dygraph_mode | ||
|
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.
OK
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.
LGTM
PR types
New features
PR changes
Others
Describe
【Recompute upgrade】:
in the past, there is just one PyLayer implementation of recompute, here , this PR adds other hook implementation of recompute.
【test】
【features】
A100 40G fleetx
【loss align】