Add vLLM library info to Hugging Face Hub requests (#43857)
Signed-off-by: Wauplin <lucainp@gmail.com> Signed-off-by: Lucain Pouget <lucain@huggingface.co> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
3f6f508e14
commit
11dfa3169d
@@ -8,7 +8,6 @@ from collections.abc import Collection, Sequence, Set
|
||||
from pathlib import Path
|
||||
from typing import Any, Literal, overload
|
||||
|
||||
from huggingface_hub import hf_hub_download
|
||||
from huggingface_hub.utils import (
|
||||
EntryNotFoundError,
|
||||
HfHubHTTPError,
|
||||
@@ -20,6 +19,7 @@ from transformers.utils import chat_template_utils as hf_chat_utils
|
||||
|
||||
from vllm.entrypoints.chat_utils import ChatCompletionMessageParam
|
||||
from vllm.logger import init_logger
|
||||
from vllm.transformers_utils.repo_utils import hf_api
|
||||
|
||||
from .protocol import TokenizerLike
|
||||
|
||||
@@ -70,7 +70,7 @@ def _maybe_load_tokenizer_config(
|
||||
return {}
|
||||
|
||||
try:
|
||||
config_file = hf_hub_download(
|
||||
config_file = hf_api().hf_hub_download(
|
||||
repo_id=repo_id,
|
||||
filename="tokenizer_config.json",
|
||||
revision=revision,
|
||||
@@ -208,7 +208,7 @@ class Grok2Tokenizer(TokenizerLike):
|
||||
repo_id = None
|
||||
else:
|
||||
vocab_file = Path(
|
||||
hf_hub_download(
|
||||
hf_api().hf_hub_download(
|
||||
repo_id=str(path_or_repo_id),
|
||||
filename="tokenizer.tok.json",
|
||||
revision=revision,
|
||||
|
||||
@@ -10,13 +10,13 @@ from typing import Any, overload
|
||||
|
||||
import pybase64
|
||||
import tiktoken
|
||||
from huggingface_hub import hf_hub_download
|
||||
from transformers import AddedToken, BatchEncoding
|
||||
from transformers.utils import chat_template_utils as hf_chat_utils
|
||||
|
||||
from vllm.entrypoints.chat_utils import ChatCompletionMessageParam
|
||||
from vllm.logger import init_logger
|
||||
from vllm.tokenizers.protocol import TokenizerLike
|
||||
from vllm.transformers_utils.repo_utils import hf_api
|
||||
|
||||
logger = init_logger(__name__)
|
||||
|
||||
@@ -78,7 +78,7 @@ class KimiAudioTokenizer(TokenizerLike):
|
||||
|
||||
# Try to download tiktoken.model or tokenizer.model
|
||||
try:
|
||||
vocab_path = hf_hub_download(
|
||||
vocab_path = hf_api().hf_hub_download(
|
||||
repo_id=repo_id,
|
||||
filename="tiktoken.model",
|
||||
revision=revision,
|
||||
@@ -87,7 +87,7 @@ class KimiAudioTokenizer(TokenizerLike):
|
||||
vocab_file = Path(vocab_path)
|
||||
except Exception:
|
||||
try:
|
||||
vocab_path = hf_hub_download(
|
||||
vocab_path = hf_api().hf_hub_download(
|
||||
repo_id=repo_id,
|
||||
filename="tokenizer.model",
|
||||
revision=revision,
|
||||
@@ -101,7 +101,7 @@ class KimiAudioTokenizer(TokenizerLike):
|
||||
|
||||
# Also download tokenizer_config.json if available
|
||||
with contextlib.suppress(Exception):
|
||||
hf_hub_download(
|
||||
hf_api().hf_hub_download(
|
||||
repo_id=repo_id,
|
||||
filename="tokenizer_config.json",
|
||||
revision=revision,
|
||||
|
||||
Reference in New Issue
Block a user