Skip to content

Commit

Permalink
update fp4_e2m1 mapping list (#1906)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
changwangss and pre-commit-ci[bot] authored Jul 10, 2024
1 parent 3fe2fd9 commit 5fde50f
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion neural_compressor/torch/algorithms/weight_only/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,23 @@
1.0,
]
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]
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]
FP4_E2M1 = [
-1.0,
-0.6666666666666666,
-0.5,
-0.3333333333333333,
-0.25,
-0.16666666666666666,
-0.010416666666666666,
0.0,
0.010416666666666666,
0.16666666666666666,
0.25,
0.3333333333333333,
0.5,
0.6666666666666666,
1.0,
]

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

0 comments on commit 5fde50f

Please sign in to comment.