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

GH-3509: fix support metric #3510

Merged
merged 6 commits into from
Aug 11, 2024

Conversation

MattGPT-ai
Copy link
Contributor

Addresses #3509

Also adds more type hinting and fixes mutable default arguments.

@MattGPT-ai MattGPT-ai force-pushed the GH-3509-fix-support-metric branch 2 times, most recently from c415e43 to 09108c0 Compare July 24, 2024 17:06
@MattGPT-ai
Copy link
Contributor Author

I'm not sure what the error occurring is, it doesn't seem to be related to my changes but maybe you are familiar with it

@MattGPT-ai
Copy link
Contributor Author

Looks like the test passed without me changing anything, so this should be ready for review

@@ -737,7 +743,8 @@ def _encode_data_points(self, sentences: List[DT], data_points: List[DT2]):

return data_point_tensor

def _mask_scores(self, scores, data_points):
def _mask_scores(self, scores: Tensor, data_points) -> Tensor:
"""This appears to have not been fully implemented and simply returns scores."""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In most models, scores are not masked, so the default implementation is to just return the scores. The SpanClassifier overwrites this method to account for "candidate lists". Anything not on these lists, will be masked.

Copy link
Collaborator

@alanakbik alanakbik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for adding this! Just needs a tiny modification in one of the comment lines, as otherwise it would be misleading.

flair/nn/model.py Outdated Show resolved Hide resolved
@alanakbik alanakbik merged commit ddf7de9 into flairNLP:master Aug 11, 2024
1 check passed
@alanakbik
Copy link
Collaborator

@MattGPT-ai thanks for fixing this!

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

Successfully merging this pull request may close these issues.

None yet

2 participants