Fix setup_model typos in Fabric (#17498)

This commit is contained in:
Carlos Mocholí 2023-04-28 02:31:17 +02:00 committed by GitHub
parent 6b6594b831
commit abc634d17c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -835,7 +835,7 @@ class Fabric:
if isinstance(self._strategy, FSDPStrategy) and not _TORCH_GREATER_EQUAL_2_0:
raise RuntimeError(
f"The `{type(self).__name__}` requires the model and optimizer(s) to be set up separately."
" Create and set up the model first through `model = self.setup_model(model)`. Then create the"
" Create and set up the model first through `model = self.setup_module(model)`. Then create the"
" optimizer and set it up: `optimizer = self.setup_optimizer(optimizer)`."
)

View File

@ -78,7 +78,7 @@ def test_amp_fused_optimizer_parity():
seed_everything(1234)
fabric = Fabric(accelerator="cuda", precision=16, devices=1)
model = nn.Linear(10, 10).to(fabric.device) # TODO: replace with individual setup_model call
model = nn.Linear(10, 10).to(fabric.device) # TODO: replace with individual setup_module call
optimizer = torch.optim.Adam(model.parameters(), lr=1.0, fused=fused)
model, optimizer = fabric.setup(model, optimizer)