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
337afb28
Unverified
Commit
337afb28
authored
May 31, 2023
by
OlivierDehaene
Committed by
GitHub
May 31, 2023
Browse files
fix(server): fix bnb quantization for CausalLM models (#385)
parent
87dc034b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
3 deletions
+15
-3
server/text_generation_server/models/bloom.py
server/text_generation_server/models/bloom.py
+2
-0
server/text_generation_server/models/galactica.py
server/text_generation_server/models/galactica.py
+2
-0
server/text_generation_server/models/gpt_neox.py
server/text_generation_server/models/gpt_neox.py
+2
-0
server/text_generation_server/models/opt.py
server/text_generation_server/models/opt.py
+7
-2
server/text_generation_server/models/t5.py
server/text_generation_server/models/t5.py
+2
-1
No files found.
server/text_generation_server/models/bloom.py
View file @
337afb28
...
...
@@ -245,6 +245,8 @@ class BLOOMSharded(BLOOM):
return
linear
module
.
linear
=
replace_linear
(
state
)
else
:
tensor
=
tensor
.
to
(
device
)
elif
quantize
==
"gptq"
:
raise
NotImplementedError
(
"`gptq` is not implemented for now"
)
elif
quantize
is
None
:
...
...
server/text_generation_server/models/galactica.py
View file @
337afb28
...
...
@@ -364,6 +364,8 @@ class GalacticaSharded(Galactica):
return
linear
module
.
linear
=
replace_linear
(
state
)
else
:
tensor
=
tensor
.
to
(
device
)
elif
quantize
==
"gptq"
:
raise
NotImplementedError
(
"`gptq` is not implemented for now"
)
elif
quantize
is
None
:
...
...
server/text_generation_server/models/gpt_neox.py
View file @
337afb28
...
...
@@ -210,6 +210,8 @@ class GPTNeoxSharded(CausalLM):
return
linear
module
.
linear
=
replace_linear
(
state
)
else
:
tensor
=
tensor
.
to
(
device
)
elif
quantize
==
"gptq"
:
raise
NotImplementedError
(
"`gptq` is not implemented for now"
)
elif
quantize
is
None
:
...
...
server/text_generation_server/models/opt.py
View file @
337afb28
...
...
@@ -166,7 +166,7 @@ class OPTSharded(OPT):
tensor
=
tensor
.
contiguous
().
to
(
dtype
)
if
quantize
:
if
quantize
==
"bitsandbytes"
:
if
not
HAS_BITS_AND_BYTES
:
raise
ImportError
(
"bitsandbytes is not available on your machine either because it is not installed "
...
...
@@ -216,9 +216,14 @@ class OPTSharded(OPT):
return
linear
module
.
linear
=
replace_linear
(
state
)
else
:
tensor
=
tensor
.
to
(
device
)
elif
quantize
==
"gptq"
:
raise
NotImplementedError
(
"`gptq` is not implemented for now"
)
elif
quantize
is
None
:
tensor
=
tensor
.
to
(
device
)
else
:
raise
ValueError
(
f
"Unexpected quantize `
{
quantize
}
`"
)
module
.
_parameters
[
param_name
]
=
tensor
if
name
==
"model.decoder.embed_tokens.weight"
:
...
...
server/text_generation_server/models/t5.py
View file @
337afb28
...
...
@@ -222,7 +222,8 @@ class T5Sharded(Seq2SeqLM):
return
linear
module
.
linear
=
replace_linear
(
state
)
else
:
tensor
=
tensor
.
to
(
device
)
elif
quantize
==
"gptq"
and
not
module_name
.
endswith
(
"wo"
):
raise
NotImplementedError
(
"`gptq` is not implemented for now"
)
elif
quantize
is
None
or
module_name
.
endswith
(
"wo"
):
...
...
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