docstr: Restores a model's weights from a PyTorch Lightning checkpoint.
  
  Hooks are called first to give the LightningModule a chance to modify the contents, then finally the model gets
  updated with the loaded weights.
docstr_tok: ["Restores","a","model","'s","weights","from","a","PyTorch","Lightning","checkpoint",".","Hooks","are","called","first","to","give","the","LightningModule","a","chance","to","modify","the","contents",",","then","finally","the","model","gets","updated","with","the","loaded","weights","."]
code: def restore_model(self) -> None:
      """Restores a model's weights from a PyTorch Lightning checkpoint.
  
      Hooks are called first to give the LightningModule a chance to modify the contents, then finally the model gets
      updated with the loaded weights.
  
      """
      if not self._loaded_checkpoint:
          return
  
      trainer = self.trainer
      # hook: give user access to checkpoint if needed.
      call._call_lightning_module_hook(
          trainer, "on_load_checkpoint", self._loaded_checkpoint
      )
  
      # restore model state_dict
      trainer.strategy.load_model_state_dict(self._loaded_checkpoint)
  
imports: import logging
  import os
  import re
  from typing import Any, Dict, Optional
  import torch
  from fsspec.core import url_to_fs
  from fsspec.implementations.local import LocalFileSystem
  from torch import Tensor
  import lightning.pytorch
  from lightning.fabric.plugins.environments.slurm import SLURMEnvironment
  from lightning.fabric.utilities.cloud_io import _is_dir, get_filesystem
  from lightning.fabric.utilities.types import _PATH
  from lightning.pytorch.callbacks import ModelCheckpoint
  from lightning.pytorch.plugins.precision import MixedPrecision
  from lightning.pytorch.trainer import call
  from lightning.pytorch.trainer.states import TrainerFn
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from lightning.pytorch.utilities.imports import _OMEGACONF_AVAILABLE
  from lightning.pytorch.utilities.migration import pl_legacy_patch
  from lightning.pytorch.utilities.migration.utils import _pl_migrate_checkpoint
  from lightning.pytorch.utilities.rank_zero import rank_zero_info, rank_zero_warn
label_desc: Use image node_id 9 for calling the _CheckpointConnector obj's underlying member method code with example usage: obj.restore_model() without return types