code: def load_pretrained_params(
      model: nn.Module,
      url: Optional[str] = None,
      hash_prefix: Optional[str] = None,
      ignore_keys: Optional[List[str]] = None,
      **kwargs: Any,
  ) -> None:
      """Load a set of parameters onto a model
  
      >>> from doctr.models import load_pretrained_params
      >>> load_pretrained_params(model, "https://yoursource.com/yourcheckpoint-yourhash.zip")
  
      Args:
      ----
          model: the PyTorch model to be loaded
          url: URL of the zipped set of parameters
          hash_prefix: first characters of SHA256 expected hash
          ignore_keys: list of weights to be ignored from the state_dict
          **kwargs: additional arguments to be passed to `doctr.utils.data.download_from_url`
      """
      if url is None:
          logging.warning(
              "Invalid model URL, using default initialization."
          )
      else:
          archive_path = download_from_url(
              url,
              hash_prefix=hash_prefix,
              cache_subdir="models",
              **kwargs,
          )
  
          # Read state_dict
          state_dict = torch.load(archive_path, map_location="cpu")
  
          # Remove weights from the state_dict
          if ignore_keys is not None and len(ignore_keys) > 0:
              for key in ignore_keys:
                  state_dict.pop(key)
              missing_keys, unexpected_keys = model.load_state_dict(
                  state_dict, strict=False
              )
              if (
                  set(missing_keys) != set(ignore_keys)
                  or len(unexpected_keys) > 0
              ):
                  raise ValueError(
                      "unable to load state_dict, due to non-matching keys."
                  )
          else:
              # Load weights
              model.load_state_dict(state_dict)
  
file_path: doctr/doctr/models/utils/pytorch.py
imports: import logging
  from typing import Any, List, Optional, Tuple, Union
  import torch
  from torch import nn
  from doctr.utils.data import download_from_url
label_desc: Use image node_id 3 for calling a global function with example usage: load_pretrained_params(model, url, hash_prefix, ignore_keys) without return types