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.
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.