code: def train_func(config):
      step = 0
      width, height = config["width"], config["height"]
  
      checkpoint = train.get_checkpoint()
      if checkpoint:
          with checkpoint.as_directory() as checkpoint_dir:
              with open(
                  os.path.join(checkpoint_dir, "checkpoint.json")
              ) as f:
                  state = json.load(f)
              step = state["step"] + 1
  
      for step in range(step, 100):
          intermediate_score = evaluation_fn(step, width, height)
  
          with tempfile.TemporaryDirectory() as temp_checkpoint_dir:
              with open(
                  os.path.join(temp_checkpoint_dir, "checkpoint.json"),
                  "w",
              ) as f:
                  json.dump({"step": step}, f)
              train.report(
                  {"iterations": step, "mean_loss": intermediate_score},
                  checkpoint=Checkpoint.from_directory(
                      temp_checkpoint_dir
                  ),
              )
  
file_path: ray/python/ray/tune/examples/custom_func_checkpointing.py
imports: import argparse
  import json
  import os
  import tempfile
  import time
  from ray import train, tune
  from ray.train import Checkpoint
label_desc: Use image node_id 2 for calling a global function with example usage: train_func(config) without return types