hunk.code_window:         # Don't report if just doing initial validation sanity checks.
           if trainer.running_sanity_check:
               return
           report_dict = {}
           for key in self._metrics:
               if isinstance(self._metrics, dict):
                   metric = self._metrics[key]
               else:
                   metric = key
               report_dict[key] = trainer.callback_metrics[metric].item()
           tune.report(**report_dict)
  
hunk.labels: keep keep keep replace replace replace replace replace replace replace keep keep keep
hunk.after_edit:         if not self._metrics:
               report_dict = {
                   k: v.item()
                   for k, v in trainer.callback_metrics.items()
               }
           else:
               report_dict = {}
               for key in self._metrics:
                   if isinstance(self._metrics, dict):
                       metric = self._metrics[key]
                   else:
                       metric = key
                   report_dict[key] = trainer.callback_metrics[metric].item()
  
hunk.file_path: python/ray/tune/integration/pytorch_lightning.py
hunk.type: replace
file: cartpole-a2c:
      env: CartPole-v0
      run: A2C
      stop:
          episode_reward_mean: 150
          timesteps_total: 500000
      config:
          # Works for both torch and tf.
          framework: tf
          num_workers: 0
          lr: 0.001
  