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

Fix mypy #34

Merged
merged 7 commits into from
Mar 27, 2023
Merged

Fix mypy #34

merged 7 commits into from
Mar 27, 2023

Conversation

carmocca
Copy link
Contributor

No description provided.

pyproject.toml Outdated
"*.py",
]
exclude = [
# "original_model.py", doesn't work: https://github.com/python/mypy/issues/11760#issuecomment-995364004
Copy link
Contributor Author

Choose a reason for hiding this comment

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

# mypy: ignore-errors

needs to be added to the top of original_model.py

Copy link
Collaborator

Choose a reason for hiding this comment

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

Done

@carmocca carmocca marked this pull request as ready for review March 27, 2023 17:56
@carmocca carmocca self-assigned this Mar 27, 2023
Copy link
Collaborator

@lantiga lantiga left a comment

Choose a reason for hiding this comment

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

One comment inline. Discussed offline about removing mypy coverage for model as it adds too much line noise

logits = model(input_ids)
loss = F.cross_entropy(logits.view(-1, logits.size(-1)), targets.view(-1), ignore_index=-1)
loss = torch.nn.functional.cross_entropy(logits.view(-1, logits.size(-1)), targets.view(-1), ignore_index=-1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this better than F.?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's one less import

@carmocca carmocca merged commit 860055d into main Mar 27, 2023
@carmocca carmocca deleted the carmocca/mypy-green branch March 27, 2023 19:47
gkroiz pushed a commit to gkroiz/lit-llama that referenced this pull request May 9, 2023
timothylimyl referenced this pull request in timothylimyl/lit-llama-qa May 21, 2023
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.

2 participants