[BUG] Allows for RunAI Streamer and Torch.compile cache to be used together (#24922)

Signed-off-by: ahao-anyscale <ahao@anyscale.com>
This commit is contained in:
ahao-anyscale
2025-09-23 18:13:32 -06:00
committed by GitHub
parent 88d7bdbd23
commit c8bde93367
3 changed files with 119 additions and 4 deletions
+3 -2
View File
@@ -699,11 +699,12 @@ class ModelConfig:
model: Model name or path
tokenizer: Tokenizer name or path
"""
if not (is_runai_obj_uri(model) or is_runai_obj_uri(tokenizer)):
return
if is_runai_obj_uri(model):
object_storage_model = ObjectStorageModel()
object_storage_model = ObjectStorageModel(url=model)
object_storage_model.pull_files(
model, allow_pattern=["*.model", "*.py", "*.json"])
self.model_weights = model
@@ -722,7 +723,7 @@ class ModelConfig:
# Only download tokenizer if needed and not already handled
if is_runai_obj_uri(tokenizer):
object_storage_tokenizer = ObjectStorageModel()
object_storage_tokenizer = ObjectStorageModel(url=tokenizer)
object_storage_tokenizer.pull_files(model,
ignore_pattern=[
"*.pt", "*.safetensors",
+9 -2
View File
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import hashlib
import os
import shutil
import signal
@@ -56,12 +57,18 @@ class ObjectStorageModel:
pull_files(): Pull model from object storage to the temporary directory.
"""
def __init__(self) -> None:
def __init__(self, url: str) -> None:
for sig in (signal.SIGINT, signal.SIGTERM):
existing_handler = signal.getsignal(sig)
signal.signal(sig, self._close_by_signal(existing_handler))
self.dir = tempfile.mkdtemp()
dir_name = os.path.join(
tempfile.gettempdir(),
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()