初始化项目,由ModelHub XC社区提供模型
Model: hypaai/Hypa-Orpheus-Step-latest-16bit Source: Original Platform
This commit is contained in:
36
.gitattributes
vendored
Normal file
36
.gitattributes
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.model filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||||
|
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||||
21
README.md
Normal file
21
README.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
base_model: unsloth/orpheus-3b-0.1-ft-unsloth-bnb-4bit
|
||||||
|
tags:
|
||||||
|
- text-generation-inference
|
||||||
|
- transformers
|
||||||
|
- unsloth
|
||||||
|
- llama
|
||||||
|
license: apache-2.0
|
||||||
|
language:
|
||||||
|
- en
|
||||||
|
---
|
||||||
|
|
||||||
|
# Uploaded finetuned model
|
||||||
|
|
||||||
|
- **Developed by:** hypaai
|
||||||
|
- **License:** apache-2.0
|
||||||
|
- **Finetuned from model :** unsloth/orpheus-3b-0.1-ft-unsloth-bnb-4bit
|
||||||
|
|
||||||
|
This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
||||||
|
|
||||||
|
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|
||||||
93
chat_template.jinja
Normal file
93
chat_template.jinja
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
{{- bos_token }}
|
||||||
|
{%- if custom_tools is defined %}
|
||||||
|
{%- set tools = custom_tools %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if not tools_in_user_message is defined %}
|
||||||
|
{%- set tools_in_user_message = true %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if not date_string is defined %}
|
||||||
|
{%- if strftime_now is defined %}
|
||||||
|
{%- set date_string = strftime_now("%d %b %Y") %}
|
||||||
|
{%- else %}
|
||||||
|
{%- set date_string = "26 Jul 2024" %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if not tools is defined %}
|
||||||
|
{%- set tools = none %}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
{#- This block extracts the system message, so we can slot it into the right place. #}
|
||||||
|
{%- if messages[0]['role'] == 'system' %}
|
||||||
|
{%- set system_message = messages[0]['content']|trim %}
|
||||||
|
{%- set messages = messages[1:] %}
|
||||||
|
{%- else %}
|
||||||
|
{%- set system_message = "" %}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
{#- System message #}
|
||||||
|
{{- "<|start_header_id|>system<|end_header_id|>\n\n" }}
|
||||||
|
{%- if tools is not none %}
|
||||||
|
{{- "Environment: ipython\n" }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- "Cutting Knowledge Date: December 2023\n" }}
|
||||||
|
{{- "Today Date: " + date_string + "\n\n" }}
|
||||||
|
{%- if tools is not none and not tools_in_user_message %}
|
||||||
|
{{- "You have access to the following functions. To call a function, please respond with JSON for a function call." }}
|
||||||
|
{{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }}
|
||||||
|
{{- "Do not use variables.\n\n" }}
|
||||||
|
{%- for t in tools %}
|
||||||
|
{{- t | tojson(indent=4) }}
|
||||||
|
{{- "\n\n" }}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
{{- system_message }}
|
||||||
|
{{- "<|eot_id|>" }}
|
||||||
|
|
||||||
|
{#- Custom tools are passed in a user message with some extra guidance #}
|
||||||
|
{%- if tools_in_user_message and not tools is none %}
|
||||||
|
{#- Extract the first user message so we can plug it in here #}
|
||||||
|
{%- if messages | length != 0 %}
|
||||||
|
{%- set first_user_message = messages[0]['content']|trim %}
|
||||||
|
{%- set messages = messages[1:] %}
|
||||||
|
{%- else %}
|
||||||
|
{{- raise_exception("Cannot put tools in the first user message when there's no first user message!") }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '<|start_header_id|>user<|end_header_id|>\n\n' -}}
|
||||||
|
{{- "Given the following functions, please respond with a JSON for a function call " }}
|
||||||
|
{{- "with its proper arguments that best answers the given prompt.\n\n" }}
|
||||||
|
{{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }}
|
||||||
|
{{- "Do not use variables.\n\n" }}
|
||||||
|
{%- for t in tools %}
|
||||||
|
{{- t | tojson(indent=4) }}
|
||||||
|
{{- "\n\n" }}
|
||||||
|
{%- endfor %}
|
||||||
|
{{- first_user_message + "<|eot_id|>"}}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
{%- for message in messages %}
|
||||||
|
{%- if not (message.role == 'ipython' or message.role == 'tool' or 'tool_calls' in message) %}
|
||||||
|
{{- '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n'+ message['content'] | trim + '<|eot_id|>' }}
|
||||||
|
{%- elif 'tool_calls' in message %}
|
||||||
|
{%- if not message.tool_calls|length == 1 %}
|
||||||
|
{{- raise_exception("This model only supports single tool-calls at once!") }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- set tool_call = message.tool_calls[0].function %}
|
||||||
|
{{- '<|start_header_id|>assistant<|end_header_id|>\n\n' -}}
|
||||||
|
{{- '{"name": "' + tool_call.name + '", ' }}
|
||||||
|
{{- '"parameters": ' }}
|
||||||
|
{{- tool_call.arguments | tojson }}
|
||||||
|
{{- "}" }}
|
||||||
|
{{- "<|eot_id|>" }}
|
||||||
|
{%- elif message.role == "tool" or message.role == "ipython" %}
|
||||||
|
{{- "<|start_header_id|>ipython<|end_header_id|>\n\n" }}
|
||||||
|
{%- if message.content is mapping or message.content is iterable %}
|
||||||
|
{{- message.content | tojson }}
|
||||||
|
{%- else %}
|
||||||
|
{{- message.content }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- "<|eot_id|>" }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- if add_generation_prompt %}
|
||||||
|
{{- '<|start_header_id|>assistant<|end_header_id|>\n\n' }}
|
||||||
|
{%- endif %}
|
||||||
37
config.json
Normal file
37
config.json
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
"architectures": [
|
||||||
|
"LlamaForCausalLM"
|
||||||
|
],
|
||||||
|
"attention_bias": false,
|
||||||
|
"attention_dropout": 0.0,
|
||||||
|
"bos_token_id": 128000,
|
||||||
|
"torch_dtype": "bfloat16",
|
||||||
|
"eos_token_id": 128009,
|
||||||
|
"head_dim": 128,
|
||||||
|
"hidden_act": "silu",
|
||||||
|
"hidden_size": 3072,
|
||||||
|
"initializer_range": 0.02,
|
||||||
|
"intermediate_size": 8192,
|
||||||
|
"max_position_embeddings": 131072,
|
||||||
|
"mlp_bias": false,
|
||||||
|
"model_type": "llama",
|
||||||
|
"num_attention_heads": 24,
|
||||||
|
"num_hidden_layers": 28,
|
||||||
|
"num_key_value_heads": 8,
|
||||||
|
"pad_token_id": 128004,
|
||||||
|
"pretraining_tp": 1,
|
||||||
|
"rms_norm_eps": 1e-05,
|
||||||
|
"rope_parameters": {
|
||||||
|
"factor": 32.0,
|
||||||
|
"high_freq_factor": 4.0,
|
||||||
|
"low_freq_factor": 1.0,
|
||||||
|
"original_max_position_embeddings": 8192,
|
||||||
|
"rope_theta": 500000.0,
|
||||||
|
"rope_type": "llama3"
|
||||||
|
},
|
||||||
|
"tie_word_embeddings": true,
|
||||||
|
"unsloth_fixed": true,
|
||||||
|
"unsloth_version": "2026.7.3",
|
||||||
|
"use_cache": true,
|
||||||
|
"vocab_size": 156940
|
||||||
|
}
|
||||||
11
generation_config.json
Normal file
11
generation_config.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"_from_model_config": true,
|
||||||
|
"bos_token_id": 128000,
|
||||||
|
"do_sample": true,
|
||||||
|
"eos_token_id": 128009,
|
||||||
|
"max_length": 131072,
|
||||||
|
"pad_token_id": 128004,
|
||||||
|
"temperature": 0.6,
|
||||||
|
"top_p": 0.9,
|
||||||
|
"transformers_version": "5.13.1"
|
||||||
|
}
|
||||||
330
handler.py
Normal file
330
handler.py
Normal file
@@ -0,0 +1,330 @@
|
|||||||
|
"""
|
||||||
|
HF Inference Endpoint handler — Hypa Orpheus TTS + Voice Cloning (merged 16-bit).
|
||||||
|
|
||||||
|
Task matrix (routed by `parameters`):
|
||||||
|
task="tts", mode="vanilla" : {speaker}: text -> speech
|
||||||
|
task="tts", mode="translate" : {speaker} - {Language}: text -> speech in Language
|
||||||
|
task="vc", mode="vanilla" : reference (text+audio) + target text -> speech in reference voice
|
||||||
|
task="vc", mode="translate" : + language tag on target text -> cross-lingual cloning
|
||||||
|
VC method="m1" (in-context) | method="m2" (continue-speaking)
|
||||||
|
|
||||||
|
Output parity with the legacy endpoint: `audio_b64` is base64 of the RAW
|
||||||
|
float32 little-endian mono PCM buffer at 24000 Hz (NO WAV/RIFF container),
|
||||||
|
so existing products decode with: np.frombuffer(base64.b64decode(s), dtype=np.float32)
|
||||||
|
[If the legacy endpoint used int16, change RAW_DTYPE to np.int16 below.]
|
||||||
|
|
||||||
|
Prompts are byte-identical to Step-III training (_encode_text / build_tts /
|
||||||
|
build_vc_both), reference codes are frame-deduped, and prompts reach vLLM as
|
||||||
|
token ids (never a decoded string).
|
||||||
|
"""
|
||||||
|
|
||||||
|
import io
|
||||||
|
import os
|
||||||
|
import base64
|
||||||
|
import tempfile
|
||||||
|
import traceback
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
import torch
|
||||||
|
import soundfile as sf
|
||||||
|
import librosa
|
||||||
|
|
||||||
|
from transformers import AutoTokenizer
|
||||||
|
from snac import SNAC
|
||||||
|
from vllm import LLM, SamplingParams
|
||||||
|
|
||||||
|
|
||||||
|
class EndpointHandler:
|
||||||
|
# ---- Orpheus special tokens (fixed by the model) ----
|
||||||
|
TOKENISER_LEN = 128256
|
||||||
|
START_OF_TEXT = 128000
|
||||||
|
END_OF_TEXT = 128009
|
||||||
|
START_OF_SPEECH = TOKENISER_LEN + 1 # 128257
|
||||||
|
END_OF_SPEECH = TOKENISER_LEN + 2 # 128258
|
||||||
|
START_OF_HUMAN = TOKENISER_LEN + 3 # 128259
|
||||||
|
END_OF_HUMAN = TOKENISER_LEN + 4 # 128260
|
||||||
|
START_OF_AI = TOKENISER_LEN + 5 # 128261
|
||||||
|
END_OF_AI = TOKENISER_LEN + 6 # 128262
|
||||||
|
AUDIO_OFFSET = 128266
|
||||||
|
|
||||||
|
# NOTE: fine-tune data capped at 2048 tokens; 4096 kept so M1-VC prompts
|
||||||
|
# (ref codes + two texts, often 1000-2000 tokens) retain a generation
|
||||||
|
# budget. Base Llama-3 RoPE supports these positions natively; expect the
|
||||||
|
# best quality when prompt+generation stays near the trained ~2048.
|
||||||
|
MAX_MODEL_LEN = 4096
|
||||||
|
MAX_REF_SECONDS = 30
|
||||||
|
SNAC_SR = 24000
|
||||||
|
RAW_DTYPE = np.float32 # legacy raw-PCM dtype (see docstring)
|
||||||
|
|
||||||
|
LANG_DISPLAY = {
|
||||||
|
"en": "English", "es": "Spanish", "fr": "French", "ha": "Hausa",
|
||||||
|
"yo": "Yoruba", "sw": "Swahili", "ar": "Arabic", "pt": "Portuguese",
|
||||||
|
"ann": "Annang", "ebi": "Ebira", "efi": "Efik", "ego": "Eggon",
|
||||||
|
"urh": "Urhobo", "ibb": "Ibibio", "idm": "Idoma", "igl": "Igala",
|
||||||
|
"ig": "Igbo", "nup": "Nupe", "tiv": "Tiv", "pg": "Pidgin",
|
||||||
|
}
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------ init
|
||||||
|
def __init__(self, path=""):
|
||||||
|
self.device = "cuda" if torch.cuda.is_available() else "cpu"
|
||||||
|
# SNAC first (tiny, ~80 MB) so it never contends with vLLM's reservation.
|
||||||
|
self.snac = SNAC.from_pretrained("hubertsiuzdak/snac_24khz").to(self.device).eval()
|
||||||
|
self.model = LLM(
|
||||||
|
path,
|
||||||
|
max_model_len=self.MAX_MODEL_LEN,
|
||||||
|
gpu_memory_utilization=0.75,
|
||||||
|
)
|
||||||
|
self.tokenizer = AutoTokenizer.from_pretrained(path)
|
||||||
|
|
||||||
|
# ------------------------------------------------------- text encoding
|
||||||
|
def _lang_display(self, x):
|
||||||
|
if x is None:
|
||||||
|
return None
|
||||||
|
k = str(x).strip().lower()
|
||||||
|
return self.LANG_DISPLAY.get(k, k.capitalize() if k else None)
|
||||||
|
|
||||||
|
def _encode_text(self, text, speaker=None, lang_tag=None, add_bos=True):
|
||||||
|
text = "" if text is None else str(text).strip()
|
||||||
|
spk = speaker if (speaker and str(speaker).strip().lower() not in ("", "random", "none")) else None
|
||||||
|
if spk and lang_tag:
|
||||||
|
prompt = f"{spk} - {lang_tag}: {text}"
|
||||||
|
elif spk:
|
||||||
|
prompt = f"{spk}: {text}"
|
||||||
|
elif lang_tag:
|
||||||
|
prompt = f"{lang_tag}: {text}"
|
||||||
|
else:
|
||||||
|
prompt = text
|
||||||
|
ids = self.tokenizer.encode(prompt, add_special_tokens=add_bos)
|
||||||
|
ids.append(self.END_OF_TEXT)
|
||||||
|
return ids
|
||||||
|
|
||||||
|
# ------------------------------------------------------ audio encoding
|
||||||
|
def _b64_to_wave(self, b64_str):
|
||||||
|
raw = base64.b64decode(b64_str)
|
||||||
|
if not raw:
|
||||||
|
raise ValueError("reference_audio is empty.")
|
||||||
|
try:
|
||||||
|
arr, sr = sf.read(io.BytesIO(raw), dtype="float32")
|
||||||
|
except Exception:
|
||||||
|
# temp-file fallback: librosa/audioread handles containers
|
||||||
|
# libsndfile can't open, but needs a real file path for some codecs.
|
||||||
|
tmp = None
|
||||||
|
try:
|
||||||
|
with tempfile.NamedTemporaryFile(delete=False, suffix=".audio") as f:
|
||||||
|
f.write(raw)
|
||||||
|
tmp = f.name
|
||||||
|
arr, sr = librosa.load(tmp, sr=None, mono=False)
|
||||||
|
arr = np.asarray(arr, dtype=np.float32)
|
||||||
|
if arr.ndim > 1:
|
||||||
|
arr = arr.T # librosa returns (ch, n)
|
||||||
|
finally:
|
||||||
|
if tmp and os.path.exists(tmp):
|
||||||
|
os.remove(tmp)
|
||||||
|
if arr.ndim > 1:
|
||||||
|
arr = arr.mean(axis=1)
|
||||||
|
if arr.size == 0 or not np.isfinite(arr).all():
|
||||||
|
raise ValueError("Reference audio is empty or contains invalid samples.")
|
||||||
|
if sr != self.SNAC_SR:
|
||||||
|
arr = librosa.resample(arr.astype(np.float32), orig_sr=sr, target_sr=self.SNAC_SR)
|
||||||
|
dur = len(arr) / self.SNAC_SR
|
||||||
|
if dur > self.MAX_REF_SECONDS:
|
||||||
|
raise ValueError(f"Reference audio is {dur:.1f}s; max is {self.MAX_REF_SECONDS}s. "
|
||||||
|
f"Send a shorter clip.")
|
||||||
|
return arr.astype(np.float32)
|
||||||
|
|
||||||
|
@torch.inference_mode()
|
||||||
|
def _audio_to_codes(self, arr):
|
||||||
|
wav = torch.from_numpy(arr).to(self.device)[None, None]
|
||||||
|
codes = self.snac.encode(wav)
|
||||||
|
c0, c1, c2 = codes[0][0].tolist(), codes[1][0].tolist(), codes[2][0].tolist()
|
||||||
|
n = min(len(c0), len(c1) // 2, len(c2) // 4)
|
||||||
|
out = []
|
||||||
|
for i in range(n):
|
||||||
|
out += [
|
||||||
|
c0[i] + self.AUDIO_OFFSET,
|
||||||
|
c1[2 * i] + self.AUDIO_OFFSET + 4096,
|
||||||
|
c2[4 * i] + self.AUDIO_OFFSET + 2 * 4096,
|
||||||
|
c2[4 * i + 1] + self.AUDIO_OFFSET + 3 * 4096,
|
||||||
|
c1[2 * i + 1] + self.AUDIO_OFFSET + 4 * 4096,
|
||||||
|
c2[4 * i + 2] + self.AUDIO_OFFSET + 5 * 4096,
|
||||||
|
c2[4 * i + 3] + self.AUDIO_OFFSET + 6 * 4096,
|
||||||
|
]
|
||||||
|
return out
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _dedup_frames(codes):
|
||||||
|
if not codes:
|
||||||
|
return codes
|
||||||
|
codes = codes[: (len(codes) // 7) * 7]
|
||||||
|
if len(codes) < 7:
|
||||||
|
return codes
|
||||||
|
result = codes[:7]
|
||||||
|
for i in range(7, len(codes), 7):
|
||||||
|
if codes[i] != result[-7]:
|
||||||
|
result.extend(codes[i:i + 7])
|
||||||
|
return result
|
||||||
|
|
||||||
|
# ------------------------------------------------------ prompt builders
|
||||||
|
def build_tts_prompt(self, text, speaker, mode, language):
|
||||||
|
lang_tag = self._lang_display(language) if mode == "translate" else None
|
||||||
|
tt = self._encode_text(text, speaker, lang_tag, add_bos=True)
|
||||||
|
return [self.START_OF_HUMAN] + tt + [self.END_OF_HUMAN,
|
||||||
|
self.START_OF_AI, self.START_OF_SPEECH]
|
||||||
|
|
||||||
|
def build_vc_prompt(self, ref_text, ref_codes, target_text, mode, language, method):
|
||||||
|
tag2 = self._lang_display(language) if mode == "translate" else None
|
||||||
|
tt1 = self._encode_text(ref_text, None, None, add_bos=True)
|
||||||
|
tt2 = self._encode_text(target_text, None, tag2, add_bos=False)
|
||||||
|
if method == "m1":
|
||||||
|
return ([self.START_OF_HUMAN] + tt1 + [self.END_OF_HUMAN,
|
||||||
|
self.START_OF_AI, self.START_OF_SPEECH] + ref_codes +
|
||||||
|
[self.END_OF_SPEECH, self.END_OF_AI,
|
||||||
|
self.START_OF_HUMAN] + tt2 + [self.END_OF_HUMAN,
|
||||||
|
self.START_OF_AI, self.START_OF_SPEECH])
|
||||||
|
return ([self.START_OF_HUMAN] + tt1 + tt2 + [self.END_OF_HUMAN,
|
||||||
|
self.START_OF_AI, self.START_OF_SPEECH] + ref_codes)
|
||||||
|
|
||||||
|
# --------------------------------------------------------- generation
|
||||||
|
def _generate(self, prompt_ids, params):
|
||||||
|
sampling = SamplingParams(
|
||||||
|
temperature = params["temperature"],
|
||||||
|
top_p = params["top_p"],
|
||||||
|
top_k = params["top_k"],
|
||||||
|
max_tokens = params["max_new_tokens"],
|
||||||
|
repetition_penalty = params["repetition_penalty"],
|
||||||
|
stop_token_ids = [self.END_OF_SPEECH, self.END_OF_AI],
|
||||||
|
detokenize = False,
|
||||||
|
)
|
||||||
|
outputs = self.model.generate({"prompt_token_ids": prompt_ids}, sampling)
|
||||||
|
return list(outputs[0].outputs[0].token_ids)
|
||||||
|
|
||||||
|
# ----------------------------------------------------------- decoding
|
||||||
|
@torch.inference_mode()
|
||||||
|
def _codes_to_wave(self, gen_ids):
|
||||||
|
"""Frame-validating SNAC decode: accepts only well-formed 7-token frames
|
||||||
|
(token k in slot-k range), resyncs on malformed spans."""
|
||||||
|
frames, i, n, resyncs = [], 0, len(gen_ids), 0
|
||||||
|
while i <= n - 7:
|
||||||
|
vals, ok = [], True
|
||||||
|
for k in range(7):
|
||||||
|
lo = self.AUDIO_OFFSET + k * 4096
|
||||||
|
t = gen_ids[i + k]
|
||||||
|
if not (lo <= t < lo + 4096):
|
||||||
|
ok = False
|
||||||
|
break
|
||||||
|
vals.append(t - lo)
|
||||||
|
if ok:
|
||||||
|
frames.append(vals)
|
||||||
|
i += 7
|
||||||
|
else:
|
||||||
|
i += 1
|
||||||
|
resyncs += 1
|
||||||
|
self._last_resyncs = resyncs
|
||||||
|
if not frames:
|
||||||
|
return None, 0
|
||||||
|
l1 = [f[0] for f in frames]
|
||||||
|
l2, l3 = [], []
|
||||||
|
for f in frames:
|
||||||
|
l2.append(f[1]); l3.append(f[2]); l3.append(f[3])
|
||||||
|
l2.append(f[4]); l3.append(f[5]); l3.append(f[6])
|
||||||
|
tensors = [
|
||||||
|
torch.tensor(l1)[None].to(self.device),
|
||||||
|
torch.tensor(l2)[None].to(self.device),
|
||||||
|
torch.tensor(l3)[None].to(self.device),
|
||||||
|
]
|
||||||
|
wav = self.snac.decode(tensors).squeeze().detach().cpu().numpy()
|
||||||
|
return wav, len(frames)
|
||||||
|
|
||||||
|
def _wave_to_b64_raw(self, wav):
|
||||||
|
"""Legacy parity: base64 of raw little-endian PCM buffer, no container."""
|
||||||
|
return base64.b64encode(
|
||||||
|
np.ascontiguousarray(wav.astype(self.RAW_DTYPE)).tobytes()
|
||||||
|
).decode("utf-8")
|
||||||
|
|
||||||
|
# -------------------------------------------------------------- entry
|
||||||
|
def __call__(self, data):
|
||||||
|
try:
|
||||||
|
target_text = data.get("inputs")
|
||||||
|
if not target_text:
|
||||||
|
return {"error": "Missing 'inputs' (target text)."}
|
||||||
|
|
||||||
|
p = data.get("parameters", {}) or {}
|
||||||
|
task = str(p.get("task", "tts")).lower()
|
||||||
|
mode = str(p.get("mode", "vanilla")).lower()
|
||||||
|
method = str(p.get("method", "m2")).lower()
|
||||||
|
if mode in ("translation", "trans"):
|
||||||
|
mode = "translate"
|
||||||
|
|
||||||
|
if task not in ("tts", "vc"):
|
||||||
|
return {"error": "parameters.task must be 'tts' or 'vc'."}
|
||||||
|
if mode not in ("vanilla", "translate"):
|
||||||
|
return {"error": "parameters.mode must be 'vanilla' or 'translate'."}
|
||||||
|
if mode == "translate" and not p.get("language"):
|
||||||
|
return {"error": "parameters.language is required for translate mode."}
|
||||||
|
|
||||||
|
gen_params = {
|
||||||
|
"temperature": float(p.get("temperature", 0.6)),
|
||||||
|
"top_p": float(p.get("top_p", 0.95)),
|
||||||
|
"top_k": int(p.get("top_k", 50)),
|
||||||
|
"max_new_tokens": int(p.get("max_new_tokens", 1200)),
|
||||||
|
"repetition_penalty": float(p.get("repetition_penalty", 1.1)),
|
||||||
|
}
|
||||||
|
if not 0 < gen_params["top_p"] <= 1:
|
||||||
|
return {"error": "top_p must be within (0, 1]."}
|
||||||
|
if not (gen_params["top_k"] == -1 or gen_params["top_k"] > 0):
|
||||||
|
return {"error": "top_k must be -1 (disabled) or a positive integer."}
|
||||||
|
if not 0 < gen_params["repetition_penalty"] <= 2:
|
||||||
|
return {"error": "repetition_penalty must be within (0, 2]."}
|
||||||
|
if gen_params["max_new_tokens"] <= 0:
|
||||||
|
return {"error": "max_new_tokens must be positive."}
|
||||||
|
|
||||||
|
if task == "vc":
|
||||||
|
ref_text = p.get("reference_text")
|
||||||
|
ref_audio = p.get("reference_audio")
|
||||||
|
if not ref_text or not ref_audio:
|
||||||
|
return {"error": "VC requires parameters.reference_text and "
|
||||||
|
"parameters.reference_audio (base64)."}
|
||||||
|
if method not in ("m1", "m2"):
|
||||||
|
return {"error": "parameters.method must be 'm1' or 'm2'."}
|
||||||
|
ref_wave = self._b64_to_wave(ref_audio)
|
||||||
|
ref_codes = self._dedup_frames(self._audio_to_codes(ref_wave))
|
||||||
|
if not ref_codes:
|
||||||
|
return {"error": "Reference audio produced no SNAC codes."}
|
||||||
|
prompt_ids = self.build_vc_prompt(
|
||||||
|
ref_text, ref_codes, target_text, mode, p.get("language"), method)
|
||||||
|
else:
|
||||||
|
prompt_ids = self.build_tts_prompt(
|
||||||
|
target_text, p.get("voice") or p.get("speaker"),
|
||||||
|
mode, p.get("language"))
|
||||||
|
|
||||||
|
budget = self.MAX_MODEL_LEN - gen_params["max_new_tokens"]
|
||||||
|
if len(prompt_ids) > budget:
|
||||||
|
return {"error": f"Prompt is {len(prompt_ids)} tokens; exceeds budget "
|
||||||
|
f"{budget} (max_model_len - max_new_tokens). "
|
||||||
|
f"Shorten the reference clip or text."}
|
||||||
|
|
||||||
|
gen_ids = self._generate(prompt_ids, gen_params)
|
||||||
|
wav, n_frames = self._codes_to_wave(gen_ids)
|
||||||
|
if wav is None:
|
||||||
|
return {"error": "Model generated no audio tokens.",
|
||||||
|
"input_tokens": len(prompt_ids),
|
||||||
|
"generated_tokens": len(gen_ids)}
|
||||||
|
|
||||||
|
return {
|
||||||
|
"audio_b64": self._wave_to_b64_raw(wav), # RAW float32 PCM (legacy parity)
|
||||||
|
"audio_dtype": np.dtype(self.RAW_DTYPE).name,
|
||||||
|
"sample_rate": self.SNAC_SR,
|
||||||
|
"duration_seconds": round(len(wav) / self.SNAC_SR, 3),
|
||||||
|
"audio_frames": n_frames,
|
||||||
|
"input_tokens": len(prompt_ids),
|
||||||
|
"generated_tokens": len(gen_ids),
|
||||||
|
"task": task, "mode": mode,
|
||||||
|
"method": method if task == "vc" else None,
|
||||||
|
"decode_resyncs": getattr(self, "_last_resyncs", 0),
|
||||||
|
}
|
||||||
|
|
||||||
|
except ValueError as e:
|
||||||
|
return {"error": str(e)}
|
||||||
|
except Exception as e:
|
||||||
|
traceback.print_exc()
|
||||||
|
return {"error": str(e)}
|
||||||
3
model-00001-of-00002.safetensors
Normal file
3
model-00001-of-00002.safetensors
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:1f6b83b76b0d948855df921a51f919d29d732f13132ba9d394c2137ebf0d3997
|
||||||
|
size 4991037968
|
||||||
3
model-00002-of-00002.safetensors
Normal file
3
model-00002-of-00002.safetensors
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:db2e111d97dbf419e6eb06b5d867ba01f46c62bcac43be8f23f01fa2e4e9c62b
|
||||||
|
size 1610725592
|
||||||
261
model.safetensors.index.json
Normal file
261
model.safetensors.index.json
Normal file
@@ -0,0 +1,261 @@
|
|||||||
|
{
|
||||||
|
"metadata": {
|
||||||
|
"total_size": 6601734144
|
||||||
|
},
|
||||||
|
"weight_map": {
|
||||||
|
"model.embed_tokens.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.0.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.0.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.0.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.0.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.0.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.0.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.0.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.0.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.0.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.1.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.1.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.1.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.1.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.1.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.1.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.1.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.1.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.1.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.10.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.10.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.10.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.10.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.10.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.10.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.10.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.10.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.10.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.11.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.11.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.11.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.11.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.11.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.11.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.11.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.11.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.11.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.12.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.12.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.12.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.12.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.12.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.12.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.12.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.12.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.12.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.13.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.13.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.13.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.13.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.13.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.13.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.13.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.13.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.13.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.14.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.14.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.14.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.14.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.14.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.14.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.14.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.14.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.14.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.15.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.15.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.15.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.15.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.15.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.15.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.15.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.15.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.15.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.16.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.16.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.16.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.16.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.16.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.16.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.16.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.16.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.16.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.17.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.17.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.17.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.17.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.17.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.17.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.17.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.17.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.17.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.18.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.18.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.18.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.18.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.18.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.18.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.18.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.18.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.18.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.19.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.19.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.19.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.19.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.19.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.19.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.19.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.19.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.19.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.2.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.2.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.2.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.2.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.2.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.2.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.2.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.2.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.2.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.20.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.20.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.20.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.20.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.20.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.20.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.20.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.20.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.20.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.21.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.21.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.21.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.21.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.21.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.21.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.21.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.21.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.21.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.22.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.22.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.22.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.22.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.22.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.22.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.22.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.22.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.22.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.23.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.23.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.23.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.23.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.23.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.23.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.23.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.23.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.23.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.24.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.24.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.24.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.24.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.24.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.24.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.24.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.24.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.24.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.25.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.25.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.25.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.25.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.25.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.25.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.25.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.25.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.25.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.26.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.26.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.26.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.26.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.26.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.26.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.26.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.26.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.26.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.27.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.27.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.27.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.27.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.27.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.27.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.27.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.27.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.27.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.3.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.3.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.3.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.3.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.3.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.3.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.3.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.3.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.3.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.4.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.4.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.4.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.4.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.4.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.4.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.4.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.4.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.4.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.5.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.5.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.5.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.5.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.5.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.5.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.5.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.5.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.5.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.6.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.6.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.6.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.6.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.6.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.6.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.6.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.6.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.6.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.7.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.7.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.7.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.7.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.7.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.7.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.7.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.7.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.7.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.8.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.8.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.8.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.8.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.8.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.8.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.8.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.8.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.8.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.9.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.9.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.9.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.9.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.9.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.9.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.9.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.9.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.9.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.norm.weight": "model-00002-of-00002.safetensors"
|
||||||
|
}
|
||||||
|
}
|
||||||
19
requirements.txt
Normal file
19
requirements.txt
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
--extra-index-url https://download.pytorch.org/whl/cu121
|
||||||
|
transformers==4.51.3
|
||||||
|
accelerate==1.6.0
|
||||||
|
|
||||||
|
vllm==0.8.5.post1
|
||||||
|
torch==2.6.0
|
||||||
|
torchaudio==2.6.0
|
||||||
|
torchvision==0.21.0
|
||||||
|
triton==3.2.0
|
||||||
|
xformers==0.0.29.post2
|
||||||
|
|
||||||
|
numpy==1.26.4
|
||||||
|
protobuf==4.25.3
|
||||||
|
snac==1.2.1
|
||||||
|
diffusers==0.30.3
|
||||||
|
|
||||||
|
starlette<1.0
|
||||||
|
librosa==0.10.2.post1
|
||||||
|
soundfile==0.12.1
|
||||||
3
tokenizer.json
Normal file
3
tokenizer.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:fc3fecb199b4170636dbfab986d25f628157268d37b861f9cadaca60b1353bce
|
||||||
|
size 22849547
|
||||||
231538
tokenizer_config.json
Normal file
231538
tokenizer_config.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user