Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
546a97ef
Unverified
Commit
546a97ef
authored
May 21, 2024
by
Wenwei Zhang
Committed by
GitHub
May 20, 2024
Browse files
[Misc]: allow user to specify port in distributed setting (#4914)
parent
da5a0b53
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
vllm/envs.py
vllm/envs.py
+7
-0
vllm/utils.py
vllm/utils.py
+3
-0
No files found.
vllm/envs.py
View file @
546a97ef
...
@@ -3,6 +3,7 @@ from typing import TYPE_CHECKING, Any, Callable, Dict, Optional
...
@@ -3,6 +3,7 @@ from typing import TYPE_CHECKING, Any, Callable, Dict, Optional
if
TYPE_CHECKING
:
if
TYPE_CHECKING
:
VLLM_HOST_IP
:
str
=
""
VLLM_HOST_IP
:
str
=
""
VLLM_PORT
:
Optional
[
int
]
=
None
VLLM_USE_MODELSCOPE
:
bool
=
False
VLLM_USE_MODELSCOPE
:
bool
=
False
VLLM_INSTANCE_ID
:
Optional
[
str
]
=
None
VLLM_INSTANCE_ID
:
Optional
[
str
]
=
None
VLLM_NCCL_SO_PATH
:
Optional
[
str
]
=
None
VLLM_NCCL_SO_PATH
:
Optional
[
str
]
=
None
...
@@ -96,6 +97,12 @@ environment_variables: Dict[str, Callable[[], Any]] = {
...
@@ -96,6 +97,12 @@ environment_variables: Dict[str, Callable[[], Any]] = {
'VLLM_HOST_IP'
:
'VLLM_HOST_IP'
:
lambda
:
os
.
getenv
(
'VLLM_HOST_IP'
,
""
)
or
os
.
getenv
(
"HOST_IP"
,
""
),
lambda
:
os
.
getenv
(
'VLLM_HOST_IP'
,
""
)
or
os
.
getenv
(
"HOST_IP"
,
""
),
# used in distributed environment to manually set the communication port
# '0' is used to make mypy happy
'VLLM_PORT'
:
lambda
:
int
(
os
.
getenv
(
'VLLM_PORT'
,
'0'
))
if
'VLLM_PORT'
in
os
.
environ
else
None
,
# If true, will load models from ModelScope instead of Hugging Face Hub.
# If true, will load models from ModelScope instead of Hugging Face Hub.
# note that the value is true or false, not numbers
# note that the value is true or false, not numbers
"VLLM_USE_MODELSCOPE"
:
"VLLM_USE_MODELSCOPE"
:
...
...
vllm/utils.py
View file @
546a97ef
...
@@ -282,6 +282,9 @@ def get_distributed_init_method(ip: str, port: int) -> str:
...
@@ -282,6 +282,9 @@ def get_distributed_init_method(ip: str, port: int) -> str:
def
get_open_port
()
->
int
:
def
get_open_port
()
->
int
:
port
=
envs
.
VLLM_PORT
if
port
is
not
None
:
return
port
# try ipv4
# try ipv4
try
:
try
:
with
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
as
s
:
with
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
as
s
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment