{"record":{"id":"01fb66548d528f96","repo":"microsoft/VibeVoice","slug":"semantic-tokenizer-config-has-unexpected-type-ty","errorCode":null,"errorMessage":"semantic_tokenizer_config has unexpected type: {type(sc_cfg)}","messagePattern":"semantic_tokenizer_config has unexpected type: (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"critical","filePath":"vllm_plugin/model.py","lineNumber":233,"sourceCode":"        sc_cfg = get_cfg(config, \"semantic_tokenizer_config\")\n        \n        if ac_cfg is None or sc_cfg is None:\n            raise ValueError(\"Missing acoustic/semantic tokenizer config in model config\")\n\n        # Handle both dict and already-constructed config objects\n        if isinstance(ac_cfg, VibeVoiceAcousticTokenizerConfig):\n            acoustic_config = ac_cfg\n        elif isinstance(ac_cfg, dict):\n            acoustic_config = VibeVoiceAcousticTokenizerConfig(**ac_cfg)\n        else:\n            raise TypeError(f\"acoustic_tokenizer_config has unexpected type: {type(ac_cfg)}\")\n        \n        if isinstance(sc_cfg, VibeVoiceSemanticTokenizerConfig):\n            semantic_config = sc_cfg\n        elif isinstance(sc_cfg, dict):\n            semantic_config = VibeVoiceSemanticTokenizerConfig(**sc_cfg)\n        else:\n            raise TypeError(f\"semantic_tokenizer_config has unexpected type: {type(sc_cfg)}\")\n        \n        # Tokenizers use float32 for numerical precision\n        self.acoustic_tokenizer = VibeVoiceAcousticTokenizerModel(acoustic_config)\n        self.semantic_tokenizer = VibeVoiceSemanticTokenizerModel(semantic_config)\n        \n        # Get audio encoder dtype from config (defaults to float32 for precision)\n        root_torch_dtype = get_cfg(config, \"torch_dtype\", None)\n        if root_torch_dtype is not None:\n            if isinstance(root_torch_dtype, str):\n                self._audio_encoder_dtype = getattr(torch, root_torch_dtype)\n            else:\n                self._audio_encoder_dtype = root_torch_dtype\n        else:\n            self._audio_encoder_dtype = torch.float32\n        \n        self.acoustic_connector = SpeechConnector(self.acoustic_vae_dim, self.hidden_size)\n        self.semantic_connector = SpeechConnector(self.semantic_vae_dim, self.hidden_size)\n        ","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/microsoft/VibeVoice/blob/94da20d98b2fa7688e9cbfaf7692ddb4954f7600/vllm_plugin/model.py#L215-L251","documentation":"Identical guard to the acoustic one, but for `semantic_tokenizer_config`: the constructor accepts only a VibeVoiceSemanticTokenizerConfig instance or a plain dict (unpacked via **sc_cfg). Any other type raises this TypeError and model construction aborts.","triggerScenarios":"Same shape as the acoustic case: `semantic_tokenizer_config` present in the config but stored as a string, list, namespace, or OmegaConf DictConfig; or a constructed config object from a mismatched vibevoice version so both isinstance checks fail.","commonSituations":"Configs edited by hand where one section was re-serialized correctly but the other was left as an escaped string; training frameworks wrapping only part of the config; version skew between the checkpoint's config classes and the plugin's imported classes.","solutions":["Make `semantic_tokenizer_config` a plain JSON object/dict in config.json (parse it out of any string form with json.loads).","Convert non-dict mapping objects to dicts: OmegaConf.to_container(...) or dict(vars(...)).","Verify a single vibevoice package install so the isinstance(sc_cfg, VibeVoiceSemanticTokenizerConfig) check uses the same class the config was built from.","Set it explicitly before engine init: config.semantic_tokenizer_config = VibeVoiceSemanticTokenizerConfig(**d)."],"exampleFix":"# before\n\"semantic_tokenizer_config\": \"[1, 2, 3]\"  # list/string, rejected\n\n# after\n\"semantic_tokenizer_config\": {\"hidden_size\": 1024, \"n_codebooks\": 8, ...}","handlingStrategy":"validation","validationCode":"import json\n\ndef validate_semantic_cfg(cfg: dict) -> bool:\n    v = cfg.get(\"semantic_tokenizer_config\")\n    if isinstance(v, str):\n        try:\n            v = json.loads(v)\n        except json.JSONDecodeError:\n            return False\n    return isinstance(v, dict) and len(v) > 0","typeGuard":"def is_semantic_cfg_ok(cfg) -> bool:\n    from omegaconf import OmegaConf\n    v = cfg.get(\"semantic_tokenizer_config\")\n    if OmegaConf.is_config(v):\n        v = OmegaConf.to_container(v, resolve=True)\n    return isinstance(v, dict)","tryCatchPattern":"try:\n    llm = LLM(model=model_id)\nexcept TypeError as e:\n    if \"semantic_tokenizer_config has unexpected type\" in str(e):\n        raise SystemExit(\"semantic_tokenizer_config must be a dict/JSON object in config.json\")\n    raise","preventionTips":["Treat both tokenizer config sections as one unit: validate acoustic and semantic together with one config lint step.","Diff full config.json against the official release after merges instead of spot-editing single keys."],"tags":["model-config","type-error","serialization","vllm"],"backgroundTag":null,"analyzedSha":"94da20d98b2fa7688e9cbfaf7692ddb4954f7600","analyzedAt":"2026-08-15T04:12:07.418Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}