CorentinJ/Real-Time-Voice-Cloning · critical · Exception

No encoder models found in %s

Error message

No encoder models found in %s

What it means

Raised by Ui.populate_models (toolbox/ui.py) when models_dir.glob("*/encoder.pt") returns nothing — i.e. no subdirectory of the toolbox models dir contains an encoder.pt. The toolbox requires a trained encoder as a hard dependency (it computes speaker embeddings on every operation), so it refuses to start without one, unlike the vocoder which silently falls back to Griffin-Lim.

Source

Thrown at toolbox/ui.py:338

        self.utterance_box.setCurrentIndex(index)

    @property
    def current_encoder_fpath(self):
        return self.encoder_box.itemData(self.encoder_box.currentIndex())

    @property
    def current_synthesizer_fpath(self):
        return self.synthesizer_box.itemData(self.synthesizer_box.currentIndex())

    @property
    def current_vocoder_fpath(self):
        return self.vocoder_box.itemData(self.vocoder_box.currentIndex())

    def populate_models(self, models_dir: Path):
        # Encoder
        encoder_fpaths = list(models_dir.glob("*/encoder.pt"))
        if len(encoder_fpaths) == 0:
            raise Exception("No encoder models found in %s" % models_dir)
        self.repopulate_box(self.encoder_box, [(f.parent.name, f) for f in encoder_fpaths])

        # Synthesizer
        synthesizer_fpaths = list(models_dir.glob("*/synthesizer.pt"))
        if len(synthesizer_fpaths) == 0:
            raise Exception("No synthesizer models found in %s" % models_dir)
        self.repopulate_box(self.synthesizer_box, [(f.parent.name, f) for f in synthesizer_fpaths])

        # Vocoder
        vocoder_fpaths = list(models_dir.glob("*/vocoder.pt"))
        vocoder_items = [(f.parent.name, f) for f in vocoder_fpaths] + [("Griffin-Lim", None)]
        self.repopulate_box(self.vocoder_box, vocoder_items)

    @property
    def selected_utterance(self):
        return self.utterance_history.itemData(self.utterance_history.currentIndex())

    def register_utterance(self, utterance: Utterance):

View on GitHub (pinned to 890f3a0318)

Solutions

  1. Download the pretrained encoder and place it so the path is <models_dir>/<model_name>/encoder.pt (per the README's pretrained models instructions).
  2. Check the path you pass: python demo_toolbox.py -m /path/to/models where a subdirectory contains encoder.pt.
  3. If you trained your own encoder, its checkpoint is at encoder/saved_models/<run>/encoder.pt — pass encoder/saved_models as the models root.
  4. Verify with: ls <models_dir>/*/encoder.pt — it must print at least one match.

Example fix

# before
python demo_toolbox.py -m ~/models  # ls ~/models/*/encoder.pt -> empty -> raises

# after
mkdir -p ~/models/pretrained && mv ~/Downloads/encoder.pt ~/models/pretrained/
python demo_toolbox.py -m ~/models  # ~/models/pretrained/encoder.pt now matches the glob
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path

def encoder_model_present(models_dir: Path) -> bool:
    return any(models_dir.glob("*/encoder.pt"))

Try / catch

try:
    ui.populate_models(models_dir)
except Exception as e:
    if "encoder models" in str(e):
        raise SystemExit(f"Missing encoder: place <models>/<name>/encoder.pt (see README pretrained models)") from e
    raise

Prevention

When it happens

Trigger: Launching demo_toolbox.py with a models dir (default encoder/saved_models) that has no <name>/encoder.pt: pretrained models never downloaded, placed in the wrong subdir, or the -m/--models_root argument pointing elsewhere.

Common situations: Fresh clone without downloading the pretrained encoder; putting encoder.pt directly in the models root instead of a named subdirectory; passing the datasets root instead of the models root; training output saved under a different folder name.

Related errors


AI-assisted analysis of CorentinJ/Real-Time-Voice-Cloning@890f3a0318 (2026-08-15). Data as JSON: /api/errors/1b8c3c66ee1bf699. Report an issue: GitHub.