Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
bitsandbytes
Commits
2adcb7a7
Unverified
Commit
2adcb7a7
authored
Sep 19, 2025
by
Vivek Goel
Committed by
GitHub
Sep 19, 2025
Browse files
Add function to reverse 4bit weights for HPU (#1757)
* Add function to reverse 4bit weights for HPU * Fix lint error
parent
b2a8a156
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
bitsandbytes/backends/hpu/ops.py
bitsandbytes/backends/hpu/ops.py
+9
-2
No files found.
bitsandbytes/backends/hpu/ops.py
View file @
2adcb7a7
...
...
@@ -3,12 +3,19 @@ import math
import
torch
from
bitsandbytes.utils
import
_reverse_4bit_compress_format
from
..._ops
import
register_kernel
from
..utils
import
GAUDI_SW_VER
# convert btw standard 4-bit compression format and ipex compression format
# needed for backward compatibility with older versions of gaudi sw
def
_reverse_4bit_compress_format
(
weight
:
torch
.
Tensor
):
out_1
=
(
weight
&
0xF0
)
>>
4
out_2
=
(
weight
&
0xF
)
<<
4
out
=
out_1
|
out_2
return
out
@
register_kernel
(
"bitsandbytes::dequantize_4bit"
,
"hpu"
)
def
_
(
A
:
torch
.
Tensor
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment