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
bf7f1d54
Commit
bf7f1d54
authored
May 30, 2023
by
OlivierDehaene
Browse files
fix(server): fix quantization
parent
49a6c8c1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
32 deletions
+24
-32
server/text_generation_server/models/bloom.py
server/text_generation_server/models/bloom.py
+6
-8
server/text_generation_server/models/galactica.py
server/text_generation_server/models/galactica.py
+6
-8
server/text_generation_server/models/gpt_neox.py
server/text_generation_server/models/gpt_neox.py
+6
-8
server/text_generation_server/models/t5.py
server/text_generation_server/models/t5.py
+6
-8
No files found.
server/text_generation_server/models/bloom.py
View file @
bf7f1d54
...
@@ -245,14 +245,12 @@ class BLOOMSharded(BLOOM):
...
@@ -245,14 +245,12 @@ class BLOOMSharded(BLOOM):
return
linear
return
linear
module
.
linear
=
replace_linear
(
state
)
module
.
linear
=
replace_linear
(
state
)
elif
quantize
==
"gptq"
:
elif
quantize
==
"gptq"
:
raise
NotImplementedError
(
raise
NotImplementedError
(
"`gptq` is not implemented for now"
)
"`gptq` is not implemented for now"
elif
quantize
is
None
:
)
tensor
=
tensor
.
to
(
device
)
elif
quantize
is
None
:
else
:
tensor
=
tensor
.
to
(
device
)
raise
ValueError
(
f
"Unexpected quantize `
{
quantize
}
`"
)
else
:
raise
ValueError
(
f
"Unexpected quantize `
{
quantize
}
`"
)
module
.
_parameters
[
param_name
]
=
tensor
module
.
_parameters
[
param_name
]
=
tensor
if
name
==
"word_embeddings.weight"
:
if
name
==
"word_embeddings.weight"
:
...
...
server/text_generation_server/models/galactica.py
View file @
bf7f1d54
...
@@ -364,14 +364,12 @@ class GalacticaSharded(Galactica):
...
@@ -364,14 +364,12 @@ class GalacticaSharded(Galactica):
return
linear
return
linear
module
.
linear
=
replace_linear
(
state
)
module
.
linear
=
replace_linear
(
state
)
elif
quantize
==
"gptq"
:
elif
quantize
==
"gptq"
:
raise
NotImplementedError
(
raise
NotImplementedError
(
"`gptq` is not implemented for now"
)
"`gptq` is not implemented for now"
elif
quantize
is
None
:
)
tensor
=
tensor
.
to
(
device
)
elif
quantize
is
None
:
else
:
tensor
=
tensor
.
to
(
device
)
raise
ValueError
(
f
"Unexpected quantize `
{
quantize
}
`"
)
else
:
raise
ValueError
(
f
"Unexpected quantize `
{
quantize
}
`"
)
module
.
_parameters
[
param_name
]
=
tensor
module
.
_parameters
[
param_name
]
=
tensor
if
name
==
"model.decoder.embed_tokens.weight"
:
if
name
==
"model.decoder.embed_tokens.weight"
:
...
...
server/text_generation_server/models/gpt_neox.py
View file @
bf7f1d54
...
@@ -210,14 +210,12 @@ class GPTNeoxSharded(CausalLM):
...
@@ -210,14 +210,12 @@ class GPTNeoxSharded(CausalLM):
return
linear
return
linear
module
.
linear
=
replace_linear
(
state
)
module
.
linear
=
replace_linear
(
state
)
elif
quantize
==
"gptq"
:
elif
quantize
==
"gptq"
:
raise
NotImplementedError
(
raise
NotImplementedError
(
"`gptq` is not implemented for now"
)
"`gptq` is not implemented for now"
elif
quantize
is
None
:
)
tensor
=
tensor
.
to
(
device
)
elif
quantize
is
None
:
else
:
tensor
=
tensor
.
to
(
device
)
raise
ValueError
(
f
"Unexpected quantize `
{
quantize
}
`"
)
else
:
raise
ValueError
(
f
"Unexpected quantize `
{
quantize
}
`"
)
if
current_parameter_tensor
is
not
None
:
if
current_parameter_tensor
is
not
None
:
module
.
_parameters
[
param_name
]
=
tensor
module
.
_parameters
[
param_name
]
=
tensor
...
...
server/text_generation_server/models/t5.py
View file @
bf7f1d54
...
@@ -223,14 +223,12 @@ class T5Sharded(Seq2SeqLM):
...
@@ -223,14 +223,12 @@ class T5Sharded(Seq2SeqLM):
module
.
linear
=
replace_linear
(
state
)
module
.
linear
=
replace_linear
(
state
)
elif
quantize
==
"gptq"
and
not
module_name
.
endswith
(
"wo"
):
elif
quantize
==
"gptq"
and
not
module_name
.
endswith
(
"wo"
):
raise
NotImplementedError
(
raise
NotImplementedError
(
"`gptq` is not implemented for now"
)
"`gptq` is not implemented for now"
elif
quantize
is
None
or
module_name
.
endswith
(
"wo"
):
)
tensor
=
tensor
.
to
(
device
)
elif
quantize
is
None
:
else
:
tensor
=
tensor
.
to
(
device
)
raise
ValueError
(
f
"Unexpected quantize `
{
quantize
}
`"
)
else
:
raise
ValueError
(
f
"Unexpected quantize `
{
quantize
}
`"
)
if
current_parameter_tensor
is
not
None
:
if
current_parameter_tensor
is
not
None
:
module
.
_parameters
[
param_name
]
=
tensor
module
.
_parameters
[
param_name
]
=
tensor
...
...
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