code: def load(self, tag: str):
      try:
          path = self.log_dir.joinpath(f"{tag}.pt.tar")
          state = pt.load(
              path,
              map_location=f"cuda:{self.cuda_device}"
              if self.cuda_device >= 0
              else "cpu",
          )
          print(f"Load checkpoint from {path}")
      except FileNotFoundError:
          raise ValueError(f"invalid tag {tag}")
      module_state = state.get("model")
      if module_state is None:
          raise KeyError("the checkpoint does not have model data.")
      self.model.load_state_dict(module_state)
  
imports: from __future__ import annotations
  from typing import TYPE_CHECKING, Optional, Iterable, Iterator
  from pathlib import Path
  import math
  from tqdm import tqdm
  from torch import Tensor
  from torch import nn
  from torch.utils.data import Dataset, DataLoader
  import torch
  import numpy
label_desc: Use image node_id 2 for calling the Evaluator obj's underlying member method code with example usage: obj.load(tag) without return types