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

Don't require scipy for regular use #948

Merged

Conversation

akx
Copy link
Contributor

@akx akx commented Jan 2, 2024

Refs #488.

The only use for scipy.stats.norm is create_normal_map, so it probably does not need to be a hard requirement for any and all users of the library.

Many users will of course have it installed anyway.

@Titus-von-Koeller
Copy link
Collaborator

Thanks for raising this, makes sense! I need to discuss this with the other maintainers first. I put it on my list. Will get back to you.

@Titus-von-Koeller Titus-von-Koeller self-assigned this Jan 23, 2024
@akx akx force-pushed the no-hard-scipy-requirement branch from 56e47d7 to edc83e2 Compare January 24, 2024 12:23
@akx akx force-pushed the no-hard-scipy-requirement branch from edc83e2 to 996f23f Compare January 24, 2024 12:24
@akx
Copy link
Contributor Author

akx commented Jan 24, 2024

Rebased post #488.

@akx akx marked this pull request as ready for review January 24, 2024 12:24
install_requires=['torch', 'numpy'],
extras_require={
'benchmark': ['pandas', 'matplotlib'],
'test': ['scipy'],
Copy link
Contributor

Choose a reason for hiding this comment

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

Is create_normal_map only used for testing? Otherwise the name might be confusing?

Copy link
Contributor Author

@akx akx Jan 28, 2024

Choose a reason for hiding this comment

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

The only call to the function is in a test (and it's mentioned in a couple copy-pasted comments too):

(bitsandbytes) ~/b/bitsandbytes (main) $ ag create_normal_map
tests/test_functional.py
2356:    code = F.create_normal_map()

bitsandbytes/nn/modules.py
306:        Implementation of the NF4 data type in bitsandbytes can be found in the `create_normal_map` function in

bitsandbytes/functional.py
236:def create_normal_map(offset=0.9677083, use_extra_value=True):
847:            Implementation of the NF4 data type in bitsandbytes can be found in the `create_normal_map` function 

I can't find other relevant references to it across all of GitHub either – and anyway, the function is still there for downstream users who might need it, they'll just need scipy installed.

extras_require={'benchmark': ['pandas', 'matplotlib']},
install_requires=['torch', 'numpy'],
extras_require={
'benchmark': ['pandas', 'matplotlib'],
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these runtime dependencies at all? The seem to be used only in scripts and are not part of the wheel? Maybe the benchmark extra is not needed at all?

Copy link
Contributor Author

@akx akx Jan 28, 2024

Choose a reason for hiding this comment

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

The idea is that when desiring to run the benchmark scripts, you'd do

pip install -e .[benchmark]

to get the regular requirements plus the things required for benchmarking, or if you want that and the test deps,

pip install -e .[benchmark,test]

Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn’t this also make it part of the public metadata, e.g “pip install bitsandbytes[benchmark]” ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it does.

@Titus-von-Koeller
Copy link
Collaborator

Checked with Tim. He agrees that this makes sense and sees no issue with it.

Thanks for raising this and taking the initiative to provide a fix!

@Titus-von-Koeller Titus-von-Koeller merged commit 32be289 into bitsandbytes-foundation:main Jan 29, 2024
1 check passed
@akx akx deleted the no-hard-scipy-requirement branch January 30, 2024 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants