{"record":{"id":"fd62990ecc3ddb9b","repo":"unslothai/unsloth","slug":"weighting-scheme-must-be-one-of-none-bell","errorCode":null,"errorMessage":"weighting_scheme must be one of none / bell","messagePattern":"weighting_scheme must be one of none / bell","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"studio/backend/core/training/diffusion_train_common.py","lineNumber":1169,"sourceCode":"                    raise ValueError(\n                        f\"flow_shift must be a positive number or 'auto', got {self.flow_shift!r}\"\n                    ) from exc\n        if not isinstance(flow_shift, str):\n            flow_shift = float(flow_shift)\n            # isfinite as well as positive: JSON accepts 1e309, which floats to inf and would poison every sampled sigma while progress looks normal.\n            if not math.isfinite(flow_shift) or flow_shift <= 0:\n                raise ValueError(\n                    \"flow_shift must be a finite number > 0 (1.0 disables the shift), or 'auto'\"\n                )\n        try:\n            cfg_dropout = float(self.cfg_dropout or 0.0)\n        except (TypeError, ValueError) as exc:\n            raise ValueError(f\"cfg_dropout must be a number, got {self.cfg_dropout!r}\") from exc\n        if not 0.0 <= cfg_dropout <= 1.0:\n            raise ValueError(\"cfg_dropout must be between 0 and 1\")\n        weighting_scheme = str(self.weighting_scheme or \"none\").strip().lower()\n        if weighting_scheme not in (\"none\", \"bell\"):\n            raise ValueError(\"weighting_scheme must be one of none / bell\")\n        # A zero/negative gamma would zero out (or invert) the min-SNR weight and silently train on a degenerate loss; None is the documented disable.\n        if self.snr_gamma is not None and float(self.snr_gamma) <= 0:\n            raise ValueError(\"snr_gamma must be > 0, or null to disable min-SNR weighting\")\n        # learning_rate can arrive as a string (\"1e-4\") from the Studio config path, so coerce it before AdamW sees it.\n        try:\n            learning_rate = float(self.learning_rate)\n        except (TypeError, ValueError) as exc:\n            raise ValueError(f\"learning_rate must be a number, got {self.learning_rate!r}\") from exc\n        if learning_rate <= 0:\n            raise ValueError(\"learning_rate must be > 0\")\n        alpha = self.lora_alpha if self.lora_alpha is not None else self.lora_rank\n        targets = tuple(self.lora_target_modules) or DEFAULT_LORA_TARGETS\n        # A blank Hub token (the Studio default when none is configured) must load anonymously, not as an explicit empty credential.\n        token = self.hf_token.strip() if isinstance(self.hf_token, str) else self.hf_token\n        from core.inference.diffusion_families import (\n            _is_local_path,\n            mirror_repo,\n            prefer_ungated_mirror,","sourceCodeStart":1151,"sourceCodeEnd":1187,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/training/diffusion_train_common.py#L1151-L1187","documentation":"weighting_scheme selects the loss weighting strategy and only supports 'none' (uniform) and 'bell' (bell-shaped timestep weighting). Any other string after strip/lower normalization is rejected.","triggerScenarios":"weighting_scheme='simsnr', 'sigma-age', 'uniform', or any typo like 'bel' / 'Bell ' with stray characters that do not normalize to the two allowed values.","commonSituations":"Porting configs from other trainers (diffusers examples support schemes like 'sigma' or 'zero_snr' / 'zsnr') that this trainer does not implement.","solutions":["Use weighting_scheme='none' or 'bell'.","If you ported a diffusers example config, drop its weighting_scheme value — the closest supported behavior here is 'bell'.","Leave it unset; the default resolves to 'none'."],"exampleFix":"# before\ncfg = DiffusionLoraConfig(weighting_scheme='zero_snr')\n# after\ncfg = DiffusionLoraConfig(weighting_scheme='bell')","handlingStrategy":"validation","validationCode":"ALLOWED_WEIGHTING = {'none', 'bell'}\nws = str(weighting_scheme or 'none').strip().lower()\nassert ws in ALLOWED_WEIGHTING, f'weighting_scheme must be one of {sorted(ALLOWED_WEIGHTING)}'","typeGuard":"def is_valid_weighting_scheme(v) -> bool:\n    return str(v or 'none').strip().lower() in ('none', 'bell')","tryCatchPattern":null,"preventionTips":["Use a dropdown limited to 'none'/'bell' in the UI instead of free text.","Strip unsupported weighting schemes when importing configs from other trainers."],"tags":["training","config","loss-weighting","validation"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}