c141e570011e7adf3634bd65a3e7de30d8fbdca2,opennmt/utils/checkpoint.py,,average_checkpoints,#Any#Any#Any#Any#,190

Before Change


    for name in avg_values:
      avg_values[name] += reader.get_tensor(name) / num_checkpoints

  latest_step = int(checkpoints_path[-1].split("-")[-1])
  return _create_checkpoint_from_variables(
      avg_values,
      output_dir,

After Change


  tf.logging.info("Listing variables...")

  new_variables = {}
  for i, checkpoint_path in enumerate(checkpoints_path):
    tf.logging.info("Loading checkpoint %s" % checkpoint_path)
    variables = get_checkpoint_variables(checkpoint_path)
    for name, value in six.iteritems(variables):
      if _variable_is_trainable(name, value):
        scaled_value = value / num_checkpoints
        if name in new_variables:
          new_variables[name] += scaled_value
        else:
          new_variables[name] = scaled_value
      elif i + 1 == num_checkpoints:  // Take non trainable variables from the last checkpoint.
        new_variables[name] = value

  return _create_checkpoint_from_variables(
      new_variables,
      output_dir,
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: OpenNMT/OpenNMT-tf
Commit Name: c141e570011e7adf3634bd65a3e7de30d8fbdca2
Time: 2018-10-18
Author: guillaumekln@users.noreply.github.com
File Name: opennmt/utils/checkpoint.py
Class Name:
Method Name: average_checkpoints


Project Name: undertheseanlp/underthesea
Commit Name: 3a5abc1ad1da00175577c1e65f90d0b17e2b1bd8
Time: 2020-11-02
Author: anhv.ict91@gmail.com
File Name: underthesea/corpus/validate_corpus.py
Class Name:
Method Name: validate_sentence


Project Name: kmike/pymorphy2
Commit Name: 70544ffd30d161dd981e6d9c6fd8978803684722
Time: 2012-11-14
Author: kmike84@gmail.com
File Name: tests/test_fuzzy.py
Class Name:
Method Name: iter_suite