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
text-generation-inference
Commits
84bc3d7b
Unverified
Commit
84bc3d7b
authored
Aug 12, 2024
by
Nicolas Patry
Committed by
GitHub
Aug 12, 2024
Browse files
Fixing import exl2 (#2399)
parent
730fa00e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
28 deletions
+30
-28
server/text_generation_server/layers/gptq/__init__.py
server/text_generation_server/layers/gptq/__init__.py
+30
-28
No files found.
server/text_generation_server/layers/gptq/__init__.py
View file @
84bc3d7b
...
@@ -8,34 +8,6 @@ from text_generation_server.utils.import_utils import SYSTEM
...
@@ -8,34 +8,6 @@ from text_generation_server.utils.import_utils import SYSTEM
from
text_generation_server.utils.log
import
log_once
from
text_generation_server.utils.log
import
log_once
from
text_generation_server.utils.weights
import
Weight
,
Weights
,
WeightsLoader
from
text_generation_server.utils.weights
import
Weight
,
Weights
,
WeightsLoader
try
:
major
,
_minor
=
torch
.
cuda
.
get_device_capability
()
except
Exception
:
major
=
1
HAS_EXLLAMA
=
False
CAN_EXLLAMA
=
major
>=
8
or
SYSTEM
==
"rocm"
V2
=
os
.
getenv
(
"EXLLAMA_VERSION"
,
"2"
)
==
"2"
if
os
.
getenv
(
"DISABLE_EXLLAMA"
)
==
"True"
:
HAS_EXLLAMA
=
False
elif
CAN_EXLLAMA
:
try
:
if
V2
:
from
text_generation_server.layers.gptq.exllamav2
import
(
QuantLinear
as
ExllamaQuantLinear
,
# noqa: F401
)
HAS_EXLLAMA
=
"2"
else
:
from
text_generation_server.layers.gptq.exllama
import
(
Ex4bitLinear
as
ExllamaQuantLinear
,
# noqa: F401
)
HAS_EXLLAMA
=
"1"
except
ImportError
:
pass
@
dataclass
@
dataclass
class
GPTQWeight
(
Weight
):
class
GPTQWeight
(
Weight
):
...
@@ -432,3 +404,33 @@ class GPTQWeightsLoader(WeightsLoader):
...
@@ -432,3 +404,33 @@ class GPTQWeightsLoader(WeightsLoader):
else
False
else
False
)
)
self
.
quant_method
=
"gptq"
self
.
quant_method
=
"gptq"
# Needs to be at the end because circular import.
try
:
major
,
_minor
=
torch
.
cuda
.
get_device_capability
()
except
Exception
:
major
=
1
HAS_EXLLAMA
=
False
CAN_EXLLAMA
=
major
>=
8
or
SYSTEM
==
"rocm"
V2
=
os
.
getenv
(
"EXLLAMA_VERSION"
,
"2"
)
==
"2"
if
os
.
getenv
(
"DISABLE_EXLLAMA"
)
==
"True"
:
HAS_EXLLAMA
=
False
elif
CAN_EXLLAMA
:
try
:
if
V2
:
from
text_generation_server.layers.gptq.exllamav2
import
(
QuantLinear
as
ExllamaQuantLinear
,
# noqa: F401
)
HAS_EXLLAMA
=
"2"
else
:
from
text_generation_server.layers.gptq.exllama
import
(
Ex4bitLinear
as
ExllamaQuantLinear
,
# noqa: F401
)
HAS_EXLLAMA
=
"1"
except
ImportError
:
pass
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