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
ModelZoo
ChatGLM-6B_pytorch
Commits
6cc0d7f4
Commit
6cc0d7f4
authored
Jul 17, 2023
by
yuguo
Browse files
fix some bugs
parent
3c451b16
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
simple-pretrain/ptuning/main.py
simple-pretrain/ptuning/main.py
+3
-3
No files found.
simple-pretrain/ptuning/main.py
View file @
6cc0d7f4
...
...
@@ -113,7 +113,7 @@ def main():
if
model_args
.
ptuning_checkpoint
is
not
None
:
# Evaluation
# Loading extra state dict of prefix encoder
model
=
AutoModel
.
from_pretrained
(
model_args
.
model_name_or_path
,
config
=
config
,
trust_remote_code
=
True
)
model
=
AutoModel
.
from_pretrained
(
model_args
.
model_name_or_path
,
config
=
config
,
trust_remote_code
=
True
,
empty_init
=
False
)
prefix_state_dict
=
torch
.
load
(
os
.
path
.
join
(
model_args
.
ptuning_checkpoint
,
"pytorch_model.bin"
))
new_prefix_state_dict
=
{}
for
k
,
v
in
prefix_state_dict
.
items
():
...
...
@@ -121,8 +121,8 @@ def main():
new_prefix_state_dict
[
k
[
len
(
"transformer.prefix_encoder."
):]]
=
v
model
.
transformer
.
prefix_encoder
.
load_state_dict
(
new_prefix_state_dict
)
else
:
# model = AutoModel.from_pretrained(model_args.model_name_or_path, config=config, trust_remote_code=True)
model
=
AutoModel
.
from_config
(
config
=
config
,
trust_remote_code
=
True
)
# model = AutoModel.from_pretrained(model_args.model_name_or_path, config=config, trust_remote_code=True
, empty_init=False
)
model
=
AutoModel
.
from_config
(
config
=
config
,
trust_remote_code
=
True
,
empty_init
=
False
)
if
model_args
.
quantization_bit
is
not
None
:
print
(
f
"Quantized to
{
model_args
.
quantization_bit
}
bit"
)
...
...
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