code: def test_load_checkpoint(self):
      with tempfile.NamedTemporaryFile() as checkpoint_file:
          train_data = tests_module.test_file("train_data_tiny.tsv")
          eval_data = tests_module.test_file("test_data_tiny.tsv")
          config = PyTextConfig(
              task=DocumentClassificationTask.Config(
                  data=Data.Config(
                      source=TSVDataSource.Config(
                          train_filename=train_data,
                          eval_filename=eval_data,
                          field_names=["label", "slots", "text"],
                      )
                  )
              ),
              version=LATEST_VERSION,
              save_snapshot_path=checkpoint_file.name,
          )
          task = create_task(config.task)
          model = task.model
          # test checkpoint saving and loading
          optimizer = create_optimizer(Adam.Config(), model)
          scheduler = create_scheduler(Scheduler.Config(), optimizer)
          training_state = TrainingState(
              model=model,
              optimizer=optimizer,
              scheduler=scheduler,
              start_time=0,
              epoch=0,
              rank=0,
              stage=Stage.TRAIN,
              epochs_since_last_improvement=0,
              best_model_state=None,
              best_model_metric=None,
              tensorizers=task.data.tensorizers,
          )
  
          id = "epoch-1"
          saved_path = save(
              config,
              model,
              None,
              task.data.tensorizers,
              training_state,
              id,
          )
          # TODO: fix get_latest_checkpoint_path T53664139
          # self.assertEqual(saved_path, get_latest_checkpoint_path())
          (
              task_restored,
              config_restored,
              training_state_restored,
          ) = load(saved_path)
          self.assertCheckpointEqual(
              model,
              config,
              training_state,
              task_restored.model,
              config_restored,
              training_state_restored,
          )
  
imports: import itertools
  import tempfile
  import unittest
  import torch
  from pytext.common.constants import Stage
  from pytext.config import LATEST_VERSION, PyTextConfig
  from pytext.config.component import create_optimizer, create_scheduler
  from pytext.data import Data
  from pytext.data.sources.tsv import BlockShardedTSVDataSource, TSVDataSource
  from pytext.optimizer import Adam
  from pytext.optimizer.scheduler import Scheduler
  from pytext.task import create_task
  from pytext.task.serialize import get_latest_checkpoint_path, load, save
  from pytext.task.tasks import DocumentClassificationTask
  from pytext.trainers.training_state import TrainingState
  from pytext.utils import test
label_desc: Use image node_id 5 for calling the TaskLoadSaveTest obj's underlying member method code with example usage: obj.test_load_checkpoint() without return types