{"record":{"id":"93688f9cb591f8e8","repo":"invoke-ai/InvokeAI","slug":"unrecognized-scheduler-prediction-type-prediction","errorCode":null,"errorMessage":"unrecognized scheduler prediction_type {prediction_type}","messagePattern":"unrecognized scheduler prediction_type (.+?)","errorType":"exception","errorClass":"NotAMatchError","httpStatus":null,"severity":"warning","filePath":"invokeai/backend/model_manager/configs/main.py","lineNumber":1162,"sourceCode":"            case 2048:\n                return BaseModelType.StableDiffusionXL\n            case _:\n                raise NotAMatchError(f\"unrecognized cross_attention_dim {cross_attention_dim}\")\n\n    @classmethod\n    def _get_scheduler_prediction_type_or_raise(cls, mod: ModelOnDisk) -> SchedulerPredictionType:\n        scheduler_conf = get_config_dict_or_raise(mod.path / \"scheduler\" / \"scheduler_config.json\")\n\n        # TODO(psyche): Is epsilon the right default or should we raise if it's not present?\n        prediction_type = scheduler_conf.get(\"prediction_type\", \"epsilon\")\n\n        match prediction_type:\n            case \"v_prediction\":\n                return SchedulerPredictionType.VPrediction\n            case \"epsilon\":\n                return SchedulerPredictionType.Epsilon\n            case _:\n                raise NotAMatchError(f\"unrecognized scheduler prediction_type {prediction_type}\")\n\n    @classmethod\n    def _get_variant_or_raise(cls, mod: ModelOnDisk) -> ModelVariantType:\n        base = cls.model_fields[\"base\"].default\n        unet_config = get_config_dict_or_raise(mod.path / \"unet\" / \"config.json\")\n        in_channels = unet_config.get(\"in_channels\")\n\n        match in_channels:\n            case 4:\n                return ModelVariantType.Normal\n            case 5:\n                # Only SD2 has a depth variant\n                assert base is BaseModelType.StableDiffusion2, f\"unexpected unet in_channels 5 for base '{base}'\"\n                return ModelVariantType.Depth\n            case 9:\n                return ModelVariantType.Inpaint\n            case _:\n                raise NotAMatchError(f\"unrecognized unet in_channels {in_channels} for base '{base}'\")","sourceCodeStart":1144,"sourceCodeEnd":1180,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/configs/main.py#L1144-L1180","documentation":"_get_scheduler_prediction_type_or_raise reads `scheduler/scheduler_config.json` and converts its `prediction_type` into the SchedulerPredictionType enum; only \"v_prediction\" and \"epsilon\" are recognized. Anything else (e.g. \"sample\", \"heun\", or a missing/renamed key) raises NotAMatchError so the config class declines the model.","triggerScenarios":"from_model_on_disk on an SD-family folder whose scheduler_config.json has a prediction_type other than v_prediction/epsilon, or where the field is absent (leading to None/other value at the match statement).","commonSituations":"Third-party or hand-crafted diffusers exports with nonstandard scheduler configs, newer scheduler types not supported by the SD1/SD2/XL config family, or corrupted/incomplete downloads dropping the field.","solutions":["Edit `scheduler/scheduler_config.json` and set `\"prediction_type\": \"epsilon\"` (or \"v_prediction\" for SD2 v-pred models) to match the upstream repo.","Re-copy the scheduler folder from the official HuggingFace repo for the model.","If the model genuinely isn't an SD-family model, let a different config class claim it."],"exampleFix":"// before\nscheduler/scheduler_config.json: { \"prediction_type\": \"sample\", ... }\n// after\nscheduler/scheduler_config.json: { \"prediction_type\": \"epsilon\", ... }","handlingStrategy":"validation","validationCode":"import json\nfrom pathlib import Path\n\nconf = json.loads((Path(model_dir) / \"scheduler\" / \"scheduler_config.json\").read_text())\npt = conf.get(\"prediction_type\")\nif pt not in (\"epsilon\", \"v_prediction\"):\n    conf[\"prediction_type\"] = \"epsilon\"  # or v_prediction for SD2 v-pred\n    (Path(model_dir) / \"scheduler\" / \"scheduler_config.json\").write_text(json.dumps(conf, indent=2))","typeGuard":"def has_valid_scheduler(folder: Path) -> bool:\n    p = folder / \"scheduler\" / \"scheduler_config.json\"\n    return p.is_file() and json.loads(p.read_text()).get(\"prediction_type\") in (\"epsilon\", \"v_prediction\")","tryCatchPattern":"try:\n    cfg = Main_Diffusers_SD1_Config.from_model_on_disk(mod)\nexcept NotAMatchError:\n    # fix scheduler_config.json prediction_type and rescan\n    cfg = None","preventionTips":["Copy the scheduler folder verbatim from the official HuggingFace repo.","Set prediction_type to epsilon (SD1/XL) or v_prediction (SD2 v-pred) after conversions.","Verify scheduler_config.json survived pruning/cleanup of the model folder."],"tags":["model-identification","scheduler-config","diffusers"],"backgroundTag":"invalid-model-config","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}