Skip to content

read distributed envs #3600

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

Merged
merged 1 commit into from
Jun 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lmdeploy/pytorch/engine/executor/ray_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,19 @@ def init_ray_cluster(world_size: int, ray_address: str = None, dp: int = 1):

def _get_master_addr():
"""get master addr."""
addr = _envs.dist_master_addr
if addr is not None:
return addr
gcs_addr = ray.get_runtime_context().gcs_address
master_addr = gcs_addr.split(':')[0]
return master_addr


def _get_master_port():
"""get master port."""
port = _envs.dist_master_port
if port is not None:
return port
return find_available_port()


Expand Down
4 changes: 4 additions & 0 deletions lmdeploy/pytorch/envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,7 @@ def env_to_int(
# ray timeline
ray_timeline_enable = env_to_bool('LMDEPLOY_RAY_TIMELINE_ENABLE', False)
ray_timeline_output_path = os.getenv('LMDEPLOY_RAY_TIMELINE_OUT_PATH', 'ray_timeline.json')

# dist
dist_master_addr = os.getenv('LMDEPLOY_DIST_MASTER_ADDR', None)
dist_master_port = os.getenv('LMDEPLOY_DIST_MASTER_PORT', None)
6 changes: 1 addition & 5 deletions lmdeploy/pytorch/models/deepseek_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,11 +577,7 @@ def forward(
class MoEGate(nn.Module):
"""Deepseek Gate."""

def __init__(self,
config: Any,
dtype: torch.dtype = None,
device: torch.device = None,
info: Any = None):
def __init__(self, config: Any, dtype: torch.dtype = None, device: torch.device = None, info: Any = None):
super().__init__()
self.config = config
self.top_k = config.num_experts_per_tok
Expand Down
Loading