Skip to content

[Fix] Correct LOCAL_RANK default value to 0 in run.py#1593

Open
pranaysb wants to merge 1 commit into
open-compass:mainfrom
pranaysb:fix/local-rank-default
Open

[Fix] Correct LOCAL_RANK default value to 0 in run.py#1593
pranaysb wants to merge 1 commit into
open-compass:mainfrom
pranaysb:fix/local-rank-default

Conversation

@pranaysb

@pranaysb pranaysb commented Jul 1, 2026

Copy link
Copy Markdown

Fixes #1589

Description

In run.py, LOCAL_RANK was being read from the environment with an incorrect default value of 1. If LOCAL_WORLD_SIZE is set but LOCAL_RANK is not, this default causes the GPU assignment block to skip the first GPU partition (DEVICE_START_IDX = GPU_PER_PROC * 1).

This PR corrects the default value of LOCAL_RANK to 0.

Root Cause & Justification

  • Conventions: PyTorch torchrun conventions state that LOCAL_RANK always starts at 0.
  • Consistency: The RANK variable in run.py:33 correctly defaults to 0, and LOCAL_RANK shares the exact same semantic concept.
  • Codebase Alignment: Every other LOCAL_RANK read across this codebase correctly defaults to 0 (see vlmeval/vlm/emu.py:76, vlmeval/vlm/parrot.py:61, and vlmeval/vlm/parrot.py:188).

Verification

  • pre-commit run --all-files passed successfully.
  • flake8 checks on run.py passed cleanly (ignoring W503 as per setup.cfg / .pre-commit-config.yaml).
  • Verified git diff shows exactly one line changed.

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] run.py: LOCAL_RANK defaults to 1 instead of 0

1 participant