Repository navigation
Keep explicit model parallel on one multi-GPU machine - #1439
Open
chetana1410 wants to merge 1 commit into
Open
chetana1410 wants to merge 1 commit into
chetana1410 wants to merge 1 commit into
Conversation
device_count // LOCAL_WORLD_SIZE is the number of GPUs each process can see. Treating 1 as "not distributed" forced model_parallel off for a normal single-node launch, including when it was set to True. Fixes huggingface#895 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.
init_model_paralleltreatedtorch.cuda.device_count() // LOCAL_WORLD_SIZE == 1as "not a distributed setting" and forcedmodel_parallel=False. That ratio is how many GPUs each process can see.accelerate launch --num_processes=2on a 2-GPU machine hits it, so an explicitmodel_parallel=Truenever reacheddevice_map="auto".The override now runs only when model parallel was not requested.
model_parallel=Truestill builds the per-process GPU map. Leaving the flag unset, with one GPU per process, still keeps model parallel off. One process that can see several GPUs still turns it on. The same check in the VLM model is updated with it.Fixes #895
Tests
pytest tests/unit/models/test_transformers_model.py::TestInitModelParallel2 passed. The cases cover an explicit
Trueon 2 processes and 2 GPUs, an unset flag in that same launch, and one process that can see both GPUs.