Skip to content

Commit

Permalink
Fix example in accumulate method (#1211)
Browse files Browse the repository at this point in the history
  • Loading branch information
VikParuchuri committed Mar 19, 2023
1 parent 2930cac commit 82c2665
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/accelerate/accelerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,8 +841,8 @@ def accumulate(self, model):
>>> accelerator = Accelerator(gradient_accumulation_steps=1)
>>> dataloader, model, optimizer, scheduler = accelerator.prepare(dataloader, model, optimizer, scheduler)
>>> with accelerator.accumulate(model):
... for input, output in dataloader:
>>> for input, output in dataloader:
... with accelerator.accumulate(model):
... outputs = model(input)
... loss = loss_func(outputs)
... loss.backward()
Expand Down

0 comments on commit 82c2665

Please sign in to comment.