code: def test_load_pretrained_params(tmpdir_factory):
      model = nn.Sequential(nn.Linear(8, 8), nn.ReLU(), nn.Linear(8, 4))
      # Retrieve this URL
      url = "https://github.com/mindee/doctr/releases/download/v0.2.1/tmp_checkpoint-6f0ce0e6.pt"
      # Temp cache dir
      cache_dir = tmpdir_factory.mktemp("cache")
      # Pass an incorrect hash
      with pytest.raises(ValueError):
          load_pretrained_params(
              model, url, "mywronghash", cache_dir=str(cache_dir)
          )
      # Let it resolve the hash from the file name
      load_pretrained_params(model, url, cache_dir=str(cache_dir))
      # Check that the file was downloaded & the archive extracted
      assert os.path.exists(
          cache_dir.join("models").join(
              url.rpartition("/")[-1].split("&")[0]
          )
      )
      # Check ignore keys
      load_pretrained_params(
          model, url, cache_dir=str(cache_dir), ignore_keys=["2.weight"]
      )
      # non matching keys
      model = nn.Sequential(
          nn.Linear(8, 8),
          nn.ReLU(),
          nn.Linear(8, 4),
          nn.ReLU(),
          nn.Linear(4, 1),
      )
      with pytest.raises(ValueError):
          load_pretrained_params(
              model,
              url,
              cache_dir=str(cache_dir),
              ignore_keys=["2.weight"],
          )
  
file_path: doctr/tests/pytorch/test_models_utils_pt.py
imports: import os
  import pytest
  import torch
  from torch import nn
  from doctr.models.utils import _bf16_to_float32, _copy_tensor, conv_sequence_pt, load_pretrained_params, set_device_and_dtype
label_desc: Use image node_id 3 for calling a global function with example usage: test_load_pretrained_params(tmpdir_factory) without return types