Skip to content

Commit

Permalink
Fix latest pytorch '_get_socket_with_port' import error (#5654)
Browse files Browse the repository at this point in the history
The latest PyTorch deleted the '_get_socket_with_port' API, replacing it
with 'get_free_port'.

Fixes: #5603
  • Loading branch information
Yejing-Lai authored Jun 18, 2024
1 parent 8ea995e commit a4cd550
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions deepspeed/elasticity/elastic_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from torch.distributed.elastic.agent.server.local_elastic_agent import LocalElasticAgent
from typing import Any, Dict, Optional, Tuple
from datetime import datetime
from torch.distributed.elastic.agent.server.api import _get_socket_with_port
from torch.distributed.elastic.utils.distributed import get_free_port
from torch.distributed.elastic.metrics import put_metric
from torch.distributed.elastic.agent.server.api import (
RunResult,
Expand Down Expand Up @@ -48,7 +48,7 @@ def _set_master_addr_port(store: Store,
master_port: Optional[int],
local_addr: Optional[str] = None):
if master_port is None:
sock = _get_socket_with_port()
sock = get_free_port()
with closing(sock):
master_port = sock.getsockname()[1]

Expand Down

0 comments on commit a4cd550

Please sign in to comment.