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
2dda3e35
Unverified
Commit
2dda3e35
authored
Sep 25, 2025
by
rongfu.leng
Committed by
GitHub
Sep 24, 2025
Browse files
[Bugfix] add cache model when from object storage get model (#24764)
Signed-off-by:
rongfu.leng
<
rongfu.leng@daocloud.io
>
parent
d83f3f7c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
8 deletions
+14
-8
vllm/envs.py
vllm/envs.py
+6
-0
vllm/transformers_utils/runai_utils.py
vllm/transformers_utils/runai_utils.py
+8
-8
No files found.
vllm/envs.py
View file @
2dda3e35
...
...
@@ -64,6 +64,7 @@ if TYPE_CHECKING:
VLLM_XLA_USE_SPMD
:
bool
=
False
VLLM_WORKER_MULTIPROC_METHOD
:
Literal
[
"fork"
,
"spawn"
]
=
"fork"
VLLM_ASSETS_CACHE
:
str
=
os
.
path
.
join
(
VLLM_CACHE_ROOT
,
"assets"
)
VLLM_ASSETS_CACHE_MODEL_CLEAN
:
bool
=
False
VLLM_IMAGE_FETCH_TIMEOUT
:
int
=
5
VLLM_VIDEO_FETCH_TIMEOUT
:
int
=
30
VLLM_AUDIO_FETCH_TIMEOUT
:
int
=
10
...
...
@@ -699,6 +700,11 @@ environment_variables: dict[str, Callable[[], Any]] = {
os
.
path
.
join
(
get_default_cache_root
(),
"vllm"
,
"assets"
),
)),
# If the env var is set, we will clean model file in
# this path $VLLM_ASSETS_CACHE/model_streamer/$model_name
"VLLM_ASSETS_CACHE_MODEL_CLEAN"
:
lambda
:
bool
(
int
(
os
.
getenv
(
"VLLM_ASSETS_CACHE_MODEL_CLEAN"
,
"0"
))),
# Timeout for fetching images when serving multimodal models
# Default is 5 seconds
"VLLM_IMAGE_FETCH_TIMEOUT"
:
...
...
vllm/transformers_utils/runai_utils.py
View file @
2dda3e35
...
...
@@ -5,9 +5,10 @@ import hashlib
import
os
import
shutil
import
signal
import
tempfile
from
typing
import
Optional
from
vllm
import
envs
from
vllm.assets.base
import
get_cache_dir
from
vllm.logger
import
init_logger
from
vllm.utils
import
PlaceholderModule
...
...
@@ -58,20 +59,19 @@ class ObjectStorageModel:
"""
def
__init__
(
self
,
url
:
str
)
->
None
:
if
envs
.
VLLM_ASSETS_CACHE_MODEL_CLEAN
:
for
sig
in
(
signal
.
SIGINT
,
signal
.
SIGTERM
):
existing_handler
=
signal
.
getsignal
(
sig
)
signal
.
signal
(
sig
,
self
.
_close_by_signal
(
existing_handler
))
dir_name
=
os
.
path
.
join
(
tempfile
.
gettempdir
()
,
get_cache_dir
(),
"model_streamer"
,
hashlib
.
sha256
(
str
(
url
).
encode
()).
hexdigest
()[:
8
])
if
os
.
path
.
exists
(
dir_name
):
shutil
.
rmtree
(
dir_name
)
os
.
makedirs
(
dir_name
)
self
.
dir
=
dir_name
def
__del__
(
self
):
self
.
_close
()
logger
.
debug
(
"Init object storage, model cache path is: %s"
,
dir_name
)
def
_close
(
self
)
->
None
:
if
os
.
path
.
exists
(
self
.
dir
):
...
...
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