[RNE Rewrite] feat: add supertonic TTS pipeline - #1317
Conversation
| */ | ||
| synthesize: ( | ||
| text: string, | ||
| options: SupertonicTtsOptions<K> |
There was a problem hiding this comment.
What is our convention right now, when do we use opts and when options?
There was a problem hiding this comment.
In all task pipeline implementations we use options right now for user-facing API. In helpers we mostly use opts but there are some inconsistencies there. I think we should make them all use one or the other (which one would you prefer?), but this can be done in a follow-up style PR.
There was a problem hiding this comment.
I'm in favour of options everywhere. Opts suffixes in config object field and types are fine I guess. Also when we add PR with refactor we should add note in core-guidelines/SKILL.md.
|
When I set the slowest speed aka 0.7 I got in half of the cases strange artefacts with repetitions of some parts of sentences. Exact parameters for reproduction: Sentence: "Cześć co tam słychać? Testuję funkcje mowy w naszej demo aplikacji." EDIT: When I tested the same configuration but with speed 2.0, the results were even worse :(( |
Yeah, from my experiments the extreme values for speed are often hit-or-miss depending on the voice and text to synthesize. I checked the Transformers.js implementation of Supertonic (https://huggingface.co/spaces/webml-community/Supertonic-TTS-WebGPU) and they only allow speeds in [0.8; 1.2]. This is a limitation of the model I believe so we can narrow the available speed range. |
|
Yeah, I'm in favour of limiting speed min and max. |
msluszniak
left a comment
There was a problem hiding this comment.
LGTM! If this PR is fine for you @IgorSwat ,we just need to rebase it with resource fetcher PR and ship :))
There was a problem hiding this comment.
Text partitioner in this form is unacceptable. It's not prioritizing low latency (time to first audio chunk) as the old one does. And it will hurt the performance (particularly for Kokoro) very seriously.
I would just add a mechanic (like a flag or smth) that if set, makes the algorithm prioritize splitting heavily at the beginning and slowly disable it as we process more and more of text.
|
For Kokoro, there will be a separate flow I guess, since these models are too specific to support them both under same functionality. |
In current codebase same TextPartitioner is used for both. And works fine. |
…rettify DP comment
…ate in Supertonic TTS
… text preprocessing
…s in textPartitioner
… text partitioner
I've added the configurable mechanism to prioritize splitting at the beginning and also made other options of the partitioner configurable. |
|
@barhanc Would we share partitioner part across supertonic and kokoro? |
|
Yes, right now it is very similar to the main branch one, and configurable options make it adjustable for different models. |
|
Thank you @IgorSwat for this on point observation. Please check if now everything is fine. Btw, maybe you want to add Kokoro to the new flow as a flow-up? ;) |
|
I will adjust my Kokoro PR after this one is merged. |
Rebasing onto the supertonic TTS pipeline (#1317) surfaced two gaps the suites themselves reported: - The registry walk assumed every task config names a single `modelPath`. Supertonic assembles four `.pte` files under `modelPaths`, so its category looked empty and its variant group went unchecked. Recognize both shapes, and compare variants on the whole set of files they name. - The export snapshots record the new TTS surface. Additions only — no removal or rename.
Addresses the review threads on #1354. Codes are no longer generated (barhanc): `scripts/errors.config.ts` and `generate-errors.ts` are deleted along with the codegen script and CI drift check. `src/core/error.ts` is now the source of truth and `cpp/core/error.h` mirrors it by hand, like every other part of the TS/JSI interface. TypeScript: - Codes are a string union, not a numeric enum, and the set shrinks from 13 to 10. A code now has to justify a distinct recovery path; the tokenizer and not-supported codes folded into the general categories. - One `RnExecuTorchError(code, message)` factory replaces the class/worklet-helper pair. It is a function, so it works unchanged on both runtimes rather than needing two spellings. - `isRnExecuTorchError(err, code?)` takes an optional code to narrow. - The internal fetcher `AbortError` class becomes a DOWNLOAD_ABORTED error; `useResourceDownload` matches the code instead of the class. C++: - `CodedError` -> `RnExecuTorchException`, `ErrorCode` -> `RnExecuTorchErrorCode`, `etCode` -> `etRuntimeErrorCode`. - `throwJs` and `makeJsError` are replaced by a single `throwJsiRnExecuTorchError(rt, e)` that only takes the C++ exception, so there is no way to reach JS without constructing one first. - `unwrapEt` leaves the error namespace and goes back to being a file-local `unwrap` helper with a single signature, no jsi::Runtime. Example apps are reverted to their original state: they are a testing ground and should surface raw errors (barhanc, #1288). The new Supertonic TTS throw sites from #1317 are converted to the convention. Agent skills are updated to match.
## Description Changes naming from `opts` to `options` across the board in TS API. Follow-up to [comment](https://github.com/software-mansion/react-native-executorch/pull/1317#:~:text=I%27m%20in%20favour%20of%20options%20everywhere.%20Opts%20suffixes%20in%20config%20object%20field%20and%20types%20are%20fine%20I%20guess.%20Also%20when%20we%20add%20PR%20with%20refactor%20we%20should%20add%20note%20in%20core%2Dguidelines/SKILL.md.) from #1317 ### Introduces a breaking change? - [ ] Yes - [x] No ### Type of change - [ ] Bug fix (change which fixes an issue) - [ ] New feature (change which adds functionality) - [ ] Documentation update (improves or adds clarity to existing documentation) - [x] Other (chores, tests, code style improvements etc.) ### Tested on - [ ] iOS - [ ] Android ### Testing instructions N/A ### Screenshots <!-- Add screenshots here, if applicable --> ### Related issues <!-- Link related issues here using #issue-number --> ### Checklist - [ ] I have performed a self-review of my code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have updated the documentation accordingly - [ ] My changes generate no new warnings ### Additional notes <!-- Include any additional information, assumptions, or context that reviewers might need to understand this PR. -->
Addresses the review threads on #1354. Codes are no longer generated (barhanc): `scripts/errors.config.ts` and `generate-errors.ts` are deleted along with the codegen script and CI drift check. `src/core/error.ts` is now the source of truth and `cpp/core/error.h` mirrors it by hand, like every other part of the TS/JSI interface. TypeScript: - Codes are a string union, not a numeric enum, and the set shrinks from 13 to 10. A code now has to justify a distinct recovery path; the tokenizer and not-supported codes folded into the general categories. - One `RnExecuTorchError(code, message)` factory replaces the class/worklet-helper pair. It is a function, so it works unchanged on both runtimes rather than needing two spellings. - `isRnExecuTorchError(err, code?)` takes an optional code to narrow. - The internal fetcher `AbortError` class becomes a DOWNLOAD_ABORTED error; `useResourceDownload` matches the code instead of the class. C++: - `CodedError` -> `RnExecuTorchException`, `ErrorCode` -> `RnExecuTorchErrorCode`, `etCode` -> `etRuntimeErrorCode`. - `throwJs` and `makeJsError` are replaced by a single `throwJsiRnExecuTorchError(rt, e)` that only takes the C++ exception, so there is no way to reach JS without constructing one first. - `unwrapEt` leaves the error namespace and goes back to being a file-local `unwrap` helper with a single signature, no jsi::Runtime. Example apps are reverted to their original state: they are a testing ground and should surface raw errors (barhanc, #1288). The new Supertonic TTS throw sites from #1317 are converted to the convention. Agent skills are updated to match.
Description
Add supertonic TTS pipeline and example app screen to test it.
Introduces a breaking change?
Type of change
Tested on
Testing instructions
Screenshots
Related issues
Part of #1250
Checklist
Additional notes
Should wait for #1328 so that the hook implementation can be refactored to a more concise and elegant one.