Using pre-trained word embeddings
See original GitHub issueI used pre-trained word embeddings to initialize the weights of query and document embeddings like below code.
pre_trained_vectors = np.fromfile(path).reshape([-1, dim])
query_embedding_column = tf.feature_column.embedding_column(
...,
initializer=tf.compat.v1.constant_initializer(pre_trained_vectors))
As a result, the training converged faster and the metric of result was pretty improved. I think using pre-trained vectors seems to be quite useful.
But the training time has increased.
The reason is that the weights are initialized with every evaluations. It takes unnecessarily long, because it will be restored from checkpoint file. And the data of pre-trained vectors is saved to meta file unnecessarily.
I’d like to know the way of initializing weights only at the first time of training.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Pretrained Word Embeddings | Word Embedding NLP
Pretrained word embeddings capture the semantic and syntactic meaning of a word as they are trained on large datasets. They are capable of ......
Read more >Using pre-trained word embeddings - Keras
In this example, we show how to train a text classification model that uses pre-trained word embeddings. We'll work with the Newsgroup20 ...
Read more >Guide to Using Pre-trained Word Embeddings in NLP
In this article, we'll take a look at how you can use pre-trained word embeddings to classify text with TensorFlow. Full code included....
Read more >Using Pre-trained Word Embeddings - GluonNLP
Practitioners of deep learning for NLP typically initialize their models using pre-trained word embeddings, bringing in outside information, and reducing ...
Read more >Pre-trained Word embedding using Glove in NLP models
Algorithm for word embedding: · Preprocess the text data. · Created the dictionary. · Traverse the glove file of a specific dimension and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@muik, feel free to send a PR to add
scaffoldto_RankingHead.Thank you for the related link. I tried to use
tf.train.Scaffoldfor initializing weights like the answer of the link. But scaffold argument could be passed totf.estimator.EstimatorSpec, because the code whereEstimatorSpecis instantiated is wraped by_RankingHeadclass on ranking/head.py.So I had to modify
_RankingHeadclass on head.py file to pass the scaffold argument. Now the problem is solved.In addition, It would be nice to provide a way of passing arguments to creating EstimatorSpec.