-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Mask vs sequence #5565
Mask vs sequence #5565
Conversation
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.
Looks good so far 👍. Left some comments.
Did you saw any performance improvements?
I haven't seen performance improvements F1-accuracy-wise (it's the same), and I wouldn't expect that because we're essentially doing the same thing. Would need to check memory / time! |
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.
👍 Thanks for improving this!
Sorry, I meant performance = time/memory. F1 score should not change. Would be great is we could to a quick comparison time wise at least. I think we are fine, but we should make sure that we don't merge something that slows things down.
@@ -1255,10 +1251,12 @@ def _create_sequence( | |||
|
|||
def _create_all_labels(self) -> Tuple[tf.Tensor, tf.Tensor]: | |||
all_label_ids = self.tf_label_data[LABEL_IDS][0] | |||
|
|||
label_lengths = tf.cast(self.tf_label_data[LABEL_SEQ_LENGTH][0], dtype=tf.int32) |
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.
Should we add a helper method for this? Something like sequence_length_for
? This logic is repeated all over the place.
@@ -1352,13 +1350,19 @@ def _calculate_entity_loss( | |||
|
|||
return loss, f1 | |||
|
|||
def _compute_mask(self, sequence_lengths: tf.Tensor) -> tf.Tensor: |
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.
Can be static.
Co-Authored-By: Tanja <tabergma@gmail.com>
…o mask-vs-sequence
Timewise it is the same as the previous way of doing it. |
Proposed changes:
Status (please check what you already did):
black
(please check Readme for instructions)