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

Offload port selection to OS #467

Merged
merged 2 commits into from
Jul 16, 2023

Conversation

zhangir-azerbayev
Copy link
Contributor

In machine learning, it is a common workflow to run two programs that make the sequence of random choices with the same random seed on the same machine at the same time. For example, this happens when you run the same eval suite on two different language models.

Currently, the doing the above won't work because vllm uses Python's random module to select TCP ports, resulting in a port collision when running two instances at the same time with the same seed.

The solution is to offload port selection to the OS. In particular, if one instructs the Python socket API to bind to port 0, Python will instruct the OS to choose a suitable free port number. The code I added using this mechanism to choose a port.

Copy link
Collaborator

@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! Thanks for your contribution!

@zhuohan123 zhuohan123 merged commit 6d7d95a into vllm-project:main Jul 16, 2023
2 checks passed
hongxiayang pushed a commit to hongxiayang/vllm that referenced this pull request Feb 13, 2024
sjchoi1 pushed a commit to casys-kaist-internal/vllm that referenced this pull request May 7, 2024
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.

None yet

2 participants