{"record":{"id":"cb3dde4d6e6d39bc","repo":"fishaudio/fish-speech","slug":"unknown-model-type-config-model-type","errorCode":null,"errorMessage":"Unknown model type: {config.model_type}","messagePattern":"Unknown model type: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"fish_speech/models/text2semantic/llama.py","lineNumber":518,"sourceCode":"        try:\n            tokenizer = FishTokenizer.from_pretrained(path)\n            config.semantic_begin_id = tokenizer.semantic_begin_id\n            config.semantic_end_id = tokenizer.semantic_end_id\n            logger.info(\n                f\"Injected Semantic IDs into Config: {config.semantic_begin_id}-{config.semantic_end_id}\"\n            )\n        except Exception as e:\n            logger.warning(\n                f\"Failed to load tokenizer for config injection: {e}. Semantic IDs might be 0.\"\n            )\n\n        match config.model_type:\n            case \"naive\":\n                model_cls = NaiveTransformer\n            case \"dual_ar\":\n                model_cls = DualARTransformer\n            case _:\n                raise ValueError(f\"Unknown model type: {config.model_type}\")\n\n        logger.info(f\"Loading model from {path}, config: {config}\")\n        # Initialize model without passing tokenizer explicitly to __init__\n        model = model_cls(config)\n        # Attach tokenizer to model instance for inference convenience (optional, but good for user scripts)\n        model.tokenizer = tokenizer\n\n        if load_weights is False:\n            logger.info(\"Randomly initialized model\")\n        else:\n            if \"int8\" in str(Path(path)):\n                logger.info(\"Using int8 weight-only quantization!\")\n                from tools.llama.quantize import WeightOnlyInt8QuantHandler\n\n                simple_quantizer = WeightOnlyInt8QuantHandler(model)\n                model = simple_quantizer.convert_for_runtime()\n\n            if \"int4\" in str(Path(path)):","sourceCodeStart":500,"sourceCodeEnd":536,"githubUrl":"https://github.com/fishaudio/fish-speech/blob/befe4001745417f8c42131739d862b8a6fdbd15a/fish_speech/models/text2semantic/llama.py#L500-L536","documentation":"After parsing config, from_pretrained maps model_type to a Transformer class (NaiveTransformer or DualARTransformer) and raises if the type is unknown. This catches configs whose model_type parsed in step 1 but has no concrete model class (e.g. fish_qwen3_omni on a build lacking that model).","triggerScenarios":"Calling BaseTransformer.from_pretrained on a checkpoint whose model_type is not 'naive' or 'dual_ar' in this build of the codebase.","commonSituations":"Loading new-architecture checkpoints with an older checkout; partially upgraded installs where config parsing and model classes are out of sync.","solutions":["Upgrade fish-speech/checkout to the version matching the checkpoint","Verify model_type in the model config matches a class registered in llama.py","Re-download the model from an official release compatible with your version"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"assert config.model_type in {\"naive\", \"dual_ar\"}, \"model class unavailable for this model_type\"","typeGuard":null,"tryCatchPattern":"try:\n    BaseTransformer.from_pretrained(path)\nexcept ValueError as e:\n    if \"Unknown model type\" in str(e):\n        # checkpoint architecture not in this build\n        ...","preventionTips":["Match fish-speech version to checkpoint","Test-load checkpoints in CI after upgrades"],"tags":["model-loading","config","dispatch"],"backgroundTag":"unsupported-model-type","analyzedSha":"befe4001745417f8c42131739d862b8a6fdbd15a","analyzedAt":"2026-08-27T21:31:45.703Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}