MCPcopy Create free account
hub / github.com/bitsandbytes-foundation/bitsandbytes / parse_cuda_version

Function parse_cuda_version

bitsandbytes/cextension.py:159–168  ·  view source on GitHub ↗

Convert a raw version code string (e.g. '118', '713') to a dotted version (e.g. '11.8', '7.13').

(version_str: str)

Source from the content-addressed store, hash-verified

157
158
159def parse_cuda_version(version_str: str) -> str:
160 """Convert a raw version code string (e.g. '118', '713') to a dotted version (e.g. '11.8', '7.13')."""
161 if version_str.isdigit():
162 is_hip = bool(torch.version.hip)
163 try:
164 major, minor = _split_cuda_version(version_str, is_hip)
165 return f"{major}.{minor}"
166 except (ValueError, IndexError):
167 pass
168 return version_str
169
170
171class ErrorHandlerMockBNBNativeLibrary(BNBNativeLibrary):

Callers 1

__init__Method · 0.85

Calls 1

_split_cuda_versionFunction · 0.85

Tested by

no test coverage detected