muellerzr's picture
muellerzr HF staff
Adding tabs for different set of Accelerate's features and content for large scale training features (#2)
b91e31d
raw
history blame
437 Bytes
<pre>
from accelerate import Accelerator
accelerator = Accelerator()
train_dataloader, model, optimizer scheduler = accelerator.prepare(
dataloader, model, optimizer, scheduler
)
model.train()
for batch in train_dataloader:
optimizer.zero_grad()
inputs, targets = batch
outputs = model(inputs)
loss = loss_function(outputs, targets)
accelerator.backward(loss)
optimizer.step()
scheduler.step()
</pre>