speaker_helper.install module

Fetching the weights, so the first real run is not also the first download.

Module summary

pip install gives you the code. It does not give you the ~340 MB Kokoro reads from, and the gap between those two facts is where a first use goes wrong: the package imports, the CLI answers --help, and the first sentence of a long narration is where you find out. install_engine() closes it deliberately, before anything is riding on it.

Stdlib only, on purpose. This runs before the extras are necessarily in place — somebody fixing a broken install should not need the broken install to work.

Two kinds of failure, told apart

A truncated download is the normal way this breaks: a dropped connection leaves a short file that exists, so a plain “is it there” check calls it installed and the model fails to load with something about a corrupt graph. The sizes are therefore pinned and checked, and re-running repairs rather than trusting the shorter file.

The release is pinned to a tag rather than a floating “latest”, so two machines installing a week apart get the same narrator.

Author

Warith HARCHAOUI — https://linkedin.com/in/warith-harchaoui

speaker_helper.install.INSTALLABLE: dict[str, str] = {'chatterbox': 'fetched by the package itself on first use', 'kokoro': '~340 MB, two files, from a pinned kokoro-onnx release', 'openvoice': "checkpoints published by MyShell; see the project's README"}

Engines whose weights this module can fetch, and what it would take.

speaker_helper.install.KOKORO_FILES: tuple[tuple[str, int], ...] = (('kokoro-v1.0.onnx', 325532387), ('voices-v1.0.bin', 28214398))

(filename, exact size in bytes). The size is the whole point — see the module docstring on truncated downloads.

speaker_helper.install.KOKORO_RELEASE: str = 'https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files-v1.0'

Where the ONNX graph and the voice bank are published.

speaker_helper.install.install_engine(engine, *, force=False)[source]

Fetch what engine needs, or say why this cannot.

Only Kokoro is fetched here. The other two are honest refusals rather than silent no-ops: Chatterbox downloads its own weights on first use, and OpenVoice’s checkpoints come with a licence the user has to meet rather than a URL this module should quietly pull.

Parameters:
Return type:

int

speaker_helper.install.install_kokoro(*, force=False)[source]

Fetch Kokoro’s two files into the cache.

Parameters:

force (bool) – Re-download even when a file of the right size is already there.

Returns:

0 when both files are present and the right size afterwards.

Return type:

int