Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StyleTTS/Kokoro #1153

Closed
2 tasks
ecyht2 opened this issue Jan 17, 2025 · 1 comment
Closed
2 tasks

StyleTTS/Kokoro #1153

ecyht2 opened this issue Jan 17, 2025 · 1 comment
Labels
new model Request a new model

Comments

@ecyht2
Copy link

ecyht2 commented Jan 17, 2025

Model description

I think it would be nice to support StyleTTS or Kokoro-82M. Currently both of them isn't supported in transformers or optimum but there are onnx exports for StyleTTS and Kokoro-82M.

There are two main things that might cause problems:

  1. Phonemizer
  2. Saving .wav file

Prerequisites

  • The model is supported in Transformers (i.e., listed here)
  • The model can be exported to ONNX with Optimum (i.e., listed here)

Additional information

No response

Your contribution

I saw an implementation of inference using onnx-web here. Furthermore, I have exported the voice packs here.

@ecyht2 ecyht2 added the new model Request a new model label Jan 17, 2025
@xenova
Copy link
Collaborator

xenova commented Jan 17, 2025

Hi there 👋 The model is indeed supported now (#1148). You can use it with the kokoro-js library I created:

npm i kokoro-js

You can then generate speech as follows:

import { KokoroTTS } from "kokoro-js";

const model_id = "onnx-community/Kokoro-82M-ONNX";
const tts = await KokoroTTS.from_pretrained(model_id, {
  dtype: "q8", // Options: "fp32", "fp16", "q8", "q4", "q4f16"
});

const text = "Life is like a box of chocolates. You never know what you're gonna get.";
const audio = await tts.generate(text, {
  // Use `tts.list_voices()` to list all available voices
  voice: "af_bella",
});
audio.save("audio.wav");

See hexgrad/kokoro#3 for more information.

@xenova xenova closed this as completed Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new model Request a new model
Projects
None yet
Development

No branches or pull requests

2 participants