{"record":{"id":"cc862ec3adb896cf","repo":"unslothai/unsloth","slug":"no-dit-trainer-for-family-cfg-resolved-family-r","errorCode":null,"errorMessage":"No DiT trainer for family {cfg.resolved_family!r}","messagePattern":"No DiT trainer for family (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"studio/backend/core/training/diffusion_dit_trainer.py","lineNumber":1838,"sourceCode":"        return False\n\n\ndef run_dit_lora_training(\n    config: DiffusionLoraConfig,\n    *,\n    on_event: Optional[EventCb] = None,\n    should_stop: Optional[StopCb] = None,\n) -> str:\n    \"\"\"Train a flow-matching DiT LoRA (FLUX.1 / FLUX.2 / Qwen-Image / Z-Image / Krea 2 / LTX-2) and export it.\n\n    Resumable: ``cfg.resume_from_checkpoint`` restores the adapter, optimizer moments, LR\n    position, EMA shadow, sampler cycle and RNG streams from a ``checkpoint-<N>`` bundle,\n    and the loop runs steps N+1..train_steps (the TARGET TOTAL). A stop-and-save and every\n    ``cfg.save_steps`` interval write such a bundle.\"\"\"\n    cfg = config.normalized()\n    spec = _SPECS.get(cfg.resolved_family)\n    if spec is None:\n        raise ValueError(f\"No DiT trainer for family {cfg.resolved_family!r}\")\n\n    # DiT families train in bf16, so an explicit fp16 request is refused, not silently upgraded. Validated before the heavy imports so a host without diffusers still sees the real error.\n    if cfg.mixed_precision == \"fp16\" and spec.force_bf16:\n        raise ValueError(\n            f\"{spec.family} LoRA training requires bf16: fp16 overflows its fp32 RoPE / \"\n            f\"embedder internals. Set mixed precision to bf16.\"\n        )\n\n    import torch\n\n    rng = random.Random(cfg.seed)\n    torch.manual_seed(cfg.seed)\n    _FLUX_STATIC.clear()\n\n    save_on_stop = True\n\n    def _check_stop() -> bool:\n        nonlocal save_on_stop","sourceCodeStart":1820,"sourceCodeEnd":1856,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/training/diffusion_dit_trainer.py#L1820-L1856","documentation":"Raised at the top of the DiT LoRA trainer when the normalized config's resolved_family has no entry in _SPECS. resolved_family is what normalization computes from the base model, so this means the run targets a family the trainer build knows nothing about. It fails before any heavy imports, so it is purely a config/version mismatch signal.","triggerScenarios":"cfg.resolved_family resolving to a string not present in _SPECS: a typo or custom family name injected into the config, a new model family saved by a newer Studio version then opened by an older backend, or direct API calls constructing configs by hand.","commonSituations":"Downgrading the backend or mixing backend/frontend versions; hand-written config dicts; a family constant renamed between releases; custom forks adding a family without registering a spec.","solutions":["Check the supported families in the trainer docstring (FLUX.1 / FLUX.2 / Qwen-Image / Z-Image / Krea 2 / LTX-2) and set base_model to one of those.","Print cfg.resolved_family after config.normalized() to see what the family actually resolved to and fix the source of the bad value.","Align versions: update the backend so the family your config references is registered in _SPECS."],"exampleFix":"# before\ncfg.resolved_family = \"flux.3\"  # not a real family -> No DiT trainer\n\n# after\ncfg.base_model = \"black-forest-labs/FLUX.1-dev\"  # normalization resolves a known family","handlingStrategy":"validation","validationCode":"SUPPORTED = {\"flux.1\", \"flux.2\", \"qwen-image\", \"z-image\", \"krea-2\", \"ltx-2\"}  # mirror _SPECS keys\n\ndef family_supported(resolved_family: str) -> bool:\n    return resolved_family in SUPPORTED","typeGuard":null,"tryCatchPattern":"try:\n    train_diT_lora(cfg)\nexcept ValueError as e:\n    if \"No DiT trainer for family\" in str(e):\n        raise SystemExit(f\"Unknown family {cfg.resolved_family!r}; check base_model spelling/backend version\")\n    raise","preventionTips":["Log config.resolved_family right after normalized() to catch bad family resolution early.","Keep backend and client versions in lockstep; don't open configs from newer versions."],"tags":["config","model-family","training","version-mismatch"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}