code: def train_func(config):
      step = 0
      checkpoint = train.get_checkpoint()
      if checkpoint:
          with checkpoint.as_directory() as checkpoint_dir:
              with open(
                  os.path.join(checkpoint_dir, "checkpoint.json")
              ) as f:
                  step = json.load(f)["timestep"] + 1
  
      for timestep in range(step, 100):
          v = np.tanh(float(timestep) / config.get("width", 1))
          v *= config.get("height", 1)
  
          # Checkpoint the state of the training every 3 steps
          # Note that this is only required for certain schedulers
          with tempfile.TemporaryDirectory() as temp_checkpoint_dir:
              checkpoint = None
              if timestep % 3 == 0:
                  with open(
                      os.path.join(
                          temp_checkpoint_dir, "checkpoint.json"
                      ),
                      "w",
                  ) as f:
                      json.dump({"timestep": timestep}, f)
                  checkpoint = Checkpoint.from_directory(
                      temp_checkpoint_dir
                  )
  
              # Here we use `episode_reward_mean`, but you can also report other
              # objectives such as loss or accuracy.
              train.report(
                  {"episode_reward_mean": v}, checkpoint=checkpoint
              )
  
file_path: ray/python/ray/tune/examples/hyperband_function_example.py
imports: import argparse
  import json
  import os
  import tempfile
  import numpy
  import ray
  from ray import train, tune
  from ray.train import Checkpoint
  from ray.tune.schedulers import HyperBandScheduler
label_desc: Use image node_id 1 for calling a global function with example usage: train_func(config) without return types