Skip to content

Conversation

@azrael417
Copy link
Collaborator

This MR adds gradient clipping to all training procedures.

@azrael417 azrael417 requested a review from romerojosh November 11, 2025 06:29
@azrael417 azrael417 self-assigned this Nov 11, 2025
@romerojosh romerojosh changed the title Tkurth/add grad clipping Add support for gradient clipping. Nov 12, 2025
@romerojosh
Copy link
Collaborator

/build_and_test

@github-actions
Copy link

🚀 Build workflow triggered! View run

@github-actions
Copy link

✅ Build workflow passed! View run

Copy link
Collaborator

@romerojosh romerojosh 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 adding this feature!

Left a small comment about SAC grad clipping. There are also some merge conflicts that need to be resolved after merging in #93.

if (alpha_lr_scheduler) {
alpha_lr_scheduler->step();
// I think we do not need grad clipping here
// the model is just a scalar and clipping the grad for that might hurt
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noted this in the previous version of this MR. What does stable-baselines do in this case (if they support grad clipping)? We should match that as a reference if we can.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, so stable baselines does not support gradient accumulation nor clipping except for PPO.

However, I think gradient accumulation makes sense in general for torchfort because of the online nature. That way we can have larger batch sizes without using a replay buffer.

Concerning grad clipping, I mean it's optional. I do not see why it should hurt if you have the support for it. We can add it here as well.

Signed-off-by: Thorsten Kurth <tkurth@nvidia.com>
Signed-off-by: Thorsten Kurth <tkurth@nvidia.com>
@azrael417 azrael417 force-pushed the tkurth/add_grad_clipping branch from f510a76 to cc498c8 Compare November 13, 2025 07:07
@azrael417
Copy link
Collaborator Author

/build_and_test

@github-actions
Copy link

🚀 Build workflow triggered! View run

@github-actions
Copy link

✅ Build workflow passed! View run

@romerojosh romerojosh merged commit d4aadb9 into NVIDIA:master Nov 18, 2025
4 checks passed
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.

2 participants