Make bare hugging_face imports forbidden (#49726)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Andreas Karatzas <akaratza@amd.com>
This commit is contained in:
Harry Mellor
2026-07-25 04:18:39 -07:00
committed by GitHub
co-authored by Andreas Karatzas
parent 0b1a8bb1f6
commit ca0defa343
29 changed files with 199 additions and 106 deletions
@@ -3,10 +3,10 @@
from pathlib import Path
from huggingface_hub import snapshot_download
from runai_model_streamer.safetensors_streamer.streamer_mock import StreamerPatcher
from vllm.engine.arg_utils import EngineArgs
from vllm.transformers_utils.repo_utils import hf_api
from .conftest import RunaiDummyExecutor
@@ -25,7 +25,7 @@ def test_runai_model_loader_download_files_s3_mocked_with_patch(
# Download model from HF
mock_model_dir = f"{tmp_path}/gpt2"
snapshot_download(repo_id=test_model, local_dir=mock_model_dir)
hf_api().snapshot_download(repo_id=test_model, local_dir=mock_model_dir)
monkeypatch.setattr(
"vllm.transformers_utils.runai_utils.runai_list_safetensors",
@@ -9,11 +9,11 @@ from tempfile import TemporaryDirectory
import pytest
import torch
from huggingface_hub import snapshot_download
from vllm import LLM, SamplingParams
from vllm.model_executor.model_loader import ShardedStateLoader
from vllm.platforms import current_platform
from vllm.transformers_utils.repo_utils import hf_api
prompts = [
"Hello, my name is",
@@ -52,7 +52,7 @@ def test_filter_subtensors():
@pytest.fixture(scope="module")
def llama_3p2_1b_files():
input_dir = snapshot_download(
input_dir = hf_api().snapshot_download(
"meta-llama/Llama-3.2-1B-Instruct", ignore_patterns=["*.bin*", "original/*"]
)