Skip to content

Commit d1d7f05

Browse files
committed
to share quantization tables
1 parent fbb2d00 commit d1d7f05

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

bitsandbytes/backends/xpu/utils.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import torch
2+
3+
4+
# Should be sorted to use binary search
5+
_NF4_QUANT_TABLE = torch.tensor(
6+
[
7+
-1.0,
8+
-0.6961928009986877,
9+
-0.5250730514526367,
10+
-0.39491748809814453,
11+
-0.28444138169288635,
12+
-0.18477343022823334,
13+
-0.09105003625154495,
14+
0.0,
15+
0.07958029955625534,
16+
0.16093020141124725,
17+
0.24611230194568634,
18+
0.33791524171829224,
19+
0.44070982933044434,
20+
0.5626170039176941,
21+
0.7229568362236023,
22+
1.0,
23+
],
24+
dtype=torch.float32,
25+
device="xpu",
26+
)
27+
28+
# Should be sorted to use binary search
29+
_FP4_QUANT_TABLE = torch.tensor(
30+
[
31+
-1.0000,
32+
-0.6667,
33+
-0.5000,
34+
-0.3333,
35+
-0.2500,
36+
-0.1667,
37+
-0.0052,
38+
-0.0000,
39+
0.0000,
40+
0.0052,
41+
0.1667,
42+
0.2500,
43+
0.3333,
44+
0.5000,
45+
0.6667,
46+
1.0000,
47+
],
48+
dtype=torch.float32,
49+
device="xpu",
50+
)

0 commit comments

Comments
 (0)