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
6bb3edc3
Commit
6bb3edc3
authored
Jan 11, 2020
by
Julien Chaumond
Browse files
Serialize model_type if exists
parent
c6f682c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
0 deletions
+3
-0
src/transformers/configuration_roberta.py
src/transformers/configuration_roberta.py
+1
-0
src/transformers/configuration_utils.py
src/transformers/configuration_utils.py
+2
-0
No files found.
src/transformers/configuration_roberta.py
View file @
6bb3edc3
...
@@ -35,3 +35,4 @@ ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP = {
...
@@ -35,3 +35,4 @@ ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP = {
class
RobertaConfig
(
BertConfig
):
class
RobertaConfig
(
BertConfig
):
pretrained_config_archive_map
=
ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP
pretrained_config_archive_map
=
ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP
model_type
=
"roberta"
src/transformers/configuration_utils.py
View file @
6bb3edc3
...
@@ -276,6 +276,8 @@ class PretrainedConfig(object):
...
@@ -276,6 +276,8 @@ class PretrainedConfig(object):
def
to_dict
(
self
):
def
to_dict
(
self
):
"""Serializes this instance to a Python dictionary."""
"""Serializes this instance to a Python dictionary."""
output
=
copy
.
deepcopy
(
self
.
__dict__
)
output
=
copy
.
deepcopy
(
self
.
__dict__
)
if
hasattr
(
self
.
__class__
,
"model_type"
):
output
[
"model_type"
]
=
self
.
__class__
.
model_type
return
output
return
output
def
to_json_string
(
self
):
def
to_json_string
(
self
):
...
...
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