-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Add type hints for several pytorch models (batch-3) #25705
Add type hints for several pytorch models (batch-3) #25705
Conversation
perturb: Optional[torch.FloatTensor] = None, | ||
masked_tokens: None = None, |
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.
For perturb
I took what microsoft/graphormer uses.
masked_tokens
on the other hand, raises a NotImplemented
whenever it has something that is not None
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.
Haa, that's funny. Congrats on our first correct type hint of an explicit None
!
input_ids: torch.LongTensor, | ||
attention_mask: Optional[torch.FloatTensor] = None, | ||
position_ids: Optional[torch.LongTensor] = None, | ||
query_embeds: Optional[torch.Tensor] = None, |
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 was unsure of the dtype
(I couldn't find any reference) so I left the generic torch.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.
Looks great to me, thank you!
perturb: Optional[torch.FloatTensor] = None, | ||
masked_tokens: None = None, |
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.
Haa, that's funny. Congrats on our first correct type hint of an explicit None
!
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. |
* Add missing type hints for ErnieM family * Add missing type hints for EsmForProteinFolding model * Add missing type hints for Graphormer model * Add type hints for InstructBlipQFormer model * Add missing type hints for LayoutLMForMaskedLM model * Add missing type hints for LukeForEntitySpanClassification model
* Add missing type hints for ErnieM family * Add missing type hints for EsmForProteinFolding model * Add missing type hints for Graphormer model * Add type hints for InstructBlipQFormer model * Add missing type hints for LayoutLMForMaskedLM model * Add missing type hints for LukeForEntitySpanClassification model
* Add missing type hints for ErnieM family * Add missing type hints for EsmForProteinFolding model * Add missing type hints for Graphormer model * Add type hints for InstructBlipQFormer model * Add missing type hints for LayoutLMForMaskedLM model * Add missing type hints for LukeForEntitySpanClassification model
What does this PR do?
Addresses some of the models in #16059:
ErnieMForInformationExtraction
ErnieMForMultipleChoice
ErnieMForQuestionAnswering
ErnieMForSequenceClassification
ErnieMForTokenClassification
ErnieMModel
EsmForProteinFolding
GraphormerModel
InstructBlipQFormerModel
LayoutLMForMaskedLM
LukeForEntitySpanClassification
Who can review?
@Rocketknight1, please