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

[Bugfix] ModuleNotFoundError when importing one_shot fromobcq #1819

Merged
merged 2 commits into from
Nov 9, 2023

Conversation

rahul-tuli
Copy link
Member

Python build command ignores packaging sparseml.transformers.sparsification.obcq in wheel due to missing init files in transformers/obcq folder. That causes a ModuleNotFoundError; this bug oly reveals itself when installing from the wheel, and actually passes when doing an --editable install

Fix includes: Adding missing init file in the respective folder

Steps to reproduce:

pip3 install --default-timeout=200 --index-url http://10.10.60.107:8080/ --trusted-host 10.10.60.107 "sparseml-nightly[torchvision, transformers]"
>>> from sparseml.transformers.sparsification.obcq.obcq import one_shot
/home/domenic/testing/testfail-1019/venv/lib/python3.10/site-packages/torch/cuda/__init__.py:546: UserWarning: Can't initialize NVML
  warnings.warn("Can't initialize NVML")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'sparseml.transformers.sparsification.obcq'
>>>

Adding init file fixes the issue; tested manually with building a wheel off of this Branch, and trying the same import again:

python3 -m pip install --upgrade build && python3 -m build && \
pip install "dist/sparseml_nightly-1.6.0.20231109-py3-none-any.whl[transformers, torchvision]" 
>>> import  sparseml.transformers.sparsification.obcq
>>> from sparseml.transformers.sparsification.obcq.obcq import one_shot
>>> 
KeyboardInterrupt

@rahul-tuli rahul-tuli self-assigned this Nov 9, 2023
@rahul-tuli rahul-tuli added bug Something isn't working mle-team labels Nov 9, 2023
@rahul-tuli rahul-tuli merged commit 30262b5 into main Nov 9, 2023
11 checks passed
@rahul-tuli rahul-tuli deleted the add-missing-init-file branch November 9, 2023 15:34
bfineran pushed a commit that referenced this pull request Nov 16, 2023
bfineran pushed a commit that referenced this pull request Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mle-team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants