def _save_dev_predictions(self, val_batched):
    """Save model predictions for the dev set.

    This is used to compute Fever F1 as stopping metric

    Args:
      val_batched: The batched validation set.
    """
    unbatched = val_batched.unbatch()
    if self._model is None:
      raise ValueError('Model is not initialized.')
    model_predictions = self._model.predict(val_batched)
    claim_probs = model_predictions['claim_classification']
    evidence_probs = model_predictions['evidence_matching']
    predictions = []
    # Extra _ is the label, which we don't need
    for (ex, _), claim_prob, evidence_prob in tqdm.tqdm(
        zip(unbatched, claim_probs, evidence_probs), mininterval=5):
      predictions.append({
          'claim_prob': claim_prob.tolist(),
          'evidence_prob': evidence_prob.tolist(),
          'metadata': json.loads(ex['metadata'].numpy().decode('utf8'))
      })
    pred_path = os.path.join(self._model_config.model_checkpoint,
                             'val_predictions.json')
    with util.safe_open(pred_path, 'w') as f:
      json.dump({'predictions': predictions}, f)
Save model predictions for the dev set.

    This is used to compute Fever F1 as stopping metric

    Args:
      val_batched: The batched validation set.
    
language/serene/training.py