refactor(backend): 启动环境初始化与资源项目化(零跨项目依赖)

- main.py:uv run main.py 一键启动——读取 backend/.env、TORCH_HOME/NLTK_DATA 指向项目内缓存、certifi SSL + NO_PROXY 网络直连、默认开启 s2s,启动横幅
- vendor/:补丁后 s2s 云化栈移入项目(backend/vendor/s2s-cloud),pyproject sources 改相对路径
- .gitignore:忽略 .torch-cache / nltk_data 缓存
- AGENTS.md:进程管理铁律(AI 不启动/重启服务,由用户操作)
This commit is contained in:
Pine
2026-08-18 01:37:57 +08:00
parent 41e9681aa0
commit 7f25c8f6bb
198 changed files with 44792 additions and 4 deletions
@@ -0,0 +1,17 @@
from dataclasses import dataclass, field
@dataclass
class MeloTTSHandlerArguments:
melo_language: str = field(
default="en",
metadata={"help": "The language of the text to be synthesized. Default is 'EN_NEWEST'."},
)
melo_device: str = field(
default="auto",
metadata={"help": "The device to be used for speech synthesis. Default is 'auto'."},
)
melo_speaker_to_id: str = field(
default="en",
metadata={"help": "Mapping of speaker names to speaker IDs. Default is ['EN-Newest']."},
)
@@ -0,0 +1,68 @@
from dataclasses import dataclass, field
from typing import Optional
@dataclass
class ParlerTTSHandlerArguments:
tts_model_name: str = field(
default="parler-tts/parler-mini-v1-jenny",
metadata={
"help": "The pretrained TTS model to use. Default is 'parler-tts/parler-mini-v1-jenny'."
},
)
tts_device: str = field(
default="cuda",
metadata={
"help": "The device type on which the model will run. Default is 'cuda' for GPU acceleration."
},
)
tts_torch_dtype: str = field(
default="float16",
metadata={
"help": "The PyTorch data type for the model and input tensors. One of `float32` (full-precision), `float16` or `bfloat16` (both half-precision)."
},
)
tts_compile_mode: Optional[str] = field(
default=None,
metadata={
"help": "Compile mode for torch compile. Either 'default', 'reduce-overhead' and 'max-autotune'. Default is None (no compilation)"
},
)
tts_gen_min_new_tokens: int = field(
default=64,
metadata={
"help": "Maximum number of new tokens to generate in a single completion. Default is 64, which corresponds to ~0.74 secs"
},
)
tts_gen_max_new_tokens: int = field(
default=1024,
metadata={
"help": "Maximum number of new tokens to generate in a single completion. Default is 1024, which corresponds to ~12 secs"
},
)
description: str = field(
default=(
"Jenny speaks at a slightly slow pace with an animated delivery with clear audio quality."
),
metadata={
"help": "Description of the speaker's voice and speaking style to guide the TTS model."
},
)
play_steps_s: float = field(
default=1.0,
metadata={
"help": "The time interval in seconds for playing back the generated speech in steps. Default is 1.0 seconds."
},
)
max_prompt_pad_length: int = field(
default=8,
metadata={
"help": "When using compilation, the prompt as to be padded to closest power of 2. This parameters sets the maximun power of 2 possible."
},
)
use_default_speakers_list: bool = field(
default=False,
metadata={
"help": "Whether to use the default list of speakers or not."
},
)