Add neutts_nano_tts#21
Draft
jathinsn27 wants to merge 1 commit into
Draft
Conversation
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.
Summary
This PR for iOS integration of the NeuTTS Nano text-to-speech model, enabling on-device speech synthesis with voice cloning capabilities. The implementation includes a three-stage pipeline (Backbone → Encoder → Decoder), custom tokenization matching Hugging Face's ByteLevel BPE tokenizer, and integration of
espeak-ngfor phonemization. Cross-compiling native libraries for iOS and aligning model inputs/outputs with the 3 models from ZeticMLange SDK.1. NeuTTS Nano Architecture Overview
Components:
neutts_nano): A language model that generates discrete speech tokens from phonemized textneucodec-encoder): Converts reference audio to discrete codes for voice cloningneucodec-decoder): Converts discrete codes back to raw audio waveforms2. Model Input/Output Specifications
2.1 Backbone Model (
neutts_nano)Input:
input_ids:[1, 128]shape,int32dtype<|start_header_id|>,<|end_header_id|>,<|speech_###|>"<|start_header_id|>user<|end_header_id|>\n\n{phonemes}<|speech_###|>"attention_mask:[1, 128]shape,int32dtypeOutput:
[1, 128, vocab_size]shape,float32dtype<|speech_###|>where###represents discrete audio codes2.2 Encoder Model (
neucodec-encoder)Input:
audio:[1, 1, 16000]shape,float32dtypeOutput:
codes:[1, 1, 50]shape,int32dtype2.3 Decoder Model (
neucodec-decoder)Input:
codes:[1, 1, 50]shape,int64dtypeOutput:
audio:[1, 1, 24000]shape,float32dtype4. Phonemization with Espeak-ng
Initial Approach:
transformerslibrary tokenizer directlyPhonemization Process:
Similar implementation of how its done by neutts: https://github.com/neuphonic/neutts/blob/main/neutts/neutts.py#L11
The phonemes are then tokenized and fed into the backbone model.
Build Settings:
libespeak-ng.ato "Link Binary With Libraries"-DESPEAK_AVAILABLEto "Other Swift Flags"