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

Add type annotations for segformer pytorch #16099

Merged

Conversation

p-mishra1
Copy link
Contributor

This PR adds type annotation for segformer pytorch as mentioned in #16059.
@Rocketknight1

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Mar 12, 2022

The documentation is not available anymore as the PR was closed or merged.

Copy link
Member

@Rocketknight1 Rocketknight1 left a comment

Choose a reason for hiding this comment

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

This looks great, thank you!

@Rocketknight1 Rocketknight1 merged commit 62b05b6 into huggingface:master Mar 12, 2022
@FrancescoSaverioZuppichini
Copy link
Contributor

I believe there are some minor mistakes in the types. Optional[...] is a shorthand notation for Union[..., None], see python doc. Thus it must be used when parameter : ... = None.

This PR makes Optional the following parameters in this forward method

output_attentions: Optional[bool] = False,
output_hidden_states: Optional[bool] = False,
return_dict: Optional[bool] = True,

While to be correct with the Optional definition given in python.

output_attentions: bool = False,
output_hidden_states: bool = False,
return_dict: bool = True,

Since the code in the forward method doesn't check output_attentions is not None, to my understanding they should not be Optional.

cc @Rocketknight1

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

4 participants