{"record":{"id":"1b9e7751cfca48fd","repo":"opendatalab/MinerU","slug":"has-no-architecture","errorCode":null,"errorMessage":"{} has no Architecture","messagePattern":"(.+?) has no Architecture","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mineru/model/utils/tools/infer/pytorchocr_utility.py","lineNumber":162,"sourceCode":"\n    return parser\n\ndef parse_args():\n    parser = init_args()\n    return parser.parse_args()\n\ndef get_default_config(args):\n    return vars(args)\n\n\ndef read_network_config_from_yaml(yaml_path, char_num=None):\n    if not os.path.exists(yaml_path):\n        raise FileNotFoundError('{} is not existed.'.format(yaml_path))\n    import yaml\n    with open(yaml_path, encoding='utf-8') as f:\n        res = yaml.safe_load(f)\n    if res.get('Architecture') is None:\n        raise ValueError('{} has no Architecture'.format(yaml_path))\n    if res['Architecture']['Head']['name'] == 'MultiHead' and char_num is not None:\n        res['Architecture']['Head']['out_channels_list'] = {\n            'CTCLabelDecode': char_num,\n            'SARLabelDecode': char_num + 2,\n            'NRTRLabelDecode': char_num + 3\n        }\n    return res['Architecture']\n\ndef AnalysisConfig(weights_path, yaml_path=None, char_num=None):\n    if not os.path.exists(os.path.abspath(weights_path)):\n        raise FileNotFoundError('{} is not found.'.format(weights_path))\n\n    if yaml_path is not None:\n        return read_network_config_from_yaml(yaml_path, char_num=char_num)\n\n\ndef resize_img(img, input_size=600):\n    \"\"\"","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/opendatalab/MinerU/blob/4fe4bde114a23ee5dd637eae99b767f4669bf58c/mineru/model/utils/tools/infer/pytorchocr_utility.py#L144-L180","documentation":"Raised by read_network_config_from_yaml when the YAML parses successfully but contains no top-level 'Architecture' key. The pytorchocr config format requires Architecture (with Backbone/Head/Neck) to build the network, so the file is considered not a valid network config.","triggerScenarios":"Pointing the config reader at a training pipeline YAML (Global/Train/Eval sections only), a dataset config, or an unrelated YAML; a truncated/corrupted download.","commonSituations":"Mixing up files in the configs directory; editing a config and accidentally removing the Architecture block; YAML indentation errors that nest Architecture under another key.","solutions":["Open the YAML and confirm a top-level 'Architecture:' key with Backbone/Head exists.","Use the network config shipped with the model rather than a training/pipeline config.","Fix indentation if Architecture got nested under Global or another section."],"exampleFix":"# before (pipeline yaml)\nGlobal:\n  Architecture:\n    ...\n\n# after\nArchitecture:\n  Backbone: ...\n  Head: ...","handlingStrategy":"validation","validationCode":"import yaml\nwith open(yaml_path, encoding=\"utf-8\") as f:\n    cfg = yaml.safe_load(f)\nassert isinstance(cfg, dict) and \"Architecture\" in cfg, f\"{yaml_path} lacks top-level Architecture\"","typeGuard":"def is_network_config(cfg) -> bool:\n    return isinstance(cfg, dict) and isinstance(cfg.get(\"Architecture\"), dict)","tryCatchPattern":null,"preventionTips":["Do not pass training/pipeline YAMLs where a network config is expected","Validate config schema before launching inference"],"tags":["ocr","config","yaml","schema","valueerror"],"backgroundTag":null,"analyzedSha":"4fe4bde114a23ee5dd637eae99b767f4669bf58c","analyzedAt":"2026-08-14T21:29:18.456Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}