codemo/fish-speech-1
0
1from typing import Annotated, Literal, Optional2 3from pydantic import BaseModel, Field, conint4 5 6class ServeReferenceAudio(BaseModel):7 audio: bytes8 text: str9 10 11class ServeTTSRequest(BaseModel):12 text: str13 chunk_length: Annotated[int, conint(ge=100, le=300, strict=True)] = 20014 # Audio format15 format: Literal["wav", "pcm", "mp3"] = "wav"16 mp3_bitrate: Literal[64, 128, 192] = 12817 # References audios for in-context learning18 references: list[ServeReferenceAudio] = []19 # Reference id20 # For example, if you want use https://fish.audio/m/7f92f8afb8ec43bf81429cc1c9199cb1/21 # Just pass 7f92f8afb8ec43bf81429cc1c9199cb122 reference_id: str | None = None23 # Normalize text for en & zh, this increase stability for numbers24 normalize: bool = True25 mp3_bitrate: Optional[int] = 6426 opus_bitrate: Optional[int] = -100027 # Balance mode will reduce latency to 300ms, but may decrease stability28 latency: Literal["normal", "balanced"] = "normal"29 # not usually used below30 streaming: bool = False31 emotion: Optional[str] = None32 max_new_tokens: int = 102433 top_p: Annotated[float, Field(ge=0.1, le=1.0, strict=True)] = 0.734 repetition_penalty: Annotated[float, Field(ge=0.9, le=2.0, strict=True)] = 1.235 temperature: Annotated[float, Field(ge=0.1, le=1.0, strict=True)] = 0.736 