-
Notifications
You must be signed in to change notification settings - Fork 31
Add fixed padding option to sentence_embeddings, sentence_indexer #18
Add fixed padding option to sentence_embeddings, sentence_indexer #18
Conversation
|
|
||
| # Create the returned dict. | ||
| data_dict.extend({self.key_outputs: outputs_list}) | ||
|
|
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.
I guess that function should be removed as it is already in utils/word_mappings.py
tkornuta-ibm
left a comment
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.
- remove pad_list from sentence_embeddings
- rename the function to pad_truncate_list
|
|
||
| logger.info("Saved mappings of size {} to file '{}'".format(len(word_to_ix), file_path)) | ||
|
|
||
| def pad_list(l: list, length: int, value = 0): |
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.
-
maybe the name should be pad_truncate_list, that will reflect more its behavior?
-
not sure whether word_mappings.py is the right place... but please leave it here for now.
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.
Yeah since the function is used both in SentenceEmbeddings and SentenceIndexer, I though that it should be somewhere in a "utils" collection of static functions.
Needed for the attention decoder, as it uses a FC layer that depends on the encoded sequence length.