Accelerate documentation

从这里开始!

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

从这里开始!

请使用下方的交互工具,帮助你开始学习 Accelerate 的特定功能以及如何利用它!该工具将为你提供代码差异、对正在发生的事情的解释,以及一些有用的链接,以便你在文档中进一步探索!

大多数代码示例都从以下 Python 代码开始,然后以某种方式集成 Accelerate:

for batch in dataloader:
    optimizer.zero_grad()
    inputs, targets = batch
    inputs = inputs.to(device)
    targets = targets.to(device)
    outputs = model(inputs)
    loss = loss_function(outputs, targets)
    loss.backward()
    optimizer.step()
    scheduler.step()
Update on GitHub