ad34b621b0fdecc323473bf7e4367c13f1ab1c4d,official/nlp/albert/run_squad.py,,main,#Any#,81

Before Change


      num_gpus=FLAGS.num_gpus,
      all_reduce_alg=FLAGS.all_reduce_alg,
      tpu_address=FLAGS.tpu)
  if FLAGS.mode in ("train", "train_and_predict"):
    train_squad(strategy, input_meta_data, run_eagerly=FLAGS.run_eagerly)
  if FLAGS.mode in ("predict", "train_and_predict"):
    predict_squad(strategy, input_meta_data)

After Change


  if "predict" in FLAGS.mode:
    predict_squad(strategy, input_meta_data)
  if "eval" in FLAGS.mode:
    eval_metrics = eval_squad(strategy, input_meta_data)
    f1_score = eval_metrics["final_f1"]
    logging.info("SQuAD eval F1-score: %f", f1_score)
    summary_dir = os.path.join(FLAGS.model_dir, "summaries", "eval")
    summary_writer = tf.summary.create_file_writer(summary_dir)
    with summary_writer.as_default():
      // TODO(lehou): write to the correct step number.
      tf.summary.scalar("F1-score", f1_score, step=0)
      summary_writer.flush()
    // Also write eval_metrics to json file.
    squad_lib_sp.write_to_json_files(
        eval_metrics, os.path.join(summary_dir, "eval_metrics.json"))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: tensorflow/models
Commit Name: ad34b621b0fdecc323473bf7e4367c13f1ab1c4d
Time: 2020-03-30
Author: gardener@tensorflow.org
File Name: official/nlp/albert/run_squad.py
Class Name:
Method Name: main


Project Name: tensorflow/models
Commit Name: 1ec383c8988d15b6c47c9565c8e3935574c14f86
Time: 2020-03-23
Author: gardener@tensorflow.org
File Name: official/nlp/bert/run_squad.py
Class Name:
Method Name: main


Project Name: tensorflow/magenta
Commit Name: d4aaa9a3cb8c437898fdb5a1ec2df94c5202e444
Time: 2018-01-11
Author: curtis@thefjord.org
File Name: magenta/models/music_vae/music_vae_train.py
Class Name:
Method Name: train