load_embedding_initializer( ckpt_path, embedding_tensor_name, new_vocab_size, embedding_dim, old_vocab_file, new_vocab_file, num_oov_buckets=0, initializer=None, max_rows_in_memory=-1 )
Returns a variable initializer for loading pre-trained embeddings.
load_and_remap_matrix_initializer() specialized for loading embedding weights and remapping according to the provided vocab files. See docs for
load_and_remap_matrix_initializer() for more details.
NOTE: Only for use with div-partitioned variables / vocabularies.
ckpt_path: Path to the TensorFlow checkpoint (version 2,
TensorBundle) from which the old matrix
Tensorwill be loaded.
embedding_tensor_name: Name of the 2-D
Tensorto load from checkpoint.
new_vocab_size: Number of entries in the new vocab.
intspecifying the dimension of the embedding vectors from the checkpoint. Must match the number of columns in the old embedding matrix.
old_vocab_file: A scalar
stringcontaining the path to the old vocabulary file.
new_vocab_file: A scalar
stringcontaining the path to the new vocabulary file.
intspecifying the number of out-of-vocabulary buckets to use. Must be >= 0.
initializer: Initializer function that accepts a 1-D tensor as the arg to specify the shape of the returned tensor. If
None, defaults to using
intspecifying the maximum number of rows to load from the checkpoint at once. If less than or equal to 0, the entire matrix will be loaded into memory. Setting this arg trades increased disk reads for lower memory usage.
A variable initializer function.
© 2017 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.