Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
bitsandbytes
Commits
a403c0ed
Unverified
Commit
a403c0ed
authored
Nov 10, 2023
by
Jeremy Howard
Committed by
GitHub
Nov 10, 2023
Browse files
Avoid double-quantizing when calling `cuda()`
parent
726f1470
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
0 deletions
+2
-0
bitsandbytes/nn/modules.py
bitsandbytes/nn/modules.py
+2
-0
No files found.
bitsandbytes/nn/modules.py
View file @
a403c0ed
...
@@ -165,6 +165,8 @@ class Params4bit(torch.nn.Parameter):
...
@@ -165,6 +165,8 @@ class Params4bit(torch.nn.Parameter):
return
self
return
self
def
cuda
(
self
,
device
):
def
cuda
(
self
,
device
):
if
self
.
quant_state
is
not
None
:
return
self
w
=
self
.
data
.
contiguous
().
half
().
cuda
(
device
)
w
=
self
.
data
.
contiguous
().
half
().
cuda
(
device
)
w_4bit
,
quant_state
=
bnb
.
functional
.
quantize_4bit
(
w
,
blocksize
=
self
.
blocksize
,
compress_statistics
=
self
.
compress_statistics
,
quant_type
=
self
.
quant_type
)
w_4bit
,
quant_state
=
bnb
.
functional
.
quantize_4bit
(
w
,
blocksize
=
self
.
blocksize
,
compress_statistics
=
self
.
compress_statistics
,
quant_type
=
self
.
quant_type
)
self
.
data
=
w_4bit
self
.
data
=
w_4bit
...
...
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