Skip to content

Commit 2518865

Browse files
committed
fix merge
Signed-off-by: Bill Nell <bnell@redhat.com>
1 parent 4a0fa2c commit 2518865

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

tests/kernels/moe/deepep_utils.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
import dataclasses
66
import importlib
77
import os
8+
import socket
89
import traceback
10+
from contextlib import closing
911
from typing import Callable, Optional
1012

1113
import torch
@@ -14,8 +16,6 @@
1416
spawn) # pyright: ignore[reportPrivateImportUsage]
1517
from typing_extensions import Concatenate, ParamSpec
1618

17-
from vllm.model_executor.layers.fused_moe.utils import find_free_port
18-
1919
has_deep_ep = importlib.util.find_spec("deep_ep") is not None
2020
if has_deep_ep:
2121
from vllm.model_executor.layers.fused_moe.deepep_ht_prepare_finalize import ( # noqa: E501
@@ -82,6 +82,13 @@ def _worker_parallel_launch(
8282
torch.distributed.destroy_process_group()
8383

8484

85+
def find_free_port():
86+
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s:
87+
s.bind(('', 0))
88+
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
89+
return s.getsockname()[1]
90+
91+
8592
def parallel_launch(
8693
world_size: int,
8794
worker: Callable[Concatenate[ProcessGroupInfo, P], None],

vllm/model_executor/layers/fused_moe/utils.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# SPDX-License-Identifier: Apache-2.0
22
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3-
import socket
4-
from contextlib import closing
53
from math import prod
64
from typing import Optional
75

@@ -101,13 +99,6 @@ def _fp8_perm(m: torch.Tensor, idx: torch.Tensor) -> torch.Tensor:
10199
return m[idx, ...]
102100

103101

104-
def find_free_port():
105-
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s:
106-
s.bind(('', 0))
107-
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
108-
return s.getsockname()[1]
109-
110-
111102
# TODO(bnell): better name
112103
def maybe_fix_scales(scales: Optional[torch.Tensor],
113104
num_experts: int) -> Optional[torch.Tensor]:

0 commit comments

Comments
 (0)