Unverified Commit 32be2897 authored by Aarni Koskela's avatar Aarni Koskela Committed by GitHub
Browse files

Don't require scipy for regular use (#948)

parent 619e9b3b
...@@ -233,8 +233,15 @@ def create_linear_map(signed=True, total_bits=8, add_zero=True): ...@@ -233,8 +233,15 @@ def create_linear_map(signed=True, total_bits=8, add_zero=True):
l = values.numel()//2 l = values.numel()//2
return torch.Tensor(values[:l].tolist() + [0]*gap + values[l:].tolist()) return torch.Tensor(values[:l].tolist() + [0]*gap + values[l:].tolist())
def create_normal_map(offset=0.9677083, use_extra_value=True): def create_normal_map(offset=0.9677083, use_extra_value=True):
try:
from scipy.stats import norm from scipy.stats import norm
except ImportError as ie:
raise ImportError(
"Scipy is required for `create_normal_map`. "
"Install `bitsandbytes` with the `[test]` extra."
) from ie
if use_extra_value: if use_extra_value:
# one more positive value, this is an asymmetric type # one more positive value, this is an asymmetric type
......
...@@ -29,8 +29,11 @@ setup( ...@@ -29,8 +29,11 @@ setup(
url="https://github.com/TimDettmers/bitsandbytes", url="https://github.com/TimDettmers/bitsandbytes",
packages=find_packages(), packages=find_packages(),
package_data={"": libs}, package_data={"": libs},
install_requires=['torch', 'numpy', 'scipy'], install_requires=['torch', 'numpy'],
extras_require={'benchmark': ['pandas', 'matplotlib']}, extras_require={
'benchmark': ['pandas', 'matplotlib'],
'test': ['scipy'],
},
long_description=read("README.md"), long_description=read("README.md"),
long_description_content_type="text/markdown", long_description_content_type="text/markdown",
classifiers=[ classifiers=[
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment