code: def train_func(config):
      start = 1
      my_model = MyModel()
  
      checkpoint = train.get_checkpoint()
      if checkpoint:
          with checkpoint.as_directory() as checkpoint_dir:
              checkpoint_dict = torch.load(
                  os.path.join(checkpoint_dir, "checkpoint.pt")
              )
              start = checkpoint_dict["epoch"] + 1
              my_model.load_state_dict(checkpoint_dict["model_state"])
  
      for epoch in range(start, config["epochs"] + 1):
          # Model training here
          # ...
  
          metrics = {"metric": 1}
          with tempfile.TemporaryDirectory() as tempdir:
              torch.save(
                  {
                      "epoch": epoch,
                      "model_state": my_model.state_dict(),
                  },
                  os.path.join(tempdir, "checkpoint.pt"),
              )
              train.report(
                  metrics=metrics,
                  checkpoint=Checkpoint.from_directory(tempdir),
              )
  
imports: import os
  import torch
  from torch import nn
  from ray import train, tune
  import random
  import os
  import tempfile
  from ray import train, tune
  from ray.train import Checkpoint
label_desc: Use image node_id 3 for calling a global function with example usage: train_func(config) without return types