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

Separate backward and step in deepspeed wrapper #3303

Closed
ummagumm-a opened this issue Dec 18, 2024 · 2 comments
Closed

Separate backward and step in deepspeed wrapper #3303

ummagumm-a opened this issue Dec 18, 2024 · 2 comments

Comments

@ummagumm-a
Copy link

Hello. I have a request to separate the two operations. Right now it prohibits from using a feature from deepspeed to access gradients in a model. See this issue: microsoft/DeepSpeed#5199 (comment).

My specific use case is fine-tuning a subset of weights in embedding and lm_head modules when initializing new tokens. I wanted to implement this logic in on_pre_optimizer_step callback in transformers library, which is right in between of backward and step.

There I want to use safe_get_full_grad from deepspeed to get the gradients. It has a condition that it should be called after backward and before step. But since accelerator.backward (usage link in transformers.trainer training loop) has these two operations merged (here) when used with deepspeed, using safe_get_full_grad is impossible.

Here is a small example to reproduce this issue. Please see the link attached earlier in deepspeed issues to see a discussion about it.

@ummagumm-a
Copy link
Author

@tjruwase fyi

Copy link

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

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

No branches or pull requests

1 participant