[Fix]Ensure HuggingFace downloads complete before initialization. (#1213)

Signed-off-by: zhou zhuoxin <zhouzhuoxin1508@outlook.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
zhou zhuoxinandCopilot authored and GitHub committed 2026-02-10 16:05:12 +08:00
1 parent acfe99e4d9
commit 109bb97b2c
2 files changed
+41 -8

No files matched your search

+20 -2
View File
@@ -10,6 +10,7 @@ from collections.abc import Callable, Generator, Sequence
from concurrent.futures import ThreadPoolExecutor, as_completed
from typing import Any, Literal, overload
import huggingface_hub
from omegaconf import OmegaConf
from tqdm.auto import tqdm
from vllm import SamplingParams
@@ -40,6 +41,9 @@ from vllm_omni.entrypoints.utils import (
)
from vllm_omni.inputs.data import OmniDiffusionSamplingParams, OmniPromptType, OmniSamplingParams
from vllm_omni.metrics import OrchestratorAggregator, StageRequestStats
from vllm_omni.model_executor.model_loader.weight_utils import (
download_weights_from_hf_specific,
)
from vllm_omni.outputs import OmniRequestOutput
logger = init_logger(__name__)
@@ -66,14 +70,28 @@ def _dummy_snapshot_download(model_id):
def omni_snapshot_download(model_id) -> str:
# If it's already a local path, just return it
if os.path.exists(model_id):
return model_id
# TODO: this is just a workaround for quickly use modelscope, we should support
# modelscope in weight loading feature instead of using `snapshot_download`
if os.environ.get("VLLM_USE_MODELSCOPE", False):
from modelscope.hub.snapshot_download import snapshot_download
return snapshot_download(model_id)
else:
return _dummy_snapshot_download(model_id)
# For other cases (Hugging Face), perform a real download to ensure all
# necessary files (including *.pt for audio/diffusion) are available locally
# before stage workers are spawned. This prevents initialization timeouts.
try:
return download_weights_from_hf_specific(
model_name_or_path=model_id,
cache_dir=None,
allow_patterns=["*"],
require_all=True,
)
except huggingface_hub.errors.RepositoryNotFoundError:
logger.warning(f"Repository not found for '{model_id}'.")
return model_id
class OmniBase: