-
Notifications
You must be signed in to change notification settings - Fork 7
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
Unittests for Taskmodule #34
Conversation
ChristophAlt
commented
Jan 13, 2022
- Unittests for Taskmodule
- Improve configuration of pytest and isort
- Check examples with mypy
- Fix: transformer span classification should only return the probability of the predicted label
- Fix: Taskmodule should return documents in sorted order in all cases
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 very good! just one minor
pytorch_ie/taskmodules/taskmodule.py
Outdated
documents: Dict[Document, Document] = {} | ||
for encoding in encodings: | ||
if encoding.document not in documents: | ||
documents[encoding.document] = encoding.document | ||
all_documents = list(documents.values()) |
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 we rename documents
to document_mapping
?
documents: Dict[Document, Document] = {} | |
for encoding in encodings: | |
if encoding.document not in documents: | |
documents[encoding.document] = encoding.document | |
all_documents = list(documents.values()) | |
document_mapping: Dict[Document, Document] = {} | |
for encoding in encodings: | |
if encoding.document not in document_mapping: | |
document_mapping[encoding.document] = encoding.document | |
all_documents = list(document_mapping.values()) |
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.
Fixed.