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

Remove mypy ignore annotations #5

Merged
merged 2 commits into from
Feb 7, 2024

Conversation

afrittoli
Copy link
Collaborator

This PR is made of two commits:

Add requirement files for dev and test

Add two requirement files:

  • fms-extras-requirements.txt: it includes pinned dependencies except for ibm-fms that is taken from git, main branch
  • test-requirements.txt: it includes packages for testing and it points to fms-extras-requirements.txt too

These are handy for test jobs, to install fms from main, so we don't depend on a release for testing purposes, at least for now.
Adapt the mypy workflow to take advantage of the new requirement files.

Remove mypy ignore annotations

The fms project now includes a (partial) py.typed file, which allows mypy testing to pass for the fms-extras package.

Typing is incomplete on fms side in the hf package, so we continue to exclude the corresponding package on fms-extras to avoid failures. The extra testing uncovered two issues in calico.py:

  • fms_extras/models/calico.py:205: error: "list[int]" has no attribute "values" [attr-defined]

Fixed by removing the redundant values(), set(list[int]) works as it is.

  • fms_extras/models/calico.py:217: error: Incompatible types in assignment (expression has type Module, variable has type "CalicoBlock") [assignment]

Fixed by introducing an extra variable instead of overriding the original variable with an incompatible type.

Signed-off-by: Andrea Frittoli [email protected]

# for repeatable installs

torch==2.2.0
transformers==4.35.0
Copy link
Contributor

Choose a reason for hiding this comment

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

ibm-fms depends on these too right? I wonder if we should just get these indirectly as dependencies of ibm-fms?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's a good point.

We do have those dependencies in https://github.com/foundation-model-stack/fms-extras/blob/fdb1636de4261fd4102da659ab45d3fcc33fe8ef/setup.py#L13C1-L16C32 though (plus accelerate which I had missed).

This package might have its specific requirements on those libraries eventually, possibly stricter than FMS, but we could add them when needed instead of now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I updated this to only include accelerate as pinned dependency

Copy link
Contributor

Choose a reason for hiding this comment

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

why fms-extras-requirements.txt instead of just the usual requirements.txt?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A requirements.txt would be picked up by a casual pip install command, but I think that the requirements.txt which points to fms@main should only be for dev/test use cases.

Copy link
Contributor

@nairbv nairbv left a comment

Choose a reason for hiding this comment

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

minor questions/suggestions but LGTM

Add two requirement files:
- fms-extras-requirements.txt: it includes pinned dependencies
  except for ibm-fms that is taken from git, main branch
- test-requirements.txt: it includes packages for testing and
  it points to fms-extras-requirements.txt too

These are handy for test jobs, to install fms from main, so we
don't depend on a release for testing purposes, at least for now.

Adapt the mypy workflow to take advantage of the new
requirement files.

Signed-off-by: Andrea Frittoli <[email protected]>
The fms project now includes a (partial) py.typed file, which allows
mypy testing to pass for the fms-extras package.

Typing is incomplete on fms side in the hf package, so we continue to
exclude the corresponding package on fms-extras to avoid failures.

The extra testing uncoverved two issues in calico.py:

- fms_extras/models/calico.py:205: error: "list[int]" has no attribute
  "values"  [attr-defined]

Fixed by removing the redundant values(), set(list[int]) works as it is.

- fms_extras/models/calico.py:217: error: Incompatible types in assignment
  (expression has type Module, variable has type "CalicoBlock")  [assignment]

Fixed by introducing an extra variable instead of overriding the
original variable with an incompatible type.

Signed-off-by: Andrea Frittoli <[email protected]>
@afrittoli afrittoli merged commit d75a453 into foundation-model-stack:main Feb 7, 2024
3 checks passed
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