class_docstr: Abstract model class with some utilities function.
class_docstr_tok: ["Abstract","model","class","with","some","utilities","function","."]
docstr: Load checkpoint from a given url or file.
  
  Args:
      checkpoint: The url or filepath for the respective checkpoint
      device: The desired device to load the weights and move the model
docstr_tok: ["Load","checkpoint","from","a","given","url","or","file",".","Args",":","checkpoint",":","The","url","or","filepath","for","the","respective","checkpoint","device",":","The","desired","device","to","load","the","weights","and","move","the","model"]
code: def load_checkpoint(
      self, checkpoint: str, device: Optional[torch.device] = None
  ) -> None:
      """Load checkpoint from a given url or file.
  
      Args:
          checkpoint: The url or filepath for the respective checkpoint
          device: The desired device to load the weights and move the model
      """
  
      if os.path.isfile(checkpoint):
          with open(checkpoint, "rb") as f:
              state_dict = torch.load(f, map_location=device)
      else:
          state_dict = torch.hub.load_state_dict_from_url(
              checkpoint, map_location=device
          )
  
      self.load_state_dict(state_dict)
  
file_path: kornia/kornia/contrib/models/base.py
imports: from __future__ import annotations
  import os
  from abc import ABC, abstractmethod
  from typing import Any, Generic, Optional, TypeVar, cast
  import torch
  from kornia.core import Module
label_desc: Use image node_id 1 for calling the ModelBase obj's underlying member method code with example usage: obj.load_checkpoint(checkpoint, device) without return types