Skip to content

Respect --server-port in DP mode when proxy-url is set#4712

Open
lvhan028 wants to merge 1 commit into
InternLM:mainfrom
lvhan028:fix/dp-server-port-with-proxy
Open

Respect --server-port in DP mode when proxy-url is set#4712
lvhan028 wants to merge 1 commit into
InternLM:mainfrom
lvhan028:fix/dp-server-port-with-proxy

Conversation

@lvhan028

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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=...) accept None to distinguish “unset” vs “explicitly set”.
  • Adjust DP-mode port selection to auto-pick ports only when proxy_url is set and server_port is unset.
  • Change CLI --server-port default to None and 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.

Comment thread lmdeploy/cli/serve.py
', "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')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants