{"record":{"id":"d5faddb87ed1c3fd","repo":"CorentinJ/Real-Time-Voice-Cloning","slug":"unknown-cleaner-s","errorCode":null,"errorMessage":"Unknown cleaner: %s","messagePattern":"Unknown cleaner: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"synthesizer/utils/text.py","lineNumber":61,"sourceCode":"\ndef sequence_to_text(sequence):\n    \"\"\"Converts a sequence of IDs back to a string\"\"\"\n    result = \"\"\n    for symbol_id in sequence:\n        if symbol_id in _id_to_symbol:\n            s = _id_to_symbol[symbol_id]\n            # Enclose ARPAbet back in curly braces:\n            if len(s) > 1 and s[0] == \"@\":\n                s = \"{%s}\" % s[1:]\n            result += s\n    return result.replace(\"}{\", \" \")\n\n\ndef _clean_text(text, cleaner_names):\n    for name in cleaner_names:\n        cleaner = getattr(cleaners, name)\n        if not cleaner:\n            raise Exception(\"Unknown cleaner: %s\" % name)\n        text = cleaner(text)\n    return text\n\n\ndef _symbols_to_sequence(symbols):\n    return [_symbol_to_id[s] for s in symbols if _should_keep_symbol(s)]\n\n\ndef _arpabet_to_sequence(text):\n    return _symbols_to_sequence([\"@\" + s for s in text.split()])\n\n\ndef _should_keep_symbol(s):\n    return s in _symbol_to_id and s not in (\"_\", \"~\")\n","sourceCodeStart":43,"sourceCodeEnd":76,"githubUrl":"https://github.com/CorentinJ/Real-Time-Voice-Cloning/blob/890f3a03187195b9829db2079b75c2ba2ab0405c/synthesizer/utils/text.py#L43-L76","documentation":"Raised by _clean_text() in synthesizer/utils/text.py when a name in cleaner_names does not resolve to a usable function on the cleaners module (synthesizer/utils/cleaners.py). Cleaners normalize raw text (lowercasing, number expansion, transliteration) before symbol encoding; the valid names defined in this repo are 'english_cleaners', 'transliteration_cleaners', and 'basic_cleaners'. Caveat: the check uses getattr(cleaners, name) without a default, so a truly misspelled name actually raises AttributeError first; this explicit Exception fires when the attribute exists but is falsy (e.g. a None imported into the cleaners namespace).","triggerScenarios":"text_to_sequence(text, hparams.tts_cleaner_names) — called by synthesizer/inference.py:89 and synthesizer_dataset.py:39 — with tts_cleaner_names containing a name that is not one of the three defined cleaner functions, or a name shadowed by a None/variable in cleaners.py. The list comes from synthesizer/hparams.py (default ['english_cleaners']).","commonSituations":"Copying hparams from another Tacotron fork whose cleaner names differ (e.g. 'english_cleaners2', 'vietnamese_cleaners'); editing tts_cleaner_names to try a new cleaner before implementing it; a typo; porting a custom cleaners.py that defines the name as a variable rather than a function.","solutions":["Set hparams.tts_cleaner_names to one of the names actually defined in synthesizer/utils/cleaners.py: 'english_cleaners', 'transliteration_cleaners', or 'basic_cleaners'.","If you need a custom cleaner, define it as a module-level function in synthesizer/utils/cleaners.py and reference that exact name.","If you intended a cleaner from another project (e.g. 'english_cleaners2' from NVIDIA Tacotron2), port its implementation into cleaners.py first."],"exampleFix":"# before\nhparams.tts_cleaner_names = [\"english_cleaners2\"]  # not defined in this repo's cleaners.py\n\n# after\nhparams.tts_cleaner_names = [\"english_cleaners\"]  # defined in synthesizer/utils/cleaners.py","handlingStrategy":"validation","validationCode":"from synthesizer.utils import cleaners\n\nVALID_CLEANERS = {\"english_cleaners\", \"transliteration_cleaners\", \"basic_cleaners\"}\n\ndef validate_cleaners(names):\n    bad = [n for n in names if not callable(getattr(cleaners, n, None))]\n    if bad:\n        raise ValueError(f\"Unknown cleaners {bad}; valid: {sorted(VALID_CLEANERS)}\")\n    return names","typeGuard":"from synthesizer.utils import cleaners\nimport inspect\n\ndef is_valid_cleaner(name: str) -> bool:\n    fn = getattr(cleaners, name, None)\n    return inspect.isfunction(fn) and fn.__module__ == cleaners.__name__","tryCatchPattern":"try:\n    seq = text_to_sequence(text, hparams.tts_cleaner_names)\nexcept Exception as e:\n    if \"Unknown cleaner\" in str(e) or isinstance(e, AttributeError):\n        raise ValueError(f\"Check hparams.tts_cleaner_names={hparams.tts_cleaner_names} against synthesizer/utils/cleaners.py\") from e\n    raise","preventionTips":["Validate tts_cleaner_names against the cleaners module at config load time, not at first text encoding.","After editing hparams or cleaners.py, smoke-test one text_to_sequence() call before starting preprocessing/training.","Keep cleaner names in one constant list shared by training and inference so the two cannot drift apart."],"tags":["synthesizer","text","hparams","configuration"],"backgroundTag":null,"analyzedSha":"890f3a03187195b9829db2079b75c2ba2ab0405c","analyzedAt":"2026-08-15T02:15:13.202Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}