average_checkpoints_into_layer

opennmt.utils.average_checkpoints_into_layer(checkpoints, layer, layer_prefix)[source]

Updates the layer weights with their average value in the checkpoints.

Parameters
  • checkpoints – A non empty list of checkpoint paths.

  • layer – A tf.keras.layers.Layer instance.

  • layer_prefix – The name/scope that prefixes the layer variables names in the checkpoints.

Raises
  • ValueError – if checkpoints is empty.

  • ValueError – if layer is not already built.