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
564f2a3b
"...git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "d7a1a0363feb7694568695394a7edfdd44a18bca"
Unverified
Commit
564f2a3b
authored
Jan 09, 2024
by
OlivierDehaene
Committed by
GitHub
Jan 09, 2024
Browse files
fix: fix local loading for .bin models (#1419)
parent
3f9b3f45
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
4 deletions
+3
-4
server/text_generation_server/cli.py
server/text_generation_server/cli.py
+1
-1
server/text_generation_server/utils/peft.py
server/text_generation_server/utils/peft.py
+2
-3
No files found.
server/text_generation_server/cli.py
View file @
564f2a3b
...
@@ -198,7 +198,7 @@ def download_weights(
...
@@ -198,7 +198,7 @@ def download_weights(
if
not
extension
==
".safetensors"
or
not
auto_convert
:
if
not
extension
==
".safetensors"
or
not
auto_convert
:
raise
e
raise
e
el
se
:
el
if
(
Path
(
model_id
)
/
"adapter_config.json"
).
exists
()
:
# Try to load as a local PEFT model
# Try to load as a local PEFT model
try
:
try
:
utils
.
download_and_unload_peft
(
utils
.
download_and_unload_peft
(
...
...
server/text_generation_server/utils/peft.py
View file @
564f2a3b
...
@@ -10,8 +10,7 @@ from peft import AutoPeftModelForCausalLM, AutoPeftModelForSeq2SeqLM
...
@@ -10,8 +10,7 @@ from peft import AutoPeftModelForCausalLM, AutoPeftModelForSeq2SeqLM
def
download_and_unload_peft
(
model_id
,
revision
,
trust_remote_code
):
def
download_and_unload_peft
(
model_id
,
revision
,
trust_remote_code
):
torch_dtype
=
torch
.
float16
torch_dtype
=
torch
.
float16
logger
.
info
(
"Peft model detected."
)
logger
.
info
(
"Trying to load a Peft model. It might take a while without feedback"
)
logger
.
info
(
"Loading the model it might take a while without feedback"
)
try
:
try
:
model
=
AutoPeftModelForCausalLM
.
from_pretrained
(
model
=
AutoPeftModelForCausalLM
.
from_pretrained
(
model_id
,
model_id
,
...
@@ -28,7 +27,7 @@ def download_and_unload_peft(model_id, revision, trust_remote_code):
...
@@ -28,7 +27,7 @@ def download_and_unload_peft(model_id, revision, trust_remote_code):
trust_remote_code
=
trust_remote_code
,
trust_remote_code
=
trust_remote_code
,
low_cpu_mem_usage
=
True
,
low_cpu_mem_usage
=
True
,
)
)
logger
.
info
(
f
"Load
ed."
)
logger
.
info
(
"Peft model detect
ed."
)
logger
.
info
(
f
"Merging the lora weights."
)
logger
.
info
(
f
"Merging the lora weights."
)
base_model_id
=
model
.
peft_config
[
"default"
].
base_model_name_or_path
base_model_id
=
model
.
peft_config
[
"default"
].
base_model_name_or_path
...
...
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