refactor: make TransformersDocumentClassifier output consistent between different types of classification#3224
Merged
ZanSara merged 9 commits intodeepset-ai:mainfrom Sep 21, 2022
anakin87:refactor_TransformersDocumentClassifier_output
Merged
refactor: make TransformersDocumentClassifier output consistent between different types of classification#3224ZanSara merged 9 commits intodeepset-ai:mainfrom anakin87:refactor_TransformersDocumentClassifier_output
TransformersDocumentClassifier output consistent between different types of classification#3224ZanSara merged 9 commits intodeepset-ai:mainfrom
anakin87:refactor_TransformersDocumentClassifier_output
Conversation
Contributor
|
Hey @anakin87 ! Code looks good! Can you add a small test to ensure that the |
Member
Author
|
Hey @ZanSara! I added two tests, since:
|
ZanSara
approved these changes
Sep 21, 2022
Contributor
ZanSara
left a comment
There was a problem hiding this comment.
Thank you! I found a couple of improvements but it's already good to go. I'll go ahead and approve, feel free to commit or resolve the suggestions as you see fit. I'll merge it around EOD or tomorrow morning.
brandenchan
pushed a commit
that referenced
this pull request
Sep 21, 2022
…ween different types of classification (#3224) * make output consistent * make output consistent * added tests for details * better tests * Update test_document_classifier.py * make black happy * Update test_document_classifier.py * Update test_document_classifier.py
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issues
TransformersDocumentClassifier: inconsistent output between ordinary and zero-shot classification #3167Proposed Changes:
TransformersDocumentClassifieroutput structure was different between ordinary and zero-shot classification.Now the output is consistent. For
doc.meta['classification']we always have a structure like this:After the discussion in #3167, I decided to keep the
scoreattribute in the first level ofdoc.meta['classification']: I think that it can be useful for filtering.How did you test it?
Manual verification.
I can add some tests if you think that's the case.
Notes for the reviewer
Other refactoring aspects:
return_all_scoreswithtop_k: it mimicked the same attribute of the HF pipeline, which is now deprecated in favor of the latter.Checklist