Tooluck logoTooluck
SKILL.md

huggingface-accelerate

Agent skill fromOpenRaiser/NanoResearch

Simplest distributed training API. 4 lines to add distributed support to any PyTorch script. Unified API for DeepSpeed/FSDP/Megatron/DDP. Automatic device placement, mixed precision (FP16/BF16/FP8). Interactive config, single launch command. HuggingFace ecosystem standard.

How to install huggingface-accelerate

install huggingface-accelerate
# install the NanoResearch pack with the skills CLI
npx skills add OpenRaiser/NanoResearch

# or add only this skill to Claude Code: copy the folder

skills/vendor-ai-research/accelerate/

# into

~/.claude/skills/accelerate/ (all projects)

.claude/skills/accelerate/ (one project)

skills/vendor-ai-research/accelerate/SKILL.md

MITFull file
1# HuggingFace Accelerate - Unified Distributed Training
2
3## Quick start
4
5Accelerate simplifies distributed training to 4 lines of code.
6
7**Installation**:
8```bash
9pip install accelerate
10```
11
12**Convert PyTorch script** (4 lines):
13```python
14import torch
15+ from accelerate import Accelerator
16
17+ accelerator = Accelerator()
18
19 model = torch.nn.Transformer()
20 optimizer = torch.optim.Adam(model.parameters())
21 dataloader = torch.utils.data.DataLoader(dataset)
22
23+ model, optimizer, dataloader = accelerator.prepare(model, optimizer, dataloader)
24
25 for batch in dataloader:
26 optimizer.zero_grad()
27 loss = model(batch)
28- loss.backward()
29+ accelerator.backward(loss)
30 optimizer.step()
31```
32
33**Run** (single command):
34```bash
35accelerate launch train.py
36```
37
38## Common workflows
39
40### Workflow 1: From single GPU to multi-GPU
41
42**Original script**:
43```python
44# train.py
45import torch
46
47model = torch.nn.Linear(10, 2).to('cuda')
48optimizer = torch.optim.Adam(model.parameters())
49dataloader = torch.utils.data.DataLoader(dataset, batch_size=32)
50
51for epoch in range(10):
52 for batch in dataloader:
53 batch = batch.to('cuda')
54 optimizer.zero_grad()
55 loss = model(batch).mean()
56 loss.backward()
57 optimizer.step()
58```
59
60**With Accelerate** (4 lines added):
61```python
62# train.py
63import torch
64from accelerate import Accelerator # +1
65
66accelerator = Accelerator() # +2
67
68model = torch.nn.Linear(10, 2)
69optimizer = torch.optim.Adam(model.parameters())
70…

Excerpt shown under the repository's MIT license.

More skills in NanoResearch

Keep exploring

Similar skill repositories

thedotmack /

claude-mem
116k

Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More

CCCXGHGM+135 skills

pbakaus /

impeccable
108k

The design vocabulary for your coding agent. Steer with polish and bolder, review with critique and audit, catch AI slop before it ships.

2 skills

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates