Respect --server-port in DP mode when proxy-url is set#4712
Open
lvhan028 wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the OpenAI serving CLI and DP-mode launcher so that in distributed data-parallel (dp>1) mode, --server-port is respected even when --proxy-url is provided, while still allowing automatic port selection when the user does not specify a port.
Changes:
- Make
launch_server(..., server_port=...)acceptNoneto distinguish “unset” vs “explicitly set”. - Adjust DP-mode port selection to auto-pick ports only when
proxy_urlis set andserver_portis unset. - Change CLI
--server-portdefault toNoneand preserve the effective default port (23333) where appropriate.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lmdeploy/serve/openai/launch_server.py | Updates DP-mode port selection logic to honor an explicitly provided server_port even when proxy_url is set. |
| lmdeploy/cli/serve.py | Changes CLI --server-port default to None to enable “unset” semantics while preserving default behavior in single-server mode. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ', "baichuan-inc/baichuan2-7b-chat" and so on') | ||
| parser.add_argument('--server-name', type=str, default='0.0.0.0', help='Host ip for serving') | ||
| parser.add_argument('--server-port', type=int, default=23333, help='Server port') | ||
| parser.add_argument('--server-port', type=int, default=None, help='Server port') |
Comment on lines
+114
to
118
| base_port = server_port if server_port is not None else 23333 | ||
| server_port_li = [base_port + i for i in range(dp_per_node)] | ||
| for port in server_port_li: | ||
| if not is_port_available(port): | ||
| raise ValueError(f'Port {port} is not available') |
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.
No description provided.