def download_model_from_registry(ckpt_path: Optional[_PATH], trainer: "pl.Trainer") -> None:
    """Download a model from the Lightning Model Registry."""
    if trainer.local_rank == 0:
        if not module_available("litmodels"):
            raise ImportError(
                "The `litmodels` package is not installed. Please install it with `pip install litmodels`."
            )

        from litmodels import download_model

        model_registry = _determine_model_name(ckpt_path, trainer._model_registry)
        local_model_dir = _determine_model_folder(model_registry, trainer.default_root_dir)

        # print(f"Rank {self.trainer.local_rank} downloads model checkpoint '{model_registry}'")
        model_files = download_model(model_registry, download_dir=local_model_dir)
        # print(f"Model checkpoint '{model_registry}' was downloaded to '{local_model_dir}'")
        if not model_files:
            raise RuntimeError(f"Download model failed - {model_registry}")

    trainer.strategy.barrier("download_model_from_registry")
Download a model from the Lightning Model Registry.
src/lightning/pytorch/utilities/model_registry.py