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
4ad999d1
Commit
4ad999d1
authored
Apr 02, 2023
by
Tim Dettmers
Browse files
Added quantization tree generation.
parent
0d332a64
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
bitsandbytes/functional.py
bitsandbytes/functional.py
+1
-1
tests/test_functional.py
tests/test_functional.py
+16
-0
No files found.
bitsandbytes/functional.py
View file @
4ad999d1
...
@@ -218,7 +218,7 @@ def create_custom_map(seed=0, scale=0.01):
...
@@ -218,7 +218,7 @@ def create_custom_map(seed=0, scale=0.01):
assert
values
.
numel
()
==
256
assert
values
.
numel
()
==
256
return
values
return
values
def
create_normal_map
(
offset
=
0.96
6666
,
use_extra_value
=
True
):
def
create_normal_map
(
offset
=
0.96
77083
,
use_extra_value
=
True
):
if
use_extra_value
:
if
use_extra_value
:
# one more positive value, this is an asymmetric type
# one more positive value, this is an asymmetric type
...
...
tests/test_functional.py
View file @
4ad999d1
...
@@ -2318,3 +2318,19 @@ def test_bench_fp4_dequant():
...
@@ -2318,3 +2318,19 @@ def test_bench_fp4_dequant():
# torch.matmul(b, a.t())
# torch.matmul(b, a.t())
#torch.cuda.synchronize()
#torch.cuda.synchronize()
#print((time.time()-t0)/iters*1e6)
#print((time.time()-t0)/iters*1e6)
def
test_normal_map_tree
():
code
=
F
.
create_normal_map
()
values
=
code
[:
8
].
tolist
()
+
code
[
-
8
:].
tolist
()
num_pivots
=
1
while
num_pivots
<
16
:
idx
=
list
(
range
(
16
//
num_pivots
//
2
,
16
,
16
//
num_pivots
))
print
(
idx
)
num_pivots
*=
2
pivots
=
[]
for
i
in
idx
:
pivots
.
append
((
values
[
i
-
1
]
+
values
[
i
])
/
2
)
print
(
pivots
)
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