Fabric docs feedback 2/n (#16480)

This commit is contained in:
Adrian Wälchli 2023-01-27 20:13:20 +01:00 committed by GitHub
parent 405bb75553
commit bb7b8d601a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 2 deletions

View File

@ -100,10 +100,10 @@ It is up to you to call everything at the right place.
model.train()
for epoch in range(num_epochs):
for i, batch in enumerate(dataloader):
optimizer.zero_grad()
loss = model.training_step(batch, i)
fabric.backward(loss)
optimizer.step()
optimizer.zero_grad()
# Control when hooks are called
if condition:

View File

@ -77,7 +77,6 @@ def run(hparams):
# by the command line. See all options: `lightning run model --help`
fabric = Fabric()
fabric.hparams = hparams
seed_everything(hparams.seed) # instead of torch.manual_seed(...)
transform = T.Compose([T.ToTensor(), T.Normalize((0.1307,), (0.3081,))])