Skip to content

[Bug Report] bitsandbytes/ cuda_specs.py #1577

Description

@Squ-123

System Info

CentOS7, Tesla A100

Reproduction

When I run "python -m bitsandbytes" on my own server, it returns:
Traceback (most recent call last):
File "/mnt/data/miniconda/envs/unsloth_env/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/mnt/data/miniconda/envs/unsloth_env/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/mnt/data/conda/bitsandbytes/bitsandbytes/main.py", line 4, in
main()
File "/mnt/data/conda/bitsandbytes/bitsandbytes/diagnostics/main.py", line 51, in main
cuda_specs = get_cuda_specs()
File "/mnt/data/conda/bitsandbytes/bitsandbytes/cuda_specs.py", line 44, in get_cuda_specs
cuda_version_string=(get_cuda_version_string()),
File "/mnt/data/conda/bitsandbytes/bitsandbytes/cuda_specs.py", line 34, in get_cuda_version_string
major, minor = get_cuda_version_tuple()
ValueError: not enough values to unpack (expected 2, got 0)

Expected behavior

I check the source code and find the function:
@lru_cache(None)
def get_cuda_version_tuple() -> Tuple[int, int]:
if torch.version.cuda:
return map(int, torch.version.cuda.split(".")[0:2])
elif torch.version.hip:
return map(int, torch.version.hip.split(".")[0:2])
return None
def get_cuda_version_string() -> str:
major, minor = get_cuda_version_tuple()
return f"{major * 10 + minor}"

get_cuda_version_tuple() returns an Map Object, and I cannot get correct version number in get_cuda_version_string()
Does it supposed to be:
@lru_cache(None)
def get_cuda_version_tuple() -> Tuple[int, int]:
if torch.version.cuda:
return tuple(map(int, torch.version.cuda.split(".")[0:2]))
elif torch.version.hip:
return tuple(map(int, torch.version.hip.split(".")[0:2]))
return (0,0)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions