Stability-AI/generative-models · warning

Checkpoint path is deprecated, use `checkpoint_egnine` inste

Error message

Checkpoint path is deprecated, use `checkpoint_egnine` instead

What it means

AutoencodingLayer / AutoencoderKL-style __init__ warns that passing a ckpt_path string is deprecated in favor of a checkpoint_engine object (Lightning's checkpoint engine abstraction). It is a warning, not a raise: the path is still applied via apply_ckpt, but asserts that ckpt_engine is not also set.

Source

Thrown at sgm/models/autoencoder.py:166

                [{} for _ in range(len(self.trainable_ae_params))],
            )
            assert len(self.ae_optimizer_args) == len(self.trainable_ae_params)
        else:
            self.ae_optimizer_args = [{}]  # makes type consitent

        self.trainable_disc_params = trainable_disc_params
        if self.trainable_disc_params is not None:
            self.disc_optimizer_args = default(
                disc_optimizer_args,
                [{} for _ in range(len(self.trainable_disc_params))],
            )
            assert len(self.disc_optimizer_args) == len(self.trainable_disc_params)
        else:
            self.disc_optimizer_args = [{}]  # makes type consitent

        if ckpt_path is not None:
            assert ckpt_engine is None, "Can't set ckpt_engine and ckpt_path"
            logpy.warn("Checkpoint path is deprecated, use `checkpoint_egnine` instead")
        self.apply_ckpt(default(ckpt_path, ckpt_engine))
        self.additional_decode_keys = set(default(additional_decode_keys, []))

    def get_input(self, batch: Dict) -> torch.Tensor:
        # assuming unified data format, dataloader returns a dict.
        # image tensors should be scaled to -1 ... 1 and in channels-first
        # format (e.g., bchw instead if bhwc)
        return batch[self.input_key]

    def get_autoencoder_params(self) -> list:
        params = []
        if hasattr(self.loss, "get_trainable_autoencoder_parameters"):
            params += list(self.loss.get_trainable_autoencoder_parameters())
        if hasattr(self.regularization, "get_trainable_parameters"):
            params += list(self.regularization.get_trainable_parameters())
        params = params + list(self.encoder.parameters())
        params = params + list(self.decoder.parameters())
        return params

View on GitHub (pinned to e8cd657656)

Solutions

  1. Replace ckpt_path with a checkpoint_engine in the model config
  2. Keep ckpt_path if you accept the deprecation warning (behavior still works)
  3. Load the checkpoint manually after model construction with model.load_state_dict(torch.load(path)['state_dict'], strict=False)

Example fix

// before
model = AutoencoderKL(..., ckpt_path="ae.ckpt")
// after
from pytorch_lightning.futilities import ...
model = AutoencoderKL(..., ckpt_engine=my_checkpoint_engine)
Defensive patterns

Strategy: validation

Validate before calling

params = cfg["params"]
if "ckpt_path" in params:
    assert "ckpt_engine" not in params, "set only one of ckpt_path/ckpt_engine"
    warnings.warn("migrate ckpt_path -> checkpoint_engine")

Type guard

def uses_deprecated_ckpt(params: dict) -> bool:
    return "ckpt_path" in params and "ckpt_engine" not in params

Try / catch

try:
    model = instantiate_from_config(config)
except AssertionError as e:
    if "ckpt_engine" in str(e):
        config["params"].pop("ckpt_path")
        model = instantiate_from_config(config)

Prevention

When it happens

Trigger: Instantiating an autoencoder model from config with `params: {ckpt_path: 'path/to/ckpt'}` while ckpt_engine is None — typical after upgrading sgm/Stable Diffusion code to a Lightning 2.x-style checkpointing API.

Common situations: Old YAML configs (SD 2.x era) reused with newer code; migrating from pl Lightning 'ckpt_path' conventions to 'checkpoint_egnine' (note the code's own typo) engines.

Related errors


AI-assisted analysis of Stability-AI/generative-models@e8cd657656 (2026-08-29). Data as JSON: /api/errors/26ccd7b33f9862a1. Report an issue: GitHub.