Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core][Distributed] make init_distributed_environment compatible with init_process_group #4014

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

youkaichao
Copy link
Member

Currently we require world_size and rank, but we can make them optional, and have a default distributed_init_method to env:// .

This way, the following code just works with torchrun, which makes test and development very convenient.

from vllm.distributed.parallel_state import init_distributed_environment
init_distributed_environment()

This should not affect other part of the code, as it only provides some default value for the function.

I do think we can change the arg name distributed_init_method to init_method, which is more aligned with pytorch. But that will require more code change. Not sure if it is worth the change.

cc @zhuohan123 for opinions.

Copy link
Member

@zhuohan123 zhuohan123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! We should probably close #3833 after this.

@youkaichao youkaichao merged commit 559eb85 into vllm-project:main Apr 11, 2024
35 checks passed
@youkaichao youkaichao deleted the compatible_with_torch branch April 11, 2024 21:01
distributed_init_method: Optional[str] = None,
world_size: int = -1,
rank: int = -1,
distributed_init_method: str = "env://",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@youkaichao shouldn't the type here remain as Optional[str] since presumably it could still be valid to pass None?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for compatibility, yes, Optional[str] is better. but does anyone really explictly pass None? I don't want to do an extra check if distributed_init_method is None 🤣

andy-neuma pushed a commit to neuralmagic/nm-vllm that referenced this pull request Apr 12, 2024
…m-project#4014)

[Core][Distributed] make init_distributed_environment compatible with init_process_group (vllm-project#4014)
z103cb pushed a commit to z103cb/opendatahub_vllm that referenced this pull request Apr 22, 2024
…m-project#4014)

[Core][Distributed] make init_distributed_environment compatible with init_process_group (vllm-project#4014)
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.

3 participants