docstr: This test exists to validate the checkpoint load path from older checkpoints into
  post-Trainer API checkpoints. Trainer API deprecated workload_sequencer.pkl and
  replaced it with trial_state.pkl. It can be deleted some time after Trainer API release.
code: def test_legacy_checkpoint_loading(
      self, tmp_path: pathlib.Path, ckpt: str
  ):
      """
      This test exists to validate the checkpoint load path from older checkpoints into
      post-Trainer API checkpoints. Trainer API deprecated workload_sequencer.pkl and
      replaced it with trial_state.pkl. It can be deleted some time after Trainer API release.
      """
      checkpoint_dir = os.path.join(
          utils.fixtures_path("ancient-checkpoints"), f"{ckpt}"
      )
      tensorboard_path = tmp_path.joinpath("tensorboard")
  
      (
          trial,
          trial_controller,
      ) = pytorch_utils.create_trial_and_trial_controller(
          trial_class=pytorch_onevar_model.OneVarTrial,
          hparams={
              "dataloader_type": "determined",
              "global_batch_size": 16,
          },
          trial_seed=0,
          max_batches=1,
          min_validation_batches=1,
          min_checkpoint_batches=1,
          checkpoint_dir=checkpoint_dir,
          tensorboard_path=tensorboard_path,
      )
  
      # Manually set trial ID to match checkpoint.
      trial_controller.trial_id = 1
  
      # Load checkpoint.
      trial_controller._load(pathlib.Path(checkpoint_dir))
  
      # Verify checkpoint loaded state.
      state = trial_controller.state
      assert state.trial_id == 1, "trial_id does not match"
      assert state.last_ckpt == 1, "last_ckpt does not match"
      assert state.step_id == 1, "step_id does not match"
      assert state.last_val == 0, "last_val does not match"
      assert (
          state.batches_trained == 1
      ), "batches_trained does not match"
      assert state.epochs_trained == 0, "epochs_trained does not match"
  
imports: import contextlib
  import importlib
  import io
  import os
  import pathlib
  import sys
  import typing
  from unittest import mock
  import numpy
  import pytest
  import torch
  from _pytest import monkeypatch
  from torch.distributed import launcher
  import determined
  from determined import pytorch
  from tests.experiment import pytorch_utils, utils
  from tests.experiment.fixtures import pytorch_onevar_model
label_desc: Use image node_id 36 for calling the TestPyTorchTrial obj's underlying member method code with example usage: obj.test_legacy_checkpoint_loading(tmp_path, ckpt) without return types