{"record":{"id":"86440dffd5de4eca","repo":"Stability-AI/generative-models","slug":"parameter-lossconfig-is-deprecated-use-loss-co","errorCode":null,"errorMessage":"Parameter `lossconfig` is deprecated, use `loss_config`.","messagePattern":"Parameter `lossconfig` is deprecated, use `loss_config`\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"sgm/models/autoencoder.py","lineNumber":532,"sourceCode":"                \"target\": (\n                    \"sgm.modules.autoencoding.regularizers\"\n                    \".DiagonalGaussianRegularizer\"\n                )\n            },\n            **kwargs,\n        )\n\n\nclass AutoencoderLegacyVQ(AutoencodingEngineLegacy):\n    def __init__(\n        self,\n        embed_dim: int,\n        n_embed: int,\n        sane_index_shape: bool = False,\n        **kwargs,\n    ):\n        if \"lossconfig\" in kwargs:\n            logpy.warn(f\"Parameter `lossconfig` is deprecated, use `loss_config`.\")\n            kwargs[\"loss_config\"] = kwargs.pop(\"lossconfig\")\n        super().__init__(\n            regularizer_config={\n                \"target\": (\n                    \"sgm.modules.autoencoding.regularizers.quantize\" \".VectorQuantizer\"\n                ),\n                \"params\": {\n                    \"n_e\": n_embed,\n                    \"e_dim\": embed_dim,\n                    \"sane_index_shape\": sane_index_shape,\n                },\n            },\n            **kwargs,\n        )\n\n\nclass IdentityFirstStage(AbstractAutoencoder):\n    def __init__(self, *args, **kwargs):","sourceCodeStart":514,"sourceCodeEnd":550,"githubUrl":"https://github.com/Stability-AI/generative-models/blob/e8cd657656fa5d61688191730d0e03242bf4ed44/sgm/models/autoencoder.py#L514-L550","documentation":"VectorQuantizer wrapper's __init__ accepts kwargs and renames the legacy 'lossconfig' key to 'loss_config' before delegating to super(), logging a deprecation warning. This is a backward-compatibility shim for old SD VQModel configs.","triggerScenarios":"Instantiating a VQModel from an old config YAML containing `lossconfig: {target: ...}` instead of the new `loss_config` key.","commonSituations":"Reusing SD 1.x / latent-diffusion VQ config files with the newer generative-models (sgm) codebase; copying old model cards' configs verbatim.","solutions":["Rename 'lossconfig' to 'loss_config' in your YAML config","Keep the old key if the warning is acceptable (it is auto-mapped)","Update the config from the repository's current VQModel example configs"],"exampleFix":"// before\nlossconfig:\n  target: sgm.modules.autoencoding.losses.LPIPSWithDiscriminator\n// after\nloss_config:\n  target: sgm.modules.autoencoding.losses.LPIPSWithDiscriminator","handlingStrategy":"validation","validationCode":"if \"lossconfig\" in vq_params:\n    vq_params[\"loss_config\"] = vq_params.pop(\"lossconfig\")","typeGuard":"def normalize_vq_config(params: dict) -> dict:\n    return {\"loss_config\" if k == \"lossconfig\" else k: v for k, v in params.items()}","tryCatchPattern":"try:\n    model = instantiate_from_config(config)\nexcept Exception:\n    config[\"params\"] = normalize_vq_config(config.get(\"params\", {}))\n    model = instantiate_from_config(config)","preventionTips":["Audit legacy SD 1.x configs for 'lossconfig'","Prefer loss_config in all new configs","Silence-or-fail on deprecation warnings in CI"],"tags":["python","deprecation","config","yaml"],"backgroundTag":"deprecated-config-key","analyzedSha":"e8cd657656fa5d61688191730d0e03242bf4ed44","analyzedAt":"2026-08-29T11:23:43.234Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}