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

ORTModule memory efficient gradient management #18907

Closed
wants to merge 13 commits into from

Conversation

pengwa
Copy link
Contributor

@pengwa pengwa commented Dec 21, 2023

ORTModule memory efficient gradient management

Previously I have tried to solve the coarsed-grained gradient accumulation/update problem in ORTModule with #8979, while that resolution somehow is not fully validated with DDP or there is user hooks on the gradient accumulation on torch parameter.

This PR is addressing the problem in the similar approach as PR 8979, e.g. trigger gradient accumulation once ORT computed the grad, but instead of use a AccumulateGrad op, this time with a ONNX operator PythonOp, internally it will call param.backward(grad), which will help handle all related hooks correctly.

Replacedby #18924

Motivation and Context

@pengwa pengwa added the training issues related to ONNX Runtime training; typically submitted using template label Dec 21, 2023
@pengwa pengwa marked this pull request as draft December 21, 2023 17:49
@pengwa pengwa changed the title ORTModule memory efficient gradient mangement ORTModule memory efficient gradient management Dec 21, 2023
@pengwa pengwa force-pushed the pengwa/mem_efficient_grad_mgr branch from c585bc8 to be122e3 Compare December 25, 2023 06:44
@pengwa pengwa changed the base branch from pengwa/update_recompute to main December 25, 2023 06:44
@pengwa pengwa marked this pull request as ready for review December 25, 2023 06:45
@pengwa pengwa closed this Dec 25, 2023
@pengwa pengwa deleted the pengwa/mem_efficient_grad_mgr branch May 10, 2024 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
training issues related to ONNX Runtime training; typically submitted using template
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant