executorch icon indicating copy to clipboard operation
executorch copied to clipboard

Enable Kokoro

Open jackzhxng opened this issue 1 year ago • 5 comments

🚀 The feature, motivation and pitch

https://huggingface.co/hexgrad/Kokoro-82M

Alternatives

No response

Additional context

No response

RFC (Optional)

No response

cc @mergennachin @iseeyuan @lucylq @helunwencser @tarun292 @kimishpatel

jackzhxng avatar Jul 10 '25 16:07 jackzhxng

  • Non-LSTM export is good (upstream, between, and downstream of problematic lstm calls)
  • We already have optimized kernels to do op_fft_c2r.cpp kernel to do istft and op_fft_r2c.cpp to do stft
  • Looking into while support for ET with @JacobSzwejbka
  • @pianpwk and @ydwu4 looking into LSTM rewrite with while

jackzhxng avatar Jul 16 '25 22:07 jackzhxng

We menaged to succesfully export the Kokoro model with static input shapes. The model is exported in 4 parts, and here is the repo containing all the necessary model source code changes & sample run scripts.

We’ve also successfully managed to export the Decoder with dynamic shapes. To get the other parts working with dynamic shapes, though, we'll need to resolve the LSTM issue. @jackzhxng, do you have any updates on how the LSTM dynamic shape support is coming along?

IgorSwat avatar Jan 12 '26 10:01 IgorSwat

Can't wait to compare this with the onnx version! Haven't gotten that to run smoothly without blocking the main thread of my react native app.

danieloi avatar Feb 25 '26 01:02 danieloi

Would this LSTM dynamic shape issue affect size/quality with your current approach @IgorSwat

See https://github.com/pytorch/executorch/issues/8468#issuecomment-3194843782

danieloi avatar Feb 25 '26 01:02 danieloi

Would this LSTM dynamic shape issue affect size/quality with your current approach @IgorSwat

See #8468 (comment)

Yeah, definitely. So far we pad each LSTM input to the maximal length to omit this issue, but this causes the model to run much slower for shorter inputs. I believe we could save up to 40% of the inference time for short inputs like 3-6 words. Also significant amount of memory usage would be cut off.

Actually, since streaming mode relies on dividing the input for shorter sentences, it affects performance of any input size.

IgorSwat avatar Mar 02 '26 11:03 IgorSwat