Skip to content

Conversation

@manuelknott
Copy link

Summary:
TorchTNT's AutoUnit initializes a GradScaler if precision == torch.float16 and uses default parameters of from torch.amp.grad_scaler.GradScaler or torch.distributed.fsdp.sharded_grad_scaler.ShardedGradScaler respectively.

Some projects require custom arguments for their GradScaler, thus, I propose to expose these parameters and make them configurable.

I propose to implement them as a dataclass analoguous to SWALRParams and SWAParams.

Also added integration tests in test_precision.py.

Differential Revision: D86090032

@meta-cla meta-cla bot added the cla signed label Nov 3, 2025
@meta-codesync
Copy link

meta-codesync bot commented Nov 3, 2025

@manuelknott has exported this pull request. If you are a Meta employee, you can view the originating Diff in D86090032.

manuelknott added a commit to manuelknott/tnt that referenced this pull request Nov 3, 2025
Summary:

TorchTNT's `AutoUnit` initializes a GradScaler if `precision == torch.float16` and uses default parameters of `from torch.amp.grad_scaler.GradScaler` or `torch.distributed.fsdp.sharded_grad_scaler.ShardedGradScaler` respectively.

Some projects require custom arguments for their GradScaler, thus, I propose to expose these parameters and make them configurable.

I propose to implement them as a dataclass analoguous to `SWALRParams` and `SWAParams`.

Also added integration tests in `test_precision.py`.

Differential Revision: D86090032
Summary:

TorchTNT's `AutoUnit` initializes a GradScaler if `precision == torch.float16` and uses default parameters of `from torch.amp.grad_scaler.GradScaler` or `torch.distributed.fsdp.sharded_grad_scaler.ShardedGradScaler` respectively.

Some projects require custom arguments for their GradScaler, thus, I propose to expose these parameters and make them configurable. I propose to implement them as a dataclass analoguous to `SWALRParams` and `SWAParams`.

Also fixed pre-existing indentation error in callbacks.rst that was blocking build_docs CI (introduced in e6b119b1a422)

Differential Revision: D86090032
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant