code: def load_trial_checkpoint_data(trial_dir: str) -> TrialCheckpointData:
      params_file = os.path.join(trial_dir, "params.json")
      if os.path.exists(params_file):
          with open(params_file, "rt") as f:
              params = json.load(f)
      else:
          params = {}
  
      result_file = os.path.join(trial_dir, "result.json")
      if os.path.exists(result_file):
          results = []
          with open(result_file, "rt") as f:
              for line in f.readlines():
                  results.append(json.loads(line))
      else:
          results = []
  
      progress_file = os.path.join(trial_dir, "progress.csv")
      if os.path.exists(progress_file):
          with open(progress_file, "rt") as f:
              reader = csv.DictReader(f)
              progress = list(reader)
      else:
          progress = []
  
      checkpoints = []
      num_skipped = 0
      for cp_dir in sorted(os.listdir(trial_dir)):
          if not cp_dir.startswith("checkpoint_"):
              continue
  
          cp_full_dir = os.path.join(trial_dir, cp_dir)
          json_path = os.path.join(
              cp_full_dir, CHECKPOINT_DATA_FILENAME
          )
  
          if os.path.exists(json_path):
              with open(json_path, "rb") as f:
                  checkpoint_data = pickle.load(f)
          else:
              # If neither file exists, this means the checkpoint got only synced half,
              # so we should skip it
              continue
          checkpoints.append((cp_dir, checkpoint_data))
  
      # Load the artifact data
      trial_artifact_path = os.path.join(trial_dir, ARTIFACT_FILENAME)
      artifact_data = None
      if os.path.exists(trial_artifact_path):
          with open(trial_artifact_path, "r") as f:
              artifact_data = f.read()
  
      return TrialCheckpointData(
          params=params,
          results=results,
          progress=progress,
          checkpoints=checkpoints,
          num_skipped=num_skipped,
          artifact_data=artifact_data,
      )
  
imports: import argparse
  import csv
  import io
  import tarfile
  from dataclasses import dataclass
  import json
  import os
  import pickle
  import platform
  import re
  import shutil
  import signal
  import subprocess
  import tempfile
  import time
  from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple
  import ray
  from ray.train._internal.storage import StorageContext
  from ray.tune.execution.experiment_state import _find_newest_experiment_checkpoint
  from ray.tune.result import _get_defaults_results_dir
  from ray.tune.utils.serialization import TuneFunctionDecoder
label_desc: Use image node_id 19 for calling a global function with example usage: load_trial_checkpoint_data(trial_dir) and returns: TrialCheckpointData