Skip to content

Skip batch size search when model parallel has several processes - #1447

Open
chetana1410 wants to merge 1 commit into
huggingface:mainfrom
chetana1410:fix-model-parallel-batch-size
Open

chetana1410 wants to merge 1 commit into
huggingface:mainfrom
chetana1410:fix-model-parallel-batch-size

Conversation

@chetana1410

Copy link
Copy Markdown

Description

Automatic batch size detection runs a forward pass and halves the batch after an out-of-memory error. With model parallel and more than one process, ranks do not take that path together, and the run stops on Detecting largest batch size.

When model_parallel is on and accelerate has more than one process, detection is skipped and the batch size is 1. An explicit batch_size is unchanged. A single process still searches, including model parallel on one process.

Fixes #896

Tests

pytest tests/unit/models/test_transformers_model.py::TestGetBatchSize — 4 passed.

The search runs a forward and halves the batch after an out-of-memory error. Ranks do not take the same path, so the search deadlocks.

Fixes huggingface#896

Signed-off-by: Chetana Tanmayee Tadikamalla <chetana.tadikamalla@meltwater.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Automatic batch size detection causes distributed deadlock in model parallel mode

1 participant