Add vLLM-Omni library info to Hugging Face Hub requests (#5381)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
57 files changed
+259
-220
No files matched your search
@@ -1,5 +1,5 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
|
||||
"""External model loading, audio I/O, and emotion conditioning for IndexTTS2."""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -171,9 +171,10 @@ def load_semantic_codec(
|
||||
codec.load_state_dict(state, strict=False)
|
||||
else:
|
||||
import safetensors.torch
|
||||
from huggingface_hub import hf_hub_download
|
||||
|
||||
ckpt_path = hf_hub_download("amphion/MaskGCT", filename="semantic_codec/model.safetensors")
|
||||
from vllm_omni.transformers_utils.repo_utils import hf_api
|
||||
|
||||
ckpt_path = hf_api().hf_hub_download("amphion/MaskGCT", filename="semantic_codec/model.safetensors")
|
||||
safetensors.torch.load_model(codec, ckpt_path)
|
||||
_freeze(codec.to(device=device, dtype=torch.float32))
|
||||
_semantic_codec_cache[cache_key] = codec
|
||||
@@ -198,9 +199,11 @@ def load_campplus(model_path: str, device: torch.device):
|
||||
if ckpt_path is not None:
|
||||
break
|
||||
if ckpt_path is None:
|
||||
from huggingface_hub import hf_hub_download
|
||||
if os.path.isdir(model_path):
|
||||
raise FileNotFoundError(f"IndexTTS CAMPPlus checkpoint is missing from local bundle {model_path!r}")
|
||||
from vllm_omni.transformers_utils.repo_utils import hf_api
|
||||
|
||||
ckpt_path = hf_hub_download("funasr/campplus", filename="campplus_cn_common.bin")
|
||||
ckpt_path = hf_api().hf_hub_download("funasr/campplus", filename="campplus_cn_common.bin")
|
||||
state = torch.load(ckpt_path, map_location="cpu", weights_only=True)
|
||||
campplus.load_state_dict(state, strict=False)
|
||||
_freeze(campplus.to(device=device, dtype=torch.float32))
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
|
||||
|
||||
# Copyright (c) 2024 NVIDIA CORPORATION.
|
||||
# Licensed under the MIT license.
|
||||
|
||||
@@ -9,13 +12,14 @@ import os
|
||||
|
||||
import torch
|
||||
import torch.nn as nn
|
||||
from huggingface_hub import PyTorchModelHubMixin, hf_hub_download
|
||||
from huggingface_hub import PyTorchModelHubMixin
|
||||
from torch.nn import Conv1d, ConvTranspose1d
|
||||
from torch.nn.utils import remove_weight_norm, weight_norm
|
||||
|
||||
from vllm_omni.model_executor.models.common.alias_free_activation import AliasFreeActivation1d
|
||||
from vllm_omni.model_executor.models.common.snake_activation import Snake, SnakeBeta
|
||||
from vllm_omni.model_executor.models.indextts2.s2mel.modules.commons import AttrDict
|
||||
from vllm_omni.transformers_utils.repo_utils import hf_api
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Helpers (inlined from env.py / utils.py)
|
||||
@@ -328,7 +332,7 @@ class BigVGAN(
|
||||
def _resolve(filename):
|
||||
if os.path.isdir(model_id):
|
||||
return os.path.join(model_id, filename)
|
||||
return hf_hub_download(
|
||||
return hf_api().hf_hub_download(
|
||||
repo_id=model_id,
|
||||
filename=filename,
|
||||
**{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
|
||||
"""IndexTTS 2.5 multilingual tiktoken vocabulary.
|
||||
|
||||
The vocabulary layout mirrors the official IndexTTS 2.5 tokenizer: 58,836
|
||||
@@ -234,9 +234,9 @@ def resolve_indextts25_tokenizer_file(
|
||||
return str(model_path)
|
||||
|
||||
try:
|
||||
from huggingface_hub import hf_hub_download
|
||||
from vllm_omni.transformers_utils.repo_utils import hf_api
|
||||
|
||||
return hf_hub_download(repo_id=model_dir, filename=tokenizer_file)
|
||||
return hf_api().hf_hub_download(repo_id=model_dir, filename=tokenizer_file)
|
||||
except Exception as exc:
|
||||
raise FileNotFoundError(
|
||||
f"Could not resolve IndexTTS 2.5 tokenizer {tokenizer_file!r} from {model_dir!r}"
|
||||
|
||||
Reference in new issue
Block a user