Args:
new_vocab: [Required] A path to the new vocabulary file (used with the model
to be trained).
new_vocab_size: [Required] An integer indicating how many entries of the new
vocabulary will used in training.
num_oov_buckets: [Required] An integer indicating how many OOV buckets are
associated with the vocabulary.
old_vocab: [Required] A path to the old vocabulary file (used with the
checkpoint to be warm-started from).
old_vocab_size: [Optional] An integer indicating how many entries of the old
vocabulary were used in the creation of the checkpoint. If not provided,
the entire old vocabulary will be used.
backup_initializer: [Optional] A variable initializer used for variables
corresponding to new vocabulary entries and OOV. If not provided, these
entries will be zero-initialized.
axis: [Optional] Denotes what axis the vocabulary corresponds to. The
default, 0, corresponds to the most common use case (embeddings or
linear weights for binary classification / regression). An axis of 1
could be used for warm-starting output layers with class vocabularies.
Returns:
A VocabInfo which represents the vocabulary information for warm-starting.
[null,null,["Last updated 2024-01-23 UTC."],[],[],null,["# tf.estimator.VocabInfo\n\n\u003cbr /\u003e\n\n|------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.15.0.post1/tensorflow/python/training/warm_starting_util.py#L32-L129) |\n\nVocabulary information for warm-starting. (deprecated)\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.estimator.VocabInfo`](https://www.tensorflow.org/api_docs/python/tf/estimator/VocabInfo), [`tf.compat.v1.train.VocabInfo`](https://www.tensorflow.org/api_docs/python/tf/estimator/VocabInfo)\n\n\u003cbr /\u003e\n\n tf.estimator.VocabInfo(\n new_vocab,\n new_vocab_size,\n num_oov_buckets,\n old_vocab,\n old_vocab_size=-1,\n backup_initializer=None,\n axis=0\n )\n\n| **Deprecated:** THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use tf.keras instead.\n\nSee [`tf.estimator.WarmStartSettings`](../../tf/estimator/WarmStartSettings) for examples of using\nVocabInfo to warm-start.\n\nArgs:\nnew_vocab: \\[Required\\] A path to the new vocabulary file (used with the model\nto be trained).\nnew_vocab_size: \\[Required\\] An integer indicating how many entries of the new\nvocabulary will used in training.\nnum_oov_buckets: \\[Required\\] An integer indicating how many OOV buckets are\nassociated with the vocabulary.\nold_vocab: \\[Required\\] A path to the old vocabulary file (used with the\ncheckpoint to be warm-started from).\nold_vocab_size: \\[Optional\\] An integer indicating how many entries of the old\nvocabulary were used in the creation of the checkpoint. If not provided,\nthe entire old vocabulary will be used.\nbackup_initializer: \\[Optional\\] A variable initializer used for variables\ncorresponding to new vocabulary entries and OOV. If not provided, these\nentries will be zero-initialized.\naxis: \\[Optional\\] Denotes what axis the vocabulary corresponds to. The\ndefault, 0, corresponds to the most common use case (embeddings or\nlinear weights for binary classification / regression). An axis of 1\ncould be used for warm-starting output layers with class vocabularies.\n\nReturns:\nA `VocabInfo` which represents the vocabulary information for warm-starting.\n\nRaises:\nValueError: `axis` is neither 0 or 1. \n\n Example Usage:\n\n embeddings_vocab_info = tf.VocabInfo(\n new_vocab='embeddings_vocab',\n new_vocab_size=100,\n num_oov_buckets=1,\n old_vocab='pretrained_embeddings_vocab',\n old_vocab_size=10000,\n backup_initializer=tf.compat.v1.truncated_normal_initializer(\n mean=0.0, stddev=(1 / math.sqrt(embedding_dim))),\n axis=0)\n\n softmax_output_layer_kernel_vocab_info = tf.VocabInfo(\n new_vocab='class_vocab',\n new_vocab_size=5,\n num_oov_buckets=0, # No OOV for classes.\n old_vocab='old_class_vocab',\n old_vocab_size=8,\n backup_initializer=tf.compat.v1.glorot_uniform_initializer(),\n axis=1)\n\n softmax_output_layer_bias_vocab_info = tf.VocabInfo(\n new_vocab='class_vocab',\n new_vocab_size=5,\n num_oov_buckets=0, # No OOV for classes.\n old_vocab='old_class_vocab',\n old_vocab_size=8,\n backup_initializer=tf.compat.v1.zeros_initializer(),\n axis=0)\n\n #Currently, only axis=0 and axis=1 are supported.\n ```\n\n\n\n \u003c!-- Tabular view --\u003e\n \u003ctable class=\"responsive fixed orange\"\u003e\n \u003ccolgroup\u003e\u003ccol width=\"214px\"\u003e\u003ccol\u003e\u003c/colgroup\u003e\n \u003ctr\u003e\u003cth colspan=\"2\"\u003e\u003ch2 class=\"add-link\"\u003eAttributes\u003c/h2\u003e\u003c/th\u003e\u003c/tr\u003e\n\n \u003ctr\u003e\n \u003ctd\u003e\n `new_vocab`\u003ca id=\"new_vocab\"\u003e\u003c/a\u003e\n \u003c/td\u003e\n \u003ctd\u003e\n A `namedtuple` alias for field number 0\n \u003c/td\u003e\n \u003c/tr\u003e\u003ctr\u003e\n \u003ctd\u003e\n `new_vocab_size`\u003ca id=\"new_vocab_size\"\u003e\u003c/a\u003e\n \u003c/td\u003e\n \u003ctd\u003e\n A `namedtuple` alias for field number 1\n \u003c/td\u003e\n \u003c/tr\u003e\u003ctr\u003e\n \u003ctd\u003e\n `num_oov_buckets`\u003ca id=\"num_oov_buckets\"\u003e\u003c/a\u003e\n \u003c/td\u003e\n \u003ctd\u003e\n A `namedtuple` alias for field number 2\n \u003c/td\u003e\n \u003c/tr\u003e\u003ctr\u003e\n \u003ctd\u003e\n `old_vocab`\u003ca id=\"old_vocab\"\u003e\u003c/a\u003e\n \u003c/td\u003e\n \u003ctd\u003e\n A `namedtuple` alias for field number 3\n \u003c/td\u003e\n \u003c/tr\u003e\u003ctr\u003e\n \u003ctd\u003e\n `old_vocab_size`\u003ca id=\"old_vocab_size\"\u003e\u003c/a\u003e\n \u003c/td\u003e\n \u003ctd\u003e\n A `namedtuple` alias for field number 4\n \u003c/td\u003e\n \u003c/tr\u003e\u003ctr\u003e\n \u003ctd\u003e\n `backup_initializer`\u003ca id=\"backup_initializer\"\u003e\u003c/a\u003e\n \u003c/td\u003e\n \u003ctd\u003e\n A `namedtuple` alias for field number 5\n \u003c/td\u003e\n \u003c/tr\u003e\u003ctr\u003e\n \u003ctd\u003e\n `axis`\u003ca id=\"axis\"\u003e\u003c/a\u003e\n \u003c/td\u003e\n \u003ctd\u003e\n A `namedtuple` alias for field number 6\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003c/table\u003e"]]