Repository navigation
Conversation
… as starcoder2 MOSS-TTS-Nano's global transformer is a GPT-2 with RoPE: pre-LN LayerNorm with bias, biased q/k/v/o and gelu_new FFN, final LayerNorm, no position table. That is llama.cpp's stock starcoder2, so no arch patch: c_attn splits into q/k/v, and q/k rows and biases are reordered per head from the interleaved rotation to NEOX. The SentencePiece BPE tokenizer goes in as the SPM vocab; its nmt_nfkc normalizer is applied by the family. Hidden state vs PyTorch on a 331-row voice-clone prompt: rel 4e-4 (F32 weights), 4e-3 (BF16, the checkpoint's precision). Sampling: the reference's audio settings (temp 1.7, top_k 25, top_p 0.8, temperature first). Co-Authored-By: Claude Opus 5.5 <[email protected]>
The local transformer (1 GPT-2 layer over 17 positions per frame) is a residual_depth_ar depth decoder that emits codebook 0: the text slot (assistant slot / audio end, from the tied wte head), then the 16 RVQ codes. New metadata, generic to the kind: - codec.lm.depth.arch = "gpt2": LayerNorm with shift, biased q/k/v/o, gelu_new FFN; one block helper for the KV and prefix-recompute paths. - codec.lm.residual.heads_tied_to_embd: head i is input table i. - codec.lm.cb0_allowed: the only codebook-0 ids ever sampled. - codec.lm.audio_cb_offset: leading text codebooks dropped before decode. The converter keeps wte's 16 control rows as the text table (the depth decoder reads and picks only control tokens), bakes the prompt template as token ids (the reference encodes each piece on its own) and the tokenizer's nmt_nfkc charsmap; it now reads pytorch_model.bin LM sources. The GGUF writer gains UINT8 arrays. Teacher-forced frame 0 vs PyTorch (BF16 weights): all 17 argmaxes match, logits max |d| <= 0.05 on |logit| ~10. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A MOSS-TTS-Nano voice is the reference clip's codes, which the LM prompt embeds. codec_speaker_from_audio on a MOSS-Audio-Tokenizer GGUF runs one graph: torchaudio-style sinc resample to the codec rate, mono copied to every interleaved channel, zero pad to the hop, encoder + quantizer, and keeps floor(n / hop) frames as the reference does. The slot is `ref_codes` I32 [n_q, T]. Only GGUFs converted with a MOSS-TTS-Nano LM source carry `moss_audio_tokenizer.spk.encoder_hash` (encoder + quantizer weights and the preprocessing) and offer it. Codes vs the reference's batch_encode on the zh / ja / en eval clips: 96% (F32 codec), the same as plain codec_encode on the reference's own resampled audio; the misses are deep RVQ levels. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The moss_tts_nano family builds the reference's voice-clone prompt (prompting.py): baked template token ids, the reference clip's codes as [user_slot, codes] embedding rows, the text normalized with the tokenizer's nmt_nfkc charsmap (src/lm/moss_tts_nano.cpp) and tokenized by the backbone's SPM vocab; without a voice, "None" stands in for the reference section. Per frame the depth decoder samples the text slot (assistant slot / audio end) and the 16 codes; the audio end stops before any code is drawn, as the reference breaks. Text above ~50 tokens is split at clauses (150 bytes) and joined with the reference's 0.24 s pause; max_frames defaults to 300. `codec.lm.audio_cb_offset` drops the text slot before decode. All-F32 greedy run on the zh voice-clone prompt (reference codes, PyTorch input ids): the first 34 frames (17 tokens each) equal PyTorch's greedy generate, then float noise flips a near-tie. The normalizer + llama.cpp tokenization equals SentencePiece on all 18 test texts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reference samples the text slot (assistant slot vs audio end) at its own temperature 1.5 / top_p 1, the codebooks at 1.7 / top_k 25 / top_p 0.8. A host applies one setting to every codec-side head, and under the codebooks' top_p the audio end cannot be drawn while its probability is below 0.2: generations ran on past the text (ja up to 2.5x the reference's length). The family now draws the slot from its two logits at codec.lm.moss_tts_nano.text_temperature (1.5, written by the converter; <= 0 = argmax) with its own stream seeded by codec_audio_lm_set_seed, and hands the host a one-hot head. Durations now match the reference's. Co-Authored-By: Claude Opus 5.5 <[email protected]>
tests/e2e/moss_tts_nano_smoke.py drives codec_cpp: the voice's ref_codes shape, voice-clone synthesis of an English and a Chinese sentence (stop on the audio end, 48 kHz, duration, level, Whisper CER), and with MOSS_TTS_NANO_SRC (+ MOSS_AUDIO_TOKENIZER_SRC) the PyTorch parity of the depth decoder's frame 0 (17/17 argmax, max |d| 0.04) and of the voice codes. ttscli_synthesize_smoke and python_tts_smoke gain a moss_tts_nano case (the Python host matches tts-cli to 1 LSB). Co-Authored-By: Claude Opus 5.5 <[email protected]>
docs/models/moss_tts_nano.md: conversion, the backbone / depth decoder / codec split, the prompt and frame loop, the voice, the model-side text slot draw, stage parity vs PyTorch, and the multi-seed read-back (zh / ja / en / zh in an en voice) next to the reference's on the same seeds, with host RTF. codec_lm.md documents the gpt2 depth block and the new residual_depth_ar keys; codec_common_api.md, codec_speaker.md and model_status.md gain the model's rows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ct; smoke reports CER model_status: 🟡 like the other seed-fragile models (sampled output varies a lot by seed, as the reference's). codec_common_api's sampling section names the one model-side draw (the MOSS-TTS-Nano text slot). The model notes add the family-path greedy parity (244 / 300 frames equal), the no-voice / speaker-file / streaming runs, the F16 voice-code range, and that the two sides' seeds are not the same draws. The smoke reports the sampled Whisper CER instead of asserting it and documents the F16 codec conversion. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…op draw - The family factory is declared at its only call site (audio_lm_family.cpp), so common/audio_lm_family.h is back to main. - The text slot (the stop decision) stays drawn in the family from the host's seed. The reference samples it at 1.5 / top_p 1.0 between two logits; a host chain applies top_p before the temperature, so no logit scaling reproduces it. Measured over 5 seeds x 70 utterances: host sampling with scaled logits gives Japanese clips of 20.8 s vs the reference's 11.7 s, and the smoke's English sentence ran to the frame cap. docs/models/moss_tts_nano.md has the table. - docs/proposals/head-group-sampling.md: per-head-group sampler settings, the public API change that would move the draw to the host. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…uired setting The library-side draw of the text slot goes. The family offers the host the two candidates (assistant slot, audio end) as their log-probabilities at the reference's text_temperature 1.5, scaled by the host temperature (codec.lm.moss_tts_nano.audio_temperature = 1.7). The host chain (temperature;top_k;top_p) then reproduces the reference's draw exactly when top_p is 1.0, which becomes the model's required setting (general.sampling.top_p from the converter; the smoke passes it explicitly). Measured over 5 seeds x 70 utterances: no clip runs past 20 s, lengths are within the reference's, and read-back error is at or below the reference on all four sets. 25 candidates with dummy tokens under the card's top_p 0.8 still ran long (ja 19.9 s vs 11.7 s). The head-group sampling proposal is dropped. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ano stop is host-sampled) Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MOSS-TTS-Nano-100M:
residual_depth_ar;ref_codes;tts-cli synthesizeworks with it.Public headers (
include/,common/*.h): no changes.Stop decision: host-sampled, and
top_p 1.0is a required setting. In the reference,_sample_next_assistant_text_tokensamples continue vs<|audio_end|>at temperature 1.5 with no top_p. The family hands the host those two candidates as log-probabilities at 1.5, multiplied by 1.7. The host chain (temperature;top_k;top_p, temp 1.7) then reproduces the reference draw exactly when top_p is 1.0.The converter writes the required settings into
general.sampling.*(temp 1.7, top_k 25, top_p 1.0, min_p 0), and the smoke test passes them explicitly. There is no library-side draw and no second sampler.5 seeds × 70 utterances, F16 codec (read-back error / mean length / clips over 20 s):
Full tables are in
docs/models/moss_tts_nano.md.🤖 Generated with Claude Code