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:
co-authored by
Andreas Karatzas
parent
0b1a8bb1f6
commit
ca0defa343
@@ -24,8 +24,6 @@ from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import importlib
|
||||
import json
|
||||
import os
|
||||
from collections.abc import Callable, Iterable, Mapping, Sequence
|
||||
from functools import lru_cache
|
||||
from typing import (
|
||||
@@ -39,7 +37,6 @@ import regex as re
|
||||
import torch
|
||||
import torch.nn as nn
|
||||
import torch.nn.functional as F
|
||||
from huggingface_hub import hf_hub_download
|
||||
from PIL import Image
|
||||
from transformers import AutoProcessor, AutoTokenizer, BatchFeature
|
||||
from transformers.dynamic_module_utils import get_class_from_dynamic_module
|
||||
@@ -108,6 +105,7 @@ from vllm.multimodal.video import (
|
||||
)
|
||||
from vllm.sequence import IntermediateTensors
|
||||
from vllm.transformers_utils.processor import _merge_mm_kwargs
|
||||
from vllm.transformers_utils.repo_utils import get_hf_file_to_dict
|
||||
from vllm.transformers_utils.utils import convert_model_repo_to_path
|
||||
from vllm.utils.tensor_schema import TensorSchema, TensorShape
|
||||
|
||||
@@ -165,13 +163,10 @@ def _load_ov2_processor(
|
||||
# codec video backend keeps its configured defaults.
|
||||
codec_config: dict = {}
|
||||
try:
|
||||
config_file = os.path.join(path, "preprocessor_config.json")
|
||||
if not os.path.isfile(config_file):
|
||||
config_file = hf_hub_download(
|
||||
path, "preprocessor_config.json", revision=revision
|
||||
)
|
||||
with open(config_file, encoding="utf-8") as f:
|
||||
codec_config = json.load(f).get("codec", {}) or {}
|
||||
preprocessor_config = get_hf_file_to_dict(
|
||||
"preprocessor_config.json", path, revision
|
||||
)
|
||||
codec_config = (preprocessor_config or {}).get("codec", {}) or {}
|
||||
except Exception:
|
||||
logger.debug("OV2: no codec defaults found in preprocessor_config.json")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user