code: def test_trainer_checkpoint():
      set_log_with_config(C.logging_config)
      output_dir = Path(__file__).parent / ".output"
      trainer = Trainer(
          max_iters=2,
          finite_env_type="dummy",
          callbacks=[Checkpoint(output_dir, every_n_iters=1)],
      )
      policy = _ppo_policy()
  
      vessel = TrainingVessel(
          simulator_fn=lambda init: ZeroSimulator(init),
          state_interpreter=NoopStateInterpreter(),
          action_interpreter=NoopActionInterpreter(),
          policy=policy,
          train_initial_states=list(range(100)),
          val_initial_states=list(range(10)),
          test_initial_states=list(range(10)),
          reward=AccReward(),
          episode_per_iter=100,
          update_kwargs=dict(repeat=10, batch_size=64),
      )
      trainer.fit(vessel)
  
      assert (output_dir / "001.pth").exists()
      assert (output_dir / "002.pth").exists()
      assert os.readlink(output_dir / "latest.pth") == str(
          output_dir / "002.pth"
      )
  
      trainer.load_state_dict(torch.load(output_dir / "001.pth"))
      assert trainer.current_iter == 1
      assert trainer.current_episode == 100
  
      # Reload the checkpoint at first iteration
      trainer.fit(vessel, ckpt_path=output_dir / "001.pth")
  
imports: import os
  import random
  import sys
  from pathlib import Path
  import pytest
  import torch
  import torch.nn
  from gym import spaces
  from tianshou.policy import PPOPolicy
  from qlib.config import C
  from qlib.log import set_log_with_config
  from qlib.rl.interpreter import StateInterpreter, ActionInterpreter
  from qlib.rl.simulator import Simulator
  from qlib.rl.reward import Reward
  from qlib.rl.trainer import Trainer, TrainingVessel, EarlyStopping, Checkpoint
label_desc: Use image node_id 5 for calling a global function with example usage: test_trainer_checkpoint() without return types