Skip to content

Commit 5fde50f

Browse files
update fp4_e2m1 mapping list (#1906)
* update fp4_e2m1 mapping list * Update utility.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 3fe2fd9 commit 5fde50f

File tree

1 file changed

+17
-1
lines changed
  • neural_compressor/torch/algorithms/weight_only

1 file changed

+17
-1
lines changed

neural_compressor/torch/algorithms/weight_only/utility.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,23 @@
6666
1.0,
6767
]
6868
FP4_BNB = [-12.0, -8.0, -6.0, -4.0, -3.0, -2.0, -0.0625, 0, 0.0625, 2.0, 3.0, 4.0, 6.0, 8.0, 12.0]
69-
FP4_E2M1 = [-6.0, -4.0, -3.0, -2.0, -1.5, -1.0, -0.0625, 0, 0.0625, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0]
69+
FP4_E2M1 = [
70+
-1.0,
71+
-0.6666666666666666,
72+
-0.5,
73+
-0.3333333333333333,
74+
-0.25,
75+
-0.16666666666666666,
76+
-0.010416666666666666,
77+
0.0,
78+
0.010416666666666666,
79+
0.16666666666666666,
80+
0.25,
81+
0.3333333333333333,
82+
0.5,
83+
0.6666666666666666,
84+
1.0,
85+
]
7086

7187
# the order is the same as float list, bit value range is [-7, 7]
7288
# 1111 = -1, 1110 = -2, 1101= -3, ...

0 commit comments

Comments
 (0)