-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
query embeddings using glove #273
base: master
Are you sure you want to change the base?
Conversation
Adding one hot encoding for query length
self.assertIn(str(word2), query_embedding_vector.word_vectors) | ||
self.assertEqual(len(query_embedding_vector.word_vectors), 2) | ||
self.assertEqual(query_embedding_vector.embedding_dim, 3) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mohazahran these asserts/tests could be separate unit tests or subtests to improve readability.
# Filter out stopwords | ||
# def filter_stopwords(token): | ||
# return tf.logical_not(tf.reduce_any(tf.equal(token, list(self.stop_words)))) | ||
# | ||
# mask = tf.map_fn(filter_stopwords, tokens, fn_output_signature=tf.bool) | ||
# tokens = tf.ragged.boolean_mask(tokens, mask) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mohazahran clean up
@@ -158,3 +171,179 @@ def call(self, inputs, training=None): | |||
query_type_vector = self.categorical_vector_op(query_type, training=training) | |||
|
|||
return query_type_vector | |||
|
|||
|
|||
class QueryEmbeddingVector(BaseFeatureLayerOp): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mohazahran I encourage you to define it as a feature layer instead of feature fn and then have a wrapper feature fn. This allows the layer to be used in model config as well and is more customizable.
No description provided.