{"record":{"id":"9dc4f7437b01fca4","repo":"microsoft/VibeVoice","slug":"acoustic-tokenizer-config-has-unexpected-type-ty","errorCode":null,"errorMessage":"acoustic_tokenizer_config has unexpected type: {type(ac_cfg)}","messagePattern":"acoustic_tokenizer_config has unexpected type: (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"critical","filePath":"vllm_plugin/model.py","lineNumber":226,"sourceCode":"        if target_hidden_size is None:\n            print(\"[VibeVoice] WARN: Could not find hidden_size in config! Defaulting to 3584 (7B).\", file=sys.stderr)\n            self.hidden_size = 3584\n        else:\n            self.hidden_size = target_hidden_size\n\n        ac_cfg = get_cfg(config, \"acoustic_tokenizer_config\")\n        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:","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/microsoft/VibeVoice/blob/94da20d98b2fa7688e9cbfaf7692ddb4954f7600/vllm_plugin/model.py#L208-L244","documentation":"After confirming `acoustic_tokenizer_config` exists, the constructor only accepts it as an already-built VibeVoiceAcousticTokenizerConfig instance (passed through from a pre-constructed config) or as a plain dict (unpacked via **ac_cfg into the config class). Any other type — string, list, OmegaConf object, namespace, or a dataclass from a mismatched library version — raises this TypeError.","triggerScenarios":"config.json storing the section as a JSON *string* (double-serialized) instead of an object; tooling that converts nested dicts to EasyDict/AddArgs namespaces or OmegaConf DictConfig which fail isinstance(..., dict); a config object from a different vibevoice package version whose class identity (isinstance check) no longer matches the one imported by the plugin.","commonSituations":"OmegaConf/YACS-wrapped configs loaded by training frameworks and passed straight into the vLLM plugin; configs round-tripped through YAML tools that stringify nested maps; two copies of the vibevoice package on sys.path (pip install + local clone) making isinstance checks fail on identical-looking configs.","solutions":["Ensure the value at `acoustic_tokenizer_config` in config.json is a JSON object (dict), not a string; if it is a string, json.loads/parse it back into a dict.","If the config is an OmegaConf/namespace object, convert with OmegaConf.to_container(cfg.acoustic_tokenizer_config) (or vars(namespace)) before loading the model.","Check for duplicate vibevoice installs: pip show vibevoice and python -c 'import vibevoice; print(vibevoice.__file__)' to make sure the plugin and your code import the same package.","As a last resort construct the config explicitly and set it: config.acoustic_tokenizer_config = VibeVoiceAcousticTokenizerConfig(**your_dict) before engine init."],"exampleFix":"# before (config.json, double-serialized)\n\"acoustic_tokenizer_config\": \"{\\\"hidden_size\\\": 1024, ...}\"\n\n# after\n\"acoustic_tokenizer_config\": {\"hidden_size\": 1024, ...}\n\n# before (python, OmegaConf)\ncfg = OmegaConf.load(\"config.yaml\")\n# after\ncfg.acoustic_tokenizer_config = OmegaConf.to_container(cfg.acoustic_tokenizer_config, resolve=True)","handlingStrategy":"validation","validationCode":"from huggingface_hub import hf_hub_download\nimport json\n\ndef fetch_clean_config(repo_id: str) -> dict:\n    p = hf_hub_download(repo_id, \"config.json\")\n    cfg = json.load(open(p))\n    key = \"acoustic_tokenizer_config\"\n    v = cfg.get(key)\n    if isinstance(v, str):          # double-serialized -> parse back\n        cfg[key] = json.loads(v)\n    assert isinstance(cfg.get(key), dict), f\"{key} must be a JSON object\"\n    return cfg","typeGuard":"def is_tokenizer_cfg_dict(v) -> bool:\n    if isinstance(v, str):\n        import json\n        try: v = json.loads(v)\n        except Exception: return False\n    return isinstance(v, dict)","tryCatchPattern":"try:\n    llm = LLM(model=model_id)\nexcept TypeError as e:\n    if \"acoustic_tokenizer_config has unexpected type\" in str(e):\n        raise SystemExit(\"Fix config.json: acoustic_tokenizer_config must be a JSON object/dict\")\n    raise","preventionTips":["Never hand-edit config.json with escaped-string nested sections; validate with json.load and isinstance checks.","Convert OmegaConf/namespace configs with OmegaConf.to_container(..., resolve=True) before passing to vLLM.","Keep exactly one vibevoice package installed to avoid isinstance mismatches across copies."],"tags":["model-config","type-error","serialization","omegaconf","vllm"],"backgroundTag":null,"analyzedSha":"94da20d98b2fa7688e9cbfaf7692ddb4954f7600","analyzedAt":"2026-08-15T04:12:07.418Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}