{"record":{"id":"d64ce5c378a41357","repo":"ultralytics/yolov5","slug":"error-w-is-not-a-supported-format","errorCode":null,"errorMessage":"ERROR: {w} is not a supported format","messagePattern":"ERROR: (.+?) is not a supported format","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"models/common.py","lineNumber":675,"sourceCode":"                raise FileNotFoundError(f\"Model files not found in {w}. Both .json and .pdiparams files are required.\")\n\n            config = pdi.Config(str(model_file), str(params_file))\n            if cuda:\n                config.enable_use_gpu(memory_pool_init_size_mb=2048, device_id=0)\n            config.disable_mkldnn()  # disable MKL-DNN for PIR compatibility\n            predictor = pdi.create_predictor(config)\n            input_handle = predictor.get_input_handle(predictor.get_input_names()[0])\n            output_names = predictor.get_output_names()\n\n        elif triton:  # NVIDIA Triton Inference Server\n            LOGGER.info(f\"Using {w} as Triton Inference Server...\")\n            check_requirements(\"tritonclient[all]\")\n            from utils.triton import TritonRemoteModel\n\n            model = TritonRemoteModel(url=w)\n            nhwc = model.runtime.startswith(\"tensorflow\")\n        else:\n            raise NotImplementedError(f\"ERROR: {w} is not a supported format\")\n\n        # class names\n        if \"names\" not in locals():\n            names = yaml_load(data)[\"names\"] if data else {i: f\"class{i}\" for i in range(999)}\n        if names[0] == \"n01440764\" and len(names) == 1000:  # ImageNet\n            names = yaml_load(ROOT / \"data/ImageNet.yaml\")[\"names\"]  # human-readable names\n\n        self.__dict__.update(locals())  # assign all variables to self\n\n    def forward(self, im, augment=False):\n        \"\"\"Performs YOLOv5 inference on input images with optional augmentation.\"\"\"\n        _b, _ch, h, w = im.shape  # batch, channel, height, width\n        if self.fp16 and im.dtype != torch.float16:\n            im = im.half()  # to FP16\n        if self.nhwc:\n            im = im.permute(0, 2, 3, 1)  # torch BCHW to numpy BHWC shape(1,320,192,3)\n\n        if self.pt:  # PyTorch","sourceCodeStart":657,"sourceCodeEnd":693,"githubUrl":"https://github.com/ultralytics/yolov5/blob/20d1d78a08277e365d57bfa3a2cce752772d9e59/models/common.py#L657-L693","documentation":"DetectMultiBackend's final else branch raises NotImplementedError when the weight path's suffix matches none of the recognized backend formats (pt, torchscript, onnx, engine, tflite, pb, tfjs dir, pdiparams, triton URL, etc.). It is a format-dispatch failure: the file may exist and be perfectly valid, but this class has no loader for that extension.","triggerScenarios":"Passing 'yolov5s.onnx.tar.gz', 'model.uff', 'weights.h5', 'yolov5s.pt.bak', or any unsupported extension to DetectMultiBackend; pointing at an OpenVINO .xml/.bin pair; a path with a doubled suffix.","commonSituations":"Users converting YOLOv5 weights with third-party tools and feeding exotic artifacts back in; renaming files for versioning (model.pt-v2) which changes the suffix; expecting DetectMultiBackend to auto-decompress archives.","solutions":["Export to a supported format with export.py (onnx, tflite, engine, paddle, saved_model...) and pass that artifact.","Fix the filename so its true suffix is recognized, e.g. strip accidental double extensions or rename back to .pt.","For Triton, pass the full url or 'host:port/model' endpoint string, not a local file path."],"exampleFix":"# before\nmodel = DetectMultiBackend('yolov5s.onnx.zip')\n\n# after\nimport zipfile; zipfile.extract('yolov5s.onnx.zip')\nmodel = DetectMultiBackend('yolov5s.onnx')","handlingStrategy":"type-guard","validationCode":"SUPPORTED = {'.pt', '.torchscript', '.onnx', '.engine', '.tflite', '.pb', '.pdiparams'}\n\ndef suffix_supported(w: str) -> bool:\n    from pathlib import Path\n    p = Path(w)\n    return p.is_dir() or p.suffix in SUPPORTED or '://' in w or bool(w.count(':'))  # triton url","typeGuard":"from pathlib import Path\n\nSUPPORTED_SUFFIXES = ('.pt', '.torchscript', '.onnx', '.engine', '.tflite', '.pb', '.pdiparams')\n\ndef is_supported_backend_path(w: str) -> bool:\n    \"\"\"True if DetectMultiBackend has a loader for this artifact.\"\"\"\n    p = Path(w)\n    return p.is_dir() or p.suffix in SUPPORTED_SUFFIXES or bool(w.rsplit('/', 1)[-1].count(':'))  # triton","tryCatchPattern":"try:\n    model = DetectMultiBackend(w)\nexcept NotImplementedError:\n    raise SystemExit(f'{w}: unsupported format; run export.py --include onnx|tflite|engine first')","preventionTips":["Generate inference artifacts only through export.py so suffixes are always recognized.","Avoid renaming exported files with version suffixes that change the extension."],"tags":["inference","unsupported-format","model-path"],"backgroundTag":null,"analyzedSha":"20d1d78a08277e365d57bfa3a2cce752772d9e59","analyzedAt":"2026-08-15T02:56:15.443Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}