Training loop integration

From VectorSpaceLab/AREX-Skill · View interactive version

Training loop integration is an AI agent skill from the GitHub repository VectorSpaceLab/AREX-Skill. Migrate raw PyTorch training and evaluation loops to Hugging Face Accelerate using Accelerator, prepare(), backward(), gradient accumulation, dataloader behavior, gather/reduce, mixed precision, DDP kwargs, local SGD, communication hooks, and basic distributed logging.

How to use this skill

Skill file

Training Loop Integration

Use this sub-skill when adapting an existing PyTorch model, optimizer, dataloader, scheduler, or evaluation loop to Accelerate while keeping the training code mostly framework-neutral.

Route first

Start here

  1. Read references/workflows.md for migration recipes and loop patterns.
  2. Read references/api-reference.md for constructor options, wrappers, dataloader semantics, gather/reduce, kwargs handlers, logging, and scheduler behavior.
  3. Read references/troubleshooting.md when a distributed loop hangs, metrics are wrong, gradients do not sync, or device placement behaves unexpectedly.
  4. Run scripts/accelerator_loop_smoke.py to verify a minimal CPU training loop in the current environment.

Core migration checklist

Smoke check

python skills/accelerate/sub-skills/training-loop-integration/scripts/accelerator_loop_smoke.py
python skills/accelerate/sub-skills/training-loop-integration/scripts/accelerator_loop_smoke.py --help

The smoke script is intentionally CPU-safe and tiny. It validates importability, Accelerator.prepare, Accelerator.accumulate, Accelerator.backward, scheduler wrapping, and metric gathering without requiring a distributed launcher.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.