tensorflow/text

Train text classification model using vectors.tsv and metadata.tsv

peterjmayhew opened this issue · 0 comments

Hi,

I have trained a text classification model that uses pre-trained word embeddings as per this guide https://keras.io/examples/nlp/pretrained_word_embeddings/

Next, I would like to take use the vectors.tsv and metadata.tsv generated by your code, to train a new text classification model.

The Keras guide in the link above has the following code:
from tensorflow.keras.layers import Embedding embedding_layer = Embedding( num_tokens, embedding_dim, embeddings_initializer=keras.initializers.Constant(**embedding_matrix**), trainable=False, )

I think the vectors.tsv file needs to be coverted into an array of floats to be used as embeddings_initializer. But I'm not sure what else needs to be done.

Do you have an additional guide on how to train text classification model using a new word embedding?