babysor/MockingBird · error · Exception

Unknown cleaner: %s

Error message

Unknown cleaner: %s

What it means

_clean_text looks up each requested cleaner by name via getattr(cleaners, name). If the module has no such attribute, getattr returns the module's default (None here since nothing matched) and the code raises 'Unknown cleaner'. Note: getattr without a default raises AttributeError; None occurs only when the attribute exists but is None.

Source

Thrown at models/synthesizer/utils/text.py:60

def sequence_to_text(sequence):
  """Converts a sequence of IDs back to a string"""
  result = ""
  for symbol_id in sequence:
    if symbol_id in _id_to_symbol:
      s = _id_to_symbol[symbol_id]
      # Enclose ARPAbet back in curly braces:
      if len(s) > 1 and s[0] == "@":
        s = "{%s}" % s[1:]
      result += s
  return result.replace("}{", " ")


def _clean_text(text, cleaner_names):
  for name in cleaner_names:
    cleaner = getattr(cleaners, name)
    if not cleaner:
      raise Exception("Unknown cleaner: %s" % name)
    text = cleaner(text)
  return text


def _symbols_to_sequence(symbols):
  return [_symbol_to_id[s] for s in symbols if _should_keep_symbol(s)]


def _arpabet_to_sequence(text):
  return _symbols_to_sequence(["@" + s for s in text.split()])


def _should_keep_symbol(s):
  return s in _symbol_to_id and s not in ("_", "~")

View on GitHub (pinned to 28dc5e14f1)

Solutions

  1. Open models/synthesizer/utils/cleaners.py and use an existing cleaner name (typically 'english_cleaners')
  2. Add the missing cleaner function to cleaners.py if porting from another repo
  3. Check spelling/case of the cleaner name in hparams

Example fix

# before
text_to_sequence(t, ['english_cleaners2'])  # Unknown cleaner

# after
text_to_sequence(t, ['english_cleaners'])
Defensive patterns

Strategy: validation

Validate before calling

from models.synthesizer.utils import cleaners, text
cleaner_names = ['english_cleaners']
for c in cleaner_names:
    assert callable(getattr(cleaners, c, None)), f'unknown cleaner {c}'

Type guard

def valid_cleaner(name: str) -> bool:
    from models.synthesizer.utils import cleaners
    return callable(getattr(cleaners, name, None))

Prevention

When it happens

Trigger: Calling text_to_sequence(text, cleaner_names) with a cleaner name not defined in models/synthesizer/utils/cleaners.py, e.g. 'english_cleaners2' (used by newer Tacotron/Mozilla Twitch versions) while this repo only has 'english_cleaners'.

Common situations: Porting configs from Mozilla TTS / Tacotron2 repos whose cleaner names differ; typo in cleaner name; missing symbols file variant (basic/symbols difference).

Related errors


AI-assisted analysis of babysor/MockingBird@28dc5e14f1 (2026-08-27). Data as JSON: /api/errors/678e519e53a0b6f3. Report an issue: GitHub.