-
Notifications
You must be signed in to change notification settings - Fork 0
supports hpu backend in main branch #1
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Requested few minor changes, please take care of those and then raise PR on upstream. Please also add a short description when raising upstream PR.
bitsandbytes/backends/utils.py
Outdated
| CODE = {"nf4": _NF4_QUANT_TABLE, "fp4": _FP4_QUANT_TABLE} | ||
|
|
||
|
|
||
| def get_habana_frameworks_version(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better to change this to "get_gaudi_sw_version".
bitsandbytes/backends/utils.py
Outdated
|
|
||
| def get_habana_frameworks_version(): | ||
| """ | ||
| Returns the installed version of SynapseAI. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returns the installed version of Gaudi SW.
bitsandbytes/backends/utils.py
Outdated
| return version.parse(output.stdout.split("\n")[0].split()[-1]) | ||
|
|
||
|
|
||
| HABANA_VERSION = get_habana_frameworks_version() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace HABANA_VERSION by GAUDI_SW_VER
bitsandbytes/backends/hpu/ops.py
Outdated
| ) -> torch.Tensor: | ||
| torch._check_is_size(blocksize) | ||
| torch._check(quant_type == "nf4", lambda: f"quant_type must be nf4 or fp4, got {quant_type}") | ||
| torch._check(dtype == torch.bfloat16, lambda: f"4bit dequantization only supports bf16, but got {dtype}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We support torch.float32 also, better to include that also in this check).
| if torch.xpu.is_available(): | ||
| from .backends.xpu import ops as xpu_ops | ||
|
|
||
| if hasattr(torch, "hpu") and torch.hpu.is_available(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Line-29 above, can we make it "Intel Gaudi".
9fb71c1 to
068f0e1
Compare
updates the assertion message Co-authored-by: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com>
Co-authored-by: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com>
Fix lint issue
This PR enables the support of bitsandbytes for HPU (Intel Gaudi) devices.
These changes add support for single and double NF4 quantization/dequantization using Intel Gaudi hardware.