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 hints for gptneox models #17858

Merged

Conversation

willtai
Copy link
Contributor

@willtai willtai commented Jun 23, 2022

What does this PR do?

Adding missing type hints for GPTNeoxForCausalLM and GPTNeoXModel as referenced in this issue.(#16059 (comment)).

Before submitting

Who can review?

Anyone in the community please feel free to review😄

@Rocketknight1

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jun 23, 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.

Looks great, thank you!

@Rocketknight1 Rocketknight1 merged commit ef28a40 into huggingface:main Jun 24, 2022
output_hidden_states=None,
return_dict=None,
):
input_ids: Optional[torch.LongTensor] = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

According to the documentation of GPT-NeoX, the parameter input_ids is not optional for the class GPTNeoXModel.

Copy link
Member

Choose a reason for hiding this comment

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

While this is true, Optional in Python types has the very specific meaning that the argument can take the value None. See the typing docs for more info on this.

I agree it's not exactly intuitive, but the annotation here is correct as the argument has a default value of None!

Copy link
Contributor

@donelianc donelianc Jun 24, 2022

Choose a reason for hiding this comment

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

Great! Thanks for sharing this information. I'm using this PR as an example to continue addressing the issue 16059. Again, thanks 😃

younesbelkada pushed a commit to younesbelkada/transformers that referenced this pull request Jun 25, 2022
* feat: Add type hints for GPTNeoxForCausalLM and GPTNeoXModel

* fix: removed imported Dict type

* fix: Removed unused List import
younesbelkada pushed a commit to younesbelkada/transformers that referenced this pull request Jun 29, 2022
* feat: Add type hints for GPTNeoxForCausalLM and GPTNeoXModel

* fix: removed imported Dict type

* fix: Removed unused List import
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.

4 participants