Repository navigation
Skip batch size search when model parallel has several processes - #1447
Open
chetana1410 wants to merge 1 commit into
Open
chetana1410 wants to merge 1 commit into
chetana1410 wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_parallelis on andacceleratehas more than one process, detection is skipped and the batch size is 1. An explicitbatch_sizeis 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.