diff --git a/arch/fishomni/fishomni.cpp b/arch/fishomni/fishomni.cpp index 8217af63..aec0d6e7 100644 --- a/arch/fishomni/fishomni.cpp +++ b/arch/fishomni/fishomni.cpp @@ -84,10 +84,13 @@ constexpr int64_t kCodes = 10, kVocab = 4096, kResVocab = 1024; constexpr int64_t kEos = 248046, kSemBegin = 248099, kSemEnd = 252194, kCand = kVocab + 1; /* The tower: four shared layers, then one a codebook after the first. */ constexpr int kShared = 4, kTower = kShared + (int)kCodes - 1; -/* fish-speech's server and SDK defaults (sampling.py), the technical report's evaluation - * settings: temperature 0.7, top-p 0.7, top-k 30, for the main token and every head alike. */ -constexpr int64_t kTopK = 30; -static const double kTemp = 0.7, kTopP = 0.7; +/* The draws: temperature 1.0 and top-p 0.9, the settings of Fish Audio's model card, for the main + * token and every head; the main token uncapped (256, cfg_topk_sample's widest) and each head at + * top-k 30, as SGLang-Omni draws them. fish-speech's server defaults (0.7, 0.7, 30 for both) make + * the model fall silent after a tag or a speaker's line and never come back: over 40 takes of + * four short scripts, 8 ran to their length in silence against none here (docs/ARCHITECTURES.md). */ +constexpr int64_t kMainTopK = 256, kHeadTopK = 30; +static const double kTemp = 1.0, kTopP = 0.9; /* The repetition-aware redraw, fixed by the training recipe (tower.py): when the first draw is * semantic and among the last 16 main tokens, a second draw at temperature 1, top-p 0.95, * top-k 30 is taken instead. */ @@ -717,7 +720,7 @@ static int declare_frame_head(RadBuilder* b, Model& m) { RAD_INT("n_embd", D), RAD_STR("dtype", "bf16")), RAD_WEIGHTS(m.w_cand)), { m.b_plane }, { m.b_slog }); - m.op_samp = draw_op(b, S, kCand, kTopK, kTemp, kTopP, 0, m.b_slog, m.b_first); + m.op_samp = draw_op(b, S, kCand, kMainTopK, kTemp, kTopP, 0, m.b_slog, m.b_first); m.op_samp_ras = draw_op(b, S, kCand, kRasTopK, kRasTemp, kRasTopP, 1, m.b_slog, m.b_alt); /* The redraw: only a semantic first draw (candidates 1..4096), and only one the lane's last * 16 picks hold; the prompt's rows are text, so its window starts empty (op_rasinit). */ @@ -961,7 +964,7 @@ static int declare_tower(RadBuilder* b, const RadModelMeta* meta, Model& m) { RAD_INT("n_embd", D), RAD_STR("dtype", "bf16")), RAD_WEIGHTS(L.w_head)), { m.b_tho }, { m.b_hlog }); - L.op_samp = draw_op(b, S, kVocab, kTopK, kTemp, kTopP, 2 + k, m.b_hlog, m.b_codes); + L.op_samp = draw_op(b, S, kVocab, kHeadTopK, kTemp, kTopP, 2 + k, m.b_hlog, m.b_codes); if (!L.w_head || !L.op_head || !L.op_samp) return RAD_E_INVAL; } } @@ -1374,11 +1377,11 @@ static int declare(RadBuilder* b, const RadModelMeta* meta, const RadBuildCtx* c (long long)m.moecfg.top_k, kTower, (long long)m.n_main, (long long)(m.n_main + kTower - 1), (long long)m.gt.n_head, (long long)m.gt.n_ff, (int)kCtLayers, (long long)m.lanes); - rad_note(b, "sampling: temperature %.2f, top-p %.2f, top-k %lld for the main token and every " - "head; a semantic first draw among the lane's last %lld picks is redrawn at " - "temperature %.2f, top-p %.2f, top-k %lld", - kTemp, kTopP, (long long)kTopK, (long long)kRasWin, kRasTemp, kRasTopP, - (long long)kRasTopK); + rad_note(b, "sampling: temperature %.2f, top-p %.2f for every draw, top-k %lld for the main " + "token and %lld for each head; a semantic first draw among the lane's last %lld " + "picks is redrawn at temperature %.2f, top-p %.2f, top-k %lld", + kTemp, kTopP, (long long)kMainTopK, (long long)kHeadTopK, (long long)kRasWin, + kRasTemp, kRasTopP, (long long)kRasTopK); return RAD_OK; } diff --git a/docs/ARCHITECTURES.md b/docs/ARCHITECTURES.md index 4e23659c..0774c1d8 100644 --- a/docs/ARCHITECTURES.md +++ b/docs/ARCHITECTURES.md @@ -1340,9 +1340,9 @@ tower 13 layers bound as layers 40..52 of the backbone's full-attention KV g wqkv's rows [Q 4096 | G 4096 | K 512 | V 512], (1 + w) q/k norms, GPT-J rotary on 64 dims at 1e7, attention * sigmoid(gate), SwiGLU 6144), a final (1 + w) norm. The first shared layer also adds the input frame's codes 2..9, embedded and summed in f32 -sampling fish-speech's server defaults: temperature 0.7, top-p 0.7 over the whole candidate set, - then top-k 30, for the main token and every head; a semantic first draw among the - lane's last 16 picks is redrawn at 1.0 / 0.95 / 30 (`ras_pick`) +sampling temperature 1.0, top-p 0.9 over the whole candidate set, then the top-k: the main + token uncapped (256) and each head 30, as SGLang-Omni draws; a semantic first draw + among the lane's last 16 picks is redrawn at 1.0 / 0.95 / 30 (`ras_pick`) codec Fish S2's modified DAC decoder: ten raw codebook rows of 8 (one of 4096, nine of 1024, codes 1..9 clamped to 1023), each through its own weight-normed 1x1 projection to 1024 and summed; 8 layers of 1024 (16 heads of 64, GPT-J rotary on all 64 at theta 1e4, @@ -1386,7 +1386,8 @@ Traps (each still speaks, wrongly): - **The input is written as fish-speech's server writes it**: each speaker's turn `<|speaker:N|> ` and its text stripped, turns joined by a newline, untagged text speaker 0's. The same two turns joined by a space are spoken through far less often: for one two-line script, - one seed in six spoke both lines, against seven in ten with the newline. + at fish-speech's sampling, one seed in six spoke both lines, against seven in ten with the + newline. Against fish-speech's own PyTorch code (the CPU path: experts fp8, dequantised per forward, so W8A16 where radiance runs W8A8), teacher-forced with radiance's codes over a 34-row prompt and 80 @@ -1398,11 +1399,22 @@ over the 79 frames that are spoken. Through the codec, radiance's chunked bf16 d from the reference's whole-utterance bf16 decode of the same codes. Qwen3-ASR transcribes radiance's speech word for word. -The model's own failure is to stop after the first line of a script, or to fall silent until the -length runs out (vLLM-Omni's recipe and SGLang-Omni's notes describe it). Over 20 seeds of two -invented two-speaker lines, the second speaker was spoken in 14 and 17 of 20, and 2 and 3 takes ran -past 8 s; at a main top-k of 256 instead of 30 it was 14 and 15, with 5 long takes each, so the -reference's 30 stays. +The sampling is not fish-speech's server's (temperature 0.7, top-p 0.7, top-k 30 for every draw). +At those the model falls silent after a tag or a speaker's line and does not come back, the failure +vLLM-Omni's recipe and SGLang-Omni's notes describe; SGLang-Omni's comment puts it on the main +token's top-k cap, and the counts bear it out. Ten seeds each of four short scripts (an aside in +``, two two-speaker exchanges, a plain sentence), complete by Qwen3-ASR, and stuck (run to +the 400-frame limit in silence): + +| temperature, top-p, top-k (main / heads) | complete | stuck | +|---|---|---| +| 0.7, 0.7, 30 / 30 (fish-speech's server) | 28 / 40 | 8 / 40 | +| 1.0, 0.9, 30 / 30 (Fish Audio's model card) | 35 / 40 | 2 / 40 | +| 1.0, 0.9, 256 / 30 (SGLang-Omni) | 36 / 40 | 0 / 40 | + +The four misses at the last setting are a take that ended before the line after the whisper (twice), +a second speaker's single word, and one word the recogniser misheard; the whispered line itself is +spoken in all ten. A take still pauses a second or so around an aside. On two R9700s a sentence is made at 0.30 of the time it plays (3.67 s of speech in 1.08 s, 13.5 ms a frame with the codec), a paragraph at 0.29 (11.6 s in 3.34 s); a stream's first audio comes diff --git a/docs/GUIDE.md b/docs/GUIDE.md index bb85198e..b183f376 100644 --- a/docs/GUIDE.md +++ b/docs/GUIDE.md @@ -2475,10 +2475,11 @@ curl -s http://localhost:8000/v1/audio/speech -H 'Content-Type: application/json cloning a voice from a recording is not served yet. - **The length** is `duration` in seconds or `max_new_tokens` in frames (21.5 a second), up to 95 s; the model ends the speech at the end of the script. The prompt holds at most 2048 tokens. -- **Sampling** is fish-speech's server's: temperature 0.7, top-p 0.7, top-k 30, with its - repetition-aware redraw of the first code. A take sometimes stops after its first line or falls - silent until its length runs out (the model's own failure, more often with several speakers); - another `seed` usually speaks the whole script. +- **Sampling** is SGLang-Omni's: temperature 1.0 and top-p 0.9 (Fish Audio's model card), the + first code uncapped and each later code at top-k 30, with fish-speech's repetition-aware redraw + of the first code. fish-speech's server samples at 0.7, 0.7 and 30, where the model often falls + silent after a tag or a speaker's line and runs to its length (docs/ARCHITECTURES.md has the + counts). A take can still end before its last line; another `seed` usually speaks it all. - **`seed`**, **`response_format`**, **`speed`** and **`voice`** are read as for music below. Speech is played sixteen frames (0.74 s) at a time as it is made. On two R9700s a sentence is made