W3cubDocs

/TensorFlow Python

tf.train.warm_start

tf.train.warm_start(
    ckpt_to_initialize_from,
    vars_to_warm_start='.*',
    var_name_to_vocab_info=None,
    var_name_to_prev_var_name=None
)

Defined in tensorflow/python/training/warm_starting_util.py.

Warm-starts a model using the given settings.

If you are using a tf.estimator.Estimator, this will automatically be called during training.

Args:

  • ckpt_to_initialize_from: [Required] A string specifying the directory with checkpoint file(s) or path to checkpoint from which to warm-start the model parameters.
  • vars_to_warm_start: [Optional] A regular expression that captures which variables to warm-start (see tf.get_collection). Defaults to '.*', which warm-starts all variables. If None is explicitly given, only variables specified in var_name_to_vocab_info will be warm-started.
  • var_name_to_vocab_info: [Optional] Dict of variable names (strings) to VocabInfo. The variable names should be "full" variables, not the names of the partitions. If not explicitly provided, the variable is assumed to have no vocabulary.
  • var_name_to_prev_var_name: [Optional] Dict of variable names (strings) to name of the previously-trained variable in ckpt_to_initialize_from. If not explicitly provided, the name of the variable is assumed to be same between previous checkpoint and current model.

Raises:

  • ValueError: If the WarmStartSettings contains prev_var_name or VocabInfo configuration for variable names that are not used. This is to ensure a stronger check for variable configuration than relying on users to examine the logs.

© 2018 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/train/warm_start