Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

mohazahran
Copy link
Collaborator

No description provided.

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)

Copy link
Collaborator

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.

Comment on lines +283 to +288
# 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)
Copy link
Collaborator

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):
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants