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
5b612bc6
Commit
5b612bc6
authored
Apr 12, 2023
by
Tim Dettmers
Browse files
Added is_available_triton guard to Triton SwitchBackLinear.
parent
c3d87e44
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
bitsandbytes/nn/triton_based_modules.py
bitsandbytes/nn/triton_based_modules.py
+6
-0
No files found.
bitsandbytes/nn/triton_based_modules.py
View file @
5b612bc6
...
@@ -3,6 +3,8 @@ import torch.nn as nn
...
@@ -3,6 +3,8 @@ import torch.nn as nn
import
time
import
time
from
functools
import
partial
from
functools
import
partial
from
bitsandbytes.triton.triton_utils
import
is_triton_available
from
bitsandbytes.triton.dequantize_rowwise
import
dequantize_rowwise
from
bitsandbytes.triton.dequantize_rowwise
import
dequantize_rowwise
from
bitsandbytes.triton.quantize_rowwise
import
quantize_rowwise
from
bitsandbytes.triton.quantize_rowwise
import
quantize_rowwise
from
bitsandbytes.triton.quantize_columnwise_and_transpose
import
quantize_columnwise_and_transpose
from
bitsandbytes.triton.quantize_columnwise_and_transpose
import
quantize_columnwise_and_transpose
...
@@ -160,6 +162,10 @@ class SwitchBackLinear(nn.Linear):
...
@@ -160,6 +162,10 @@ class SwitchBackLinear(nn.Linear):
):
):
super
().
__init__
(
in_features
,
out_features
,
bias
,
device
,
dtype
)
super
().
__init__
(
in_features
,
out_features
,
bias
,
device
,
dtype
)
if
not
is_triton_available
:
raise
ImportError
(
'''Could not import triton. Please install triton to use SwitchBackLinear.
Alternatively, you can use bnb.nn.SwitchBackLinearBnb, but it will be slower'''
)
# By default, we use the global quantization.
# By default, we use the global quantization.
self
.
vectorize
=
vectorize
self
.
vectorize
=
vectorize
if
self
.
vectorize
:
if
self
.
vectorize
:
...
...
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