What features are there in batch preparation and sampling in DDP?

In DDP, each rank needs its own data shard; DDP does not automatically split the input batch. Use a distributed sampler and distinguish per-rank batch size from the effective global batch.

Короткий ответ

Что ответить на собеседовании

In DDP, each rank needs its own data shard; DDP does not automatically split the input batch. Use a distributed sampler and distinguish per-rank batch size from the effective global batch.

Подробный разбор

Ответ с пояснениями

In DDP, each rank needs its own data shard; DDP does not automatically split the input batch. Use a distributed sampler and distinguish per-rank batch size from the effective global batch.

Call sampler.set_epoch(epoch) before each epoch's iterator so shuffling changes consistently. Handle padding or dropping tail samples explicitly: padding can duplicate examples, including during evaluation. For equal per-rank batches, effective batch size is local batch × world size × accumulation steps. Seed data-loader workers appropriately and aggregate metrics across ranks instead of averaging unequal groups blindly.

Источник: docs.pytorch.org.

ИИ-помощник для собеседований

Хочешь уверенно проходить собеседования?

Попробуй ИИ-помощник для собеседований: слышит вас и собеседника, анализирует экран, подсказывает ответы в реальном времени, работает без VPN и не попадает в захват экрана.

Подробнее