Skip to content

TextToSpeech (PocketTTS): out-of-memory loop when a language .litertlm is loaded under its own name with a non-English locale #6395

Open

Description

@d43k0

Have I written custom code (as opposed to using a stock example script provided in MediaPipe)

Yes

OS Platform and Distribution

Linux x86_64 (kernel 7.0); also Android on an arm64 phone (NX809J)

MediaPipe Tasks SDK version

Python mediapipe 1.2.2; Android com.google.mediapipe:tasks-audio 1.2.0

Task name (e.g. Image classification, Gesture recognition etc.)

Text to Speech

Programming Language and version (e.g. C++, Python, Java)

Python 3.14; Kotlin on Android

Describe the actual behavior

Summary Loading a per-language PocketTTS bundle directly, e.g. pocket_tts_es_int8.litertlm, and synthesizing in that language makes memory grow without limit until the process is killed. It grows at about 2.5 GB/s. The file itself is fine: the same bytes under another file name work normally, at about 700 MB. ### Results (Python, MediaPipe 1.2.2, 2 GB limit) | File name | Locale | Result | |---|---|---| | pocket_tts_es_int8.litertlm | es-ES | Killed by the OOM killer about 1.5 s in, 2 GB anonymous memory | | pocket_tts_es_int8.litertlm | en-US | OK, 700 MB peak | | spanish.litertlm (identical bytes) | es-ES | OK, 705 MB peak, 2.2 s of audio in 0.5 s | The load itself succeeds at about 650 MB. Memory only grows once synthesis starts. On Android the same setup ran until the system killed the app. Earlier tests on the same setup failed the same way with a different voice (alba), and the other languages (fr, de, it, pt, nl) worked when renamed. Those were not re-run on 1.2.2.

Describe the expected behaviour

Expected behavior A language file loaded directly should work under its published name. The model card lists these per-language files for download and shows the name and locale for each.

Standalone code/steps you may have used to try to get what you need

Steps to reproduce Run this under a memory limit, as it can otherwise take the machine down: bash hf download litert-community/pocket-tts pocket_tts_es_int8.litertlm --local-dir same mkdir renamed && cp same/pocket_tts_es_int8.litertlm renamed/spanish.litertlm # Fails systemd-run --user --scope -p MemoryMax=2G -p MemorySwapMax=0 python repro.py same/pocket_tts_es_int8.litertlm es-ES # Works: same file, same locale, different name systemd-run --user --scope -p MemoryMax=2G -p MemorySwapMax=0 python repro.py renamed/spanish.litertlm es-ES repro.py: python import sys from mediapipe.tasks.python.audio import text_to_speech as t path, locale = sys.argv[1:3] tts = t.TextToSpeech.create_from_options( t.TextToSpeechOptions( base_options=t._BaseOptions(model_asset_path=path), default_locale=locale, ) ) samples = 0 for chunk in tts.synthesize_stream("Hola, esto es una prueba.", voice_id=None, locale=locale): samples += len(chunk.samples) print(f"ok: {samples / 24000:.1f}s of audio")

Other info / Complete Logs

### Workaround

Save the file under any name that doesn't match `pocket_tts_<lang>_int8.litertlm`.

Activity

  1. HarishPermal commented on Nov 16, 2026

    @HarishPermal

    hi @d43k0

    Sorry for the delay, im currently testing it with latest version 1.2.3, i'll get back with update once its done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

platform:pythonMediaPipe Python issuestype:bugBug in the Source Code of MediaPipe Solution

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions