Skip to content

logger.disable("kokoro") silently mutes the truncation warning #367

Description

@seigoryu

Summary

On import, kokoro/__init__.py calls logger.remove(), adds its own stderr sink (level INFO), and then calls logger.disable("kokoro"). In loguru, disable() filters at the record's origin (the record.name namespace) before any sink runs — including the package's own sink and any sink a caller adds afterward. As a result, all kokoro log output is invisible by default, including the Truncating len(ps) == N > 510 warning in kokoro/pipeline.py. On the espeak (non-English) path, where there is no internal chunking logic (as the constructor's own warning states), this message is the only signal that audio has been silently truncated. Users get shortened audio with no indication why, unless they already know to call logger.enable("kokoro").

Related: #269 reports the complementary symptom of the same __init__.py code — the package's logger.remove() clobbering the host application's loguru configuration. This report is about the package muting its own warnings.

Environment

  • kokoro 0.7.16
  • PyTorch 2.x
  • Python 3.13
  • macOS arm64 (Apple Silicon, M1 Max)

Reproduction

  1. Build a KPipeline with an espeak-backed language.
  2. Feed it text that produces more than 510 phonemes with no newline splits.
  3. Without calling logger.enable("kokoro"), no warning is printed and the output audio is truncated.
  4. With logger.enable("kokoro"), the same run prints the Truncating len(ps) == N > 510 warning. Audio length is identical either way (truncated) — comparing duration with and without \n-based text splitting confirms the cut.

Expected vs. Actual

  • Expected: a warning about silent truncation of synthesized audio should be visible by default, since it signals data loss with no other symptom.
  • Actual: the warning exists but is suppressed by the package's own logger.disable("kokoro") call, so it never reaches any sink unless the caller explicitly re-enables the logger namespace.

Suggestion

Either drop the logger.disable("kokoro") call (the package's own sink and level already control verbosity), or document the need for logger.enable("kokoro") prominently in the README. At minimum, exempt the truncation warning from the disable — e.g. log it under a differently-named logger, or raise instead of only logging.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions