Skip to content

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

Merged
lvhan028 merged 2 commits into
InternLM:mainfrom
lvhan028:fix/dp-server-port-with-proxy
Jul 1, 2026
Merged

Respect --server-port in DP mode when proxy-url is set#4712
lvhan028 merged 2 commits 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 Outdated
Comment thread lmdeploy/serve/openai/launch_server.py

@RunningLeon RunningLeon left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment on lines +42 to +46
"""Validate base port and the contiguous DP port range."""
if not 1 <= base_port <= 65535:
raise ValueError(f'server_port must be between 1 and 65535, got {base_port}')
end_port = base_port + dp_per_node - 1
if end_port > 65535:
Document the effective default for --server-port and validate explicit
base ports before allocating contiguous DP worker ports.

Co-authored-by: Cursor <cursoragent@cursor.com>
@lvhan028
lvhan028 force-pushed the fix/dp-server-port-with-proxy branch from 77b30d7 to 337947e Compare July 1, 2026 03:38
@lvhan028
lvhan028 merged commit cd499df into InternLM:main Jul 1, 2026
5 checks passed
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.

3 participants