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
b27f1671
Commit
b27f1671
authored
Mar 31, 2026
by
zhuwenwen
Browse files
[Version] update whl version
parent
61b1a9d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
104 additions
and
5 deletions
+104
-5
setup.py
setup.py
+104
-5
No files found.
setup.py
View file @
b27f1671
...
@@ -22,6 +22,15 @@ from setuptools_scm import get_version
...
@@ -22,6 +22,15 @@ from setuptools_scm import get_version
from
torch.utils.cpp_extension
import
CUDA_HOME
,
ROCM_HOME
from
torch.utils.cpp_extension
import
CUDA_HOME
,
ROCM_HOME
from
typing
import
Optional
,
Union
import
subprocess
from
pathlib
import
Path
pwd
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
add_git_version
=
False
if
int
(
os
.
environ
.
get
(
'ADD_GIT_VERSION'
,
'0'
))
==
1
:
add_git_version
=
True
def
load_module_from_path
(
module_name
,
path
):
def
load_module_from_path
(
module_name
,
path
):
spec
=
importlib
.
util
.
spec_from_file_location
(
module_name
,
path
)
spec
=
importlib
.
util
.
spec_from_file_location
(
module_name
,
path
)
module
=
importlib
.
util
.
module_from_spec
(
spec
)
module
=
importlib
.
util
.
module_from_spec
(
spec
)
...
@@ -802,6 +811,94 @@ def get_nvcc_cuda_version() -> Version:
...
@@ -802,6 +811,94 @@ def get_nvcc_cuda_version() -> Version:
return
nvcc_cuda_version
return
nvcc_cuda_version
def
get_sha
(
root
:
Union
[
str
,
Path
])
->
str
:
try
:
return
subprocess
.
check_output
([
'git'
,
'rev-parse'
,
'HEAD'
],
cwd
=
root
).
decode
(
'ascii'
).
strip
()
except
Exception
:
return
'Unknown'
def
get_version_add
(
sha
:
Optional
[
str
]
=
None
)
->
str
:
command
=
"git config --global --add safe.directory "
+
pwd
subprocess
.
run
(
command
,
shell
=
True
,
capture_output
=
False
,
text
=
True
)
vllm_root
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
add_version_path
=
os
.
path
.
join
(
os
.
path
.
join
(
vllm_root
,
"vllm"
),
"version.py"
)
major
,
minor
,
_
=
torch
.
__version__
.
split
(
'.'
)
if
add_git_version
:
if
sha
!=
'Unknown'
:
if
sha
is
None
:
sha
=
get_sha
(
vllm_root
)
version
=
'das.ori.'
+
sha
[:
7
]
else
:
version
=
'das.ori'
# dtk version
if
os
.
getenv
(
"ROCM_PATH"
):
rocm_path
=
os
.
getenv
(
'ROCM_PATH'
,
""
)
rocm_version_path
=
os
.
path
.
join
(
rocm_path
,
'.info'
,
"rocm_version"
)
with
open
(
rocm_version_path
,
'r'
,
encoding
=
'utf-8'
)
as
file
:
lines
=
file
.
readlines
()
rocm_version
=
lines
[
0
].
replace
(
"."
,
""
)
version
+=
".dtk"
+
rocm_version
new_version_content
=
f
"""
try:
__version__ = "0.18.1"
__version_tuple__ = (0, 18, 1)
__hcu_version__ = f'0.18.1+
{
version
}
'
from vllm.version import __version__, __version_tuple__, __hcu_version__
except Exception as e:
import warnings
warnings.warn(f"Failed to read commit hash:
\\
n + str(e)",
RuntimeWarning,
stacklevel=2)
__version__ = "dev"
__version_tuple__ = (0, 0, __version__)
def _prev_minor_version_was(version_str):
'''Check whether a given version matches the previous minor version.
Return True if version_str matches the previous minor version.
For example - return True if the current version if 0.7.4 and the
supplied version_str is '0.6'.
Used for --show-hidden-metrics-for-version.
'''
# Match anything if this is a dev tree
if __version_tuple__[0:2] == (0, 0):
return True
# Note - this won't do the right thing when we release 1.0!
# assert __version_tuple__[0] == 0
assert isinstance(__version_tuple__[1], int)
return version_str == f"{{__version_tuple__[0]}}.{{__version_tuple__[1] - 1}}"
def _prev_minor_version():
'''For the purpose of testing, return a previous minor version number.'''
# In dev tree, this will return "0.-1", but that will work fine"
assert isinstance(__version_tuple__[1], int)
return f"{{__version_tuple__[0]}}.{{__version_tuple__[1] - 1}}"
"""
with
open
(
add_version_path
,
encoding
=
"utf-8"
,
mode
=
"w"
)
as
file
:
file
.
write
(
new_version_content
)
file
.
close
()
def
get_version
():
get_version_add
()
version_file
=
'vllm/version.py'
with
open
(
version_file
,
encoding
=
'utf-8'
)
as
f
:
exec
(
compile
(
f
.
read
(),
version_file
,
'exec'
))
return
locals
()[
'__hcu_version__'
]
def
get_vllm_version
()
->
str
:
def
get_vllm_version
()
->
str
:
# Allow overriding the version. This is useful to build platform-specific
# Allow overriding the version. This is useful to build platform-specific
# wheels (e.g. CPU, TPU) without modifying the source.
# wheels (e.g. CPU, TPU) without modifying the source.
...
@@ -810,8 +907,9 @@ def get_vllm_version() -> str:
...
@@ -810,8 +907,9 @@ def get_vllm_version() -> str:
os
.
environ
[
"SETUPTOOLS_SCM_PRETEND_VERSION"
]
=
env_version
os
.
environ
[
"SETUPTOOLS_SCM_PRETEND_VERSION"
]
=
env_version
return
get_version
(
write_to
=
"vllm/_version.py"
)
return
get_version
(
write_to
=
"vllm/_version.py"
)
version
=
get_version
(
write_to
=
"vllm/_version.py"
)
if
not
_is_hip
():
sep
=
"+"
if
"+"
not
in
version
else
"."
# dev versions might contain +
version
=
get_version
(
write_to
=
"vllm/_version.py"
)
sep
=
"+"
if
"+"
not
in
version
else
"."
# dev versions might contain +
if
_no_device
():
if
_no_device
():
if
envs
.
VLLM_TARGET_DEVICE
==
"empty"
:
if
envs
.
VLLM_TARGET_DEVICE
==
"empty"
:
...
@@ -828,9 +926,10 @@ def get_vllm_version() -> str:
...
@@ -828,9 +926,10 @@ def get_vllm_version() -> str:
version
+=
f
"
{
sep
}
cu
{
cuda_version_str
}
"
version
+=
f
"
{
sep
}
cu
{
cuda_version_str
}
"
elif
_is_hip
():
elif
_is_hip
():
# Get the Rocm Version
# Get the Rocm Version
rocm_version
=
get_rocm_version
()
or
torch
.
version
.
hip
# rocm_version = get_rocm_version() or torch.version.hip
if
rocm_version
and
rocm_version
!=
envs
.
VLLM_MAIN_CUDA_VERSION
:
# if rocm_version and rocm_version != envs.VLLM_MAIN_CUDA_VERSION:
version
+=
f
"
{
sep
}
rocm
{
rocm_version
.
replace
(
'.'
,
''
)[:
3
]
}
"
# version += f"{sep}rocm{rocm_version.replace('.', '')[:3]}"
version
=
get_version
()
elif
_is_tpu
():
elif
_is_tpu
():
version
+=
f
"
{
sep
}
tpu"
version
+=
f
"
{
sep
}
tpu"
elif
_is_cpu
():
elif
_is_cpu
():
...
...
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