code: def run_identity(tmp_path: pathlib.Path):
      checkpoint_dir = str(tmp_path.joinpath("checkpoint"))
  
      config = utils.load_config(
          utils.fixtures_path("pytorch_identity/distributed.yaml")
      )
      hparams = config["hyperparameters"]
  
      exp_config = utils.make_default_exp_config(
          hparams,
          scheduling_unit=1,
          searcher_metric="validation_loss",
          checkpoint_dir=checkpoint_dir,
      )
      exp_config.update(config)
      exp_config["searcher"]["smaller_is_better"] = True
  
      # each subprocess must import separately as trial_class cannot be pickled.
      example_path = utils.fixtures_path(
          "pytorch_identity/model_def.py"
      )
      trial_class = utils.import_class_from_module(
          "IdentityPyTorchTrial", example_path
      )
      trial_class._searcher_metric = "weight"
  
      tensorboard_path = tmp_path.joinpath("tensorboard")
  
      (
          trial,
          trial_controller,
      ) = pytorch_utils.create_trial_and_trial_controller(
          trial_class=trial_class,
          hparams=hparams,
          slots_per_trial=2,
          max_batches=16,
          min_validation_batches=1,
          min_checkpoint_batches=16,
          checkpoint_dir=checkpoint_dir,
          tensorboard_path=tensorboard_path,
          aggregation_frequency=2,
      )
  
      trial_controller.run()
  
      metrics_callback = trial.metrics_callback
  
      validation_metrics = metrics_callback.validation_metrics
  
      return validation_metrics
  
imports: import contextlib
  import importlib
  import io
  import os
  import pathlib
  import sys
  import typing
  from unittest import mock
  import numpy
  import pytest
  import torch
  from _pytest import monkeypatch
  from torch.distributed import launcher
  import determined
  from determined import pytorch
  from tests.experiment import pytorch_utils, utils
  from tests.experiment.fixtures import pytorch_onevar_model
label_desc: Use image node_id 4 for calling a global function with example usage: run_identity(tmp_path) and returns: validation_metrics