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
chenpangpang
transformers
Commits
b85c59f9
Commit
b85c59f9
authored
Jan 30, 2020
by
Julien Chaumond
Committed by
Lysandre Debut
Jan 30, 2020
Browse files
config.architectures
parent
f9bc3f57
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
0 deletions
+4
-0
src/transformers/configuration_utils.py
src/transformers/configuration_utils.py
+1
-0
src/transformers/modeling_utils.py
src/transformers/modeling_utils.py
+3
-0
No files found.
src/transformers/configuration_utils.py
View file @
b85c59f9
...
...
@@ -82,6 +82,7 @@ class PretrainedConfig(object):
self
.
num_return_sequences
=
kwargs
.
pop
(
"num_return_sequences"
,
1
)
# Fine-tuning task arguments
self
.
architectures
=
kwargs
.
pop
(
"architectures"
,
None
)
self
.
finetuning_task
=
kwargs
.
pop
(
"finetuning_task"
,
None
)
self
.
num_labels
=
kwargs
.
pop
(
"num_labels"
,
2
)
self
.
id2label
=
kwargs
.
pop
(
"id2label"
,
{
i
:
"LABEL_{}"
.
format
(
i
)
for
i
in
range
(
self
.
num_labels
)})
...
...
src/transformers/modeling_utils.py
View file @
b85c59f9
...
...
@@ -284,6 +284,9 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin):
# Only save the model itself if we are using distributed training
model_to_save
=
self
.
module
if
hasattr
(
self
,
"module"
)
else
self
# Attach architecture to the config
model_to_save
.
config
.
architectures
=
[
model_to_save
.
__class__
.
__name__
]
# Save configuration file
model_to_save
.
config
.
save_pretrained
(
save_directory
)
...
...
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