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
8ed7d97b
"git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "a51b6cc86a5bef62283562d49497a4f3e0b134d8"
Unverified
Commit
8ed7d97b
authored
Feb 18, 2025
by
Mitchell Goff
Committed by
GitHub
Feb 18, 2025
Browse files
Update create_dynamic_map to always return a float32 tensor (#1521)
parent
86b6c37a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
bitsandbytes/functional.py
bitsandbytes/functional.py
+3
-3
No files found.
bitsandbytes/functional.py
View file @
8ed7d97b
...
...
@@ -389,14 +389,14 @@ def create_dynamic_map(signed=True, max_exponent_bits=7, total_bits=8):
if
signed
else
2
**
(
i
+
non_sign_bits
-
max_exponent_bits
+
1
)
+
1
,
)
boundaries
=
torch
.
linspace
(
0.1
,
1
,
fraction_items
)
boundaries
=
torch
.
linspace
(
0.1
,
1
,
fraction_items
,
dtype
=
torch
.
float32
)
means
=
(
boundaries
[:
-
1
]
+
boundaries
[
1
:])
/
2.0
data
+=
((
10
**
(
-
(
max_exponent_bits
-
1
)
+
i
))
*
means
).
tolist
()
if
signed
:
data
+=
(
-
(
10
**
(
-
(
max_exponent_bits
-
1
)
+
i
))
*
means
).
tolist
()
if
additional_items
>
0
:
boundaries
=
torch
.
linspace
(
0.1
,
1
,
additional_items
+
1
)
boundaries
=
torch
.
linspace
(
0.1
,
1
,
additional_items
+
1
,
dtype
=
torch
.
float32
)
means
=
(
boundaries
[:
-
1
]
+
boundaries
[
1
:])
/
2.0
data
+=
((
10
**
(
-
(
max_exponent_bits
-
1
)
+
i
))
*
means
).
tolist
()
if
signed
:
...
...
@@ -412,7 +412,7 @@ def create_dynamic_map(signed=True, max_exponent_bits=7, total_bits=8):
data
.
append
(
0
)
data
.
sort
()
return
torch
.
tensor
(
data
)
return
torch
.
tensor
(
data
,
dtype
=
torch
.
float32
)
def
create_quantile_map
(
A
,
total_bits
=
8
):
...
...
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