Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Improvement] remove model_config_file and resource_files_names #3220

Merged
merged 6 commits into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions paddlenlp/transformers/albert/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,6 @@ class AlbertPretrainedModel(PretrainedModel):
loading pretrained models. See `PretrainedModel` for more details.
"""

model_config_file = "model_config.json"
pretrained_init_configuration = {
"albert-base-v1": {
"attention_probs_dropout_prob": 0.1,
Expand Down Expand Up @@ -716,7 +715,6 @@ class AlbertPretrainedModel(PretrainedModel):
},
}

resource_files_names = {"model_state": "model_state.pdparams"}
pretrained_resource_files_map = {
"model_state": {
"albert-base-v1":
Expand Down
2 changes: 0 additions & 2 deletions paddlenlp/transformers/bart/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class BartPretrainedModel(PretrainedModel):
loading pretrained models.
See :class:`~paddlenlp.transformers.model_utils.PretrainedModel` for more details.
"""
model_config_file = "model_config.json"
pretrained_init_configuration = {
"bart-base": {
"vocab_size": 50265,
Expand Down Expand Up @@ -94,7 +93,6 @@ class BartPretrainedModel(PretrainedModel):
"init_std": 0.02,
}
}
resource_files_names = {"model_state": "model_state.pdparams"}
pretrained_resource_files_map = {
"model_state": {
"bart-base":
Expand Down
2 changes: 0 additions & 2 deletions paddlenlp/transformers/bert/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ class BertPretrainedModel(PretrainedModel):
See :class:`~paddlenlp.transformers.model_utils.PretrainedModel` for more details.
"""

model_config_file = "model_config.json"
pretrained_init_configuration = {
"bert-base-uncased": {
"vocab_size": 30522,
Expand Down Expand Up @@ -379,7 +378,6 @@ class BertPretrainedModel(PretrainedModel):
"pad_token_id": 0
},
}
resource_files_names = {"model_state": "model_state.pdparams"}
pretrained_resource_files_map = {
"model_state": {
"bert-base-uncased":
Expand Down
2 changes: 0 additions & 2 deletions paddlenlp/transformers/bigbird/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ class BigBirdPretrainedModel(PretrainedModel):
See :class:`~paddlenlp.transformers.model_utils.PretrainedModel` for more details.
"""

model_config_file = "model_config.json"
pretrained_init_configuration = {
"bigbird-base-uncased": {
"num_layers": 12,
Expand All @@ -276,7 +275,6 @@ class BigBirdPretrainedModel(PretrainedModel):
"initializer_range": 0.02,
},
}
resource_files_names = {"model_state": "model_state.pdparams"}
pretrained_resource_files_map = {
"model_state": {
"bigbird-base-uncased":
Expand Down
2 changes: 0 additions & 2 deletions paddlenlp/transformers/blenderbot/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class BlenderbotPretrainedModel(PretrainedModel):
Refer to :class:`~paddlenlp.transformers.model_utils.PretrainedModel` for more details.
"""
base_model_prefix = "blenderbot"
model_config_file = "model_config.json"

pretrained_init_configuration = {
"blenderbot-3B": {
Expand Down Expand Up @@ -121,7 +120,6 @@ class BlenderbotPretrainedModel(PretrainedModel):
"scale_embedding": True,
}
}
resource_files_names = {"model_state": "model_state.pdparams"}
pretrained_resource_files_map = {
"model_state": {
"blenderbot-3B":
Expand Down
2 changes: 0 additions & 2 deletions paddlenlp/transformers/blenderbot_small/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ class BlenderbotSmallPretrainedModel(PretrainedModel):
loading pretrained models.
Refer to :class:`~paddlenlp.transformers.model_utils.PretrainedModel` for more details.
"""
model_config_file = "model_config.json"
pretrained_init_configuration = {
"blenderbot_small-90M": {
"vocab_size": 54944,
Expand All @@ -103,7 +102,6 @@ class BlenderbotSmallPretrainedModel(PretrainedModel):
"normalize_before": False,
},
}
resource_files_names = {"model_state": "model_state.pdparams"}
pretrained_resource_files_map = {
"model_state": {
"blenderbot_small-90M":
Expand Down
3 changes: 0 additions & 3 deletions paddlenlp/transformers/chinesebert/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ class ChineseBertPretrainedModel(PretrainedModel):
"""

base_model_prefix = "chinesebert"
model_config_file = "model_config.json"

pretrained_init_configuration = {
"ChineseBERT-base": {
Expand Down Expand Up @@ -259,8 +258,6 @@ class ChineseBertPretrainedModel(PretrainedModel):
},
}

resource_files_names = {"model_state": "model_state.pdparams"}

pretrained_resource_files_map = {
"model_state": {
"ChineseBERT-base":
Expand Down
2 changes: 0 additions & 2 deletions paddlenlp/transformers/clip/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ class CLIPPretrainedModel(PretrainedModel):
loading pretrained models.
See :class:`~paddlenlp.transformers.model_utils.PretrainedModel` for more details.
"""
model_config_file = "model_config.json"
pretrained_init_configuration = {
"openai/clip-vit-base-patch32": {
# vision
Expand Down Expand Up @@ -393,7 +392,6 @@ class CLIPPretrainedModel(PretrainedModel):
"logit_scale_init_value": 2.6592
},
}
resource_files_names = {"model_state": "model_state.pdparams"}
pretrained_resource_files_map = {
"model_state": {
"openai/clip-vit-base-patch32":
Expand Down
2 changes: 0 additions & 2 deletions paddlenlp/transformers/codegen/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,7 @@ class CodeGenPreTrainedModel(PretrainedModel):
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
models.
"""
model_config_file = "model_config.json"
pretrained_init_configuration = {}
resource_files_names = {"model_state": "model_state.pdparams"}
pretrained_resource_files_map = {"model_state": {}}

base_model_prefix = "transformer"
Expand Down
2 changes: 0 additions & 2 deletions paddlenlp/transformers/convbert/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,6 @@ class ConvBertPretrainedModel(PretrainedModel):
"""

base_model_prefix = "convbert"
model_config_file = "model_config.json"

# pretrained general configuration
gen_weight = 1.0
Expand Down Expand Up @@ -431,7 +430,6 @@ class ConvBertPretrainedModel(PretrainedModel):
"num_groups": 1,
},
}
resource_files_names = {"model_state": "model_state.pdparams"}
pretrained_resource_files_map = {
"model_state": {
"convbert-base":
Expand Down
2 changes: 0 additions & 2 deletions paddlenlp/transformers/ctrl/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ class CTRLPreTrainedModel(PretrainedModel):
"""

base_model_prefix = "ctrl"
model_config_file = "model_config.json"

pretrained_init_configuration = {
"ctrl": {
Expand Down Expand Up @@ -237,7 +236,6 @@ class CTRLPreTrainedModel(PretrainedModel):
"pad_token_id": None
},
}
resource_files_names = {"model_state": "model_state.pdparams"}
pretrained_resource_files_map = {
"model_state": {
"ctrl":
Expand Down
2 changes: 0 additions & 2 deletions paddlenlp/transformers/dallebart/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ class DalleBartPretrainedModel(PretrainedModel):
loading pretrained models.
See :class:`~paddlenlp.transformers.model_utils.PretrainedModel` for more details.
"""
model_config_file = "model_config.json"
pretrained_init_configuration = {
"dalle-mini": {
"text_vocab_size": 50264,
Expand Down Expand Up @@ -178,7 +177,6 @@ class DalleBartPretrainedModel(PretrainedModel):
"init_std": 0.02
},
}
resource_files_names = {"model_state": "model_state.pdparams"}
pretrained_resource_files_map = {
"model_state": {
"dalle-mini":
Expand Down
2 changes: 0 additions & 2 deletions paddlenlp/transformers/distilbert/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class DistilBertPretrainedModel(PretrainedModel):
See :class:`~paddlenlp.transformers.model_utils.PretrainedModel` for more details.
"""

model_config_file = "model_config.json"
pretrained_init_configuration = {
"distilbert-base-uncased": {
"vocab_size": 30522,
Expand Down Expand Up @@ -103,7 +102,6 @@ class DistilBertPretrainedModel(PretrainedModel):
"pad_token_id": 0,
},
}
resource_files_names = {"model_state": "model_state.pdparams"}
pretrained_resource_files_map = {
"model_state": {
"distilbert-base-uncased":
Expand Down
2 changes: 0 additions & 2 deletions paddlenlp/transformers/electra/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ class ElectraPretrainedModel(PretrainedModel):
See :class:`~paddlenlp.transformers.model_utils.PretrainedModel` for more details.
"""
base_model_prefix = "electra"
model_config_file = "model_config.json"

# pretrained general configuration
gen_weight = 1.0
Expand Down Expand Up @@ -343,7 +342,6 @@ class ElectraPretrainedModel(PretrainedModel):
"layer_norm_eps": 1e-5
},
}
resource_files_names = {"model_state": "model_state.pdparams"}
pretrained_resource_files_map = {
"model_state": {
"electra-small":
Expand Down
1 change: 0 additions & 1 deletion paddlenlp/transformers/ernie/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ class ErniePretrainedModel(PretrainedModel):

"""

model_config_file = "model_config.json"
pretrained_init_configuration = {
# Deprecated, alias for ernie-1.0-base-zh
"ernie-1.0": {
Expand Down
2 changes: 0 additions & 2 deletions paddlenlp/transformers/ernie_ctm/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ class ErnieCtmPretrainedModel(PretrainedModel):
and loading pretrained models.
See :class:`~paddlenlp.transformers.model_utils.PretrainedModel` for more details.
"""
model_config_file = "model_config.json"
pretrained_init_configuration = {
"ernie-ctm": {
"vocab_size": 23000,
Expand Down Expand Up @@ -165,7 +164,6 @@ class ErnieCtmPretrainedModel(PretrainedModel):
"cls_num": 2,
},
}
resource_files_names = {"model_state": "model_state.pdparams"}
pretrained_resource_files_map = {
"model_state": {
"ernie-ctm":
Expand Down
2 changes: 0 additions & 2 deletions paddlenlp/transformers/ernie_doc/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,6 @@ class ErnieDocPretrainedModel(PretrainedModel):
and loading pretrained models.
See :class:`~paddlenlp.transformers.model_utils.PretrainedModel` for more details.
"""
model_config_file = "model_config.json"
pretrained_init_configuration = {
"ernie-doc-base-en": {
"attention_dropout_prob": 0.0,
Expand Down Expand Up @@ -347,7 +346,6 @@ class ErnieDocPretrainedModel(PretrainedModel):
"pad_token_id": 0
}
}
resource_files_names = {"model_state": "model_state.pdparams"}
pretrained_resource_files_map = {
"model_state": {
"ernie-doc-base-en":
Expand Down
2 changes: 0 additions & 2 deletions paddlenlp/transformers/ernie_gen/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ class ErnieGenPretrainedModel(object):
See :class:`~paddlenlp.transformers.model_utils.PretrainedModel` for more details.

"""
model_config_file = "model_config.json"
ernie_gen_pretrained_init_configuration = {
"ernie-gen-base-en": {
"attention_probs_dropout_prob": 0.1,
Expand Down Expand Up @@ -270,7 +269,6 @@ class ErnieGenPretrainedModel(object):
"pad_token_id": 0,
},
}
resource_files_names = {"model_state": "model_state.pdparams"}
ernie_gen_pretrained_resource_files_map = {
"model_state": {
"ernie-gen-base-en":
Expand Down
2 changes: 0 additions & 2 deletions paddlenlp/transformers/ernie_gram/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ class ErnieGramPretrainedModel(PretrainedModel):
See :class:`~paddlenlp.transformers.model_utils.PretrainedModel` for more details.
"""

model_config_file = "model_config.json"
pretrained_init_configuration = {
"ernie-gram-zh": {
"attention_probs_dropout_prob": 0.1,
Expand Down Expand Up @@ -113,7 +112,6 @@ class ErnieGramPretrainedModel(PretrainedModel):
"vocab_size": 18018
},
}
resource_files_names = {"model_state": "model_state.pdparams"}
pretrained_resource_files_map = {
"model_state": {
"ernie-gram-zh":
Expand Down
2 changes: 0 additions & 2 deletions paddlenlp/transformers/ernie_m/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ class ErnieMPretrainedModel(PretrainedModel):

"""

model_config_file = "model_config.json"
pretrained_init_configuration = {
"ernie-m-base": {
"attention_probs_dropout_prob": 0.1,
Expand All @@ -110,7 +109,6 @@ class ErnieMPretrainedModel(PretrainedModel):
"pad_token_id": 1
}
}
resource_files_names = {"model_state": "model_state.pdparams"}
pretrained_resource_files_map = {
"model_state": {
"ernie-m-base":
Expand Down
2 changes: 0 additions & 2 deletions paddlenlp/transformers/ernie_vil/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ class ErnieViLPretrainedModel(PretrainedModel):
loading pretrained models.
See :class:`~paddlenlp.transformers.model_utils.PretrainedModel` for more details.
"""
model_config_file = "model_config.json"

pretrained_init_configuration = {
"ernie_vil-2.0-base-zh": {
Expand Down Expand Up @@ -142,7 +141,6 @@ class ErnieViLPretrainedModel(PretrainedModel):
"pad_token_id": 0
},
}
resource_files_names = {"model_state": "model_state.pdparams"}
pretrained_resource_files_map = {
"model_state": {
"ernie_vil-2.0-base-zh":
Expand Down
2 changes: 0 additions & 2 deletions paddlenlp/transformers/fnet/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,6 @@ class FNetPretrainedModel(PretrainedModel):
`pretrained_resource_files_map`, `base_model_prefix` for downloading and
loading pretrained models. See `PretrainedModel` for more details.
"""
model_config_file = "model_config.json"
pretrained_init_configuration = {
"fnet-base": {
"vocab_size": 32000,
Expand Down Expand Up @@ -386,7 +385,6 @@ class FNetPretrainedModel(PretrainedModel):
"eos_token_id": 2,
}
}
resource_files_names = {"model_state": "model_state.pdparams"}
pretrained_resource_files_map = {
"model_state": {
"fnet-base":
Expand Down
1 change: 0 additions & 1 deletion paddlenlp/transformers/funnel/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -1782,7 +1782,6 @@ class FunnelPreTrainedModel(PreTrainedModel):
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
models.
"""
model_config_file = "model_config.json"
pretrained_init_configuration = {
"funnel-transformer/small": {}, # B4-4-4H768
"funnel-transformer/small-base": {}, # B4-4-4H768, no decoder
Expand Down
2 changes: 0 additions & 2 deletions paddlenlp/transformers/gau_alpha/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ class GAUAlphaPretrainedModel(PretrainedModel):
See :class:`~paddlenlp.transformers.model_utils.PretrainedModel` for more details.
"""

model_config_file = "model_config.json"
pretrained_init_configuration = {
"chinese_GAU-alpha-char_L-24_H-768": {
"vocab_size": 12000,
Expand All @@ -277,7 +276,6 @@ class GAUAlphaPretrainedModel(PretrainedModel):
"attention_scale": True,
},
}
resource_files_names = {"model_state": "model_state.pdparams"}
pretrained_resource_files_map = {
"model_state": {
"chinese_GAU-alpha-char_L-24_H-768":
Expand Down
2 changes: 0 additions & 2 deletions paddlenlp/transformers/gpt/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,6 @@ class GPTPretrainedModel(PretrainedModel):
See :class:`~paddlenlp.transformers.model_utils.PretrainedModel` for more details.
"""

model_config_file = "model_config.json"
pretrained_init_configuration = {
"gpt-cpm-large-cn": { # 2.6B
"vocab_size": 30000,
Expand Down Expand Up @@ -592,7 +591,6 @@ class GPTPretrainedModel(PretrainedModel):
"eol_token_id": 198,
},
}
resource_files_names = {"model_state": "model_state.pdparams"}
pretrained_resource_files_map = {
"model_state": {
"gpt-cpm-large-cn":
Expand Down
2 changes: 0 additions & 2 deletions paddlenlp/transformers/gptj/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,7 @@ class GPTJPretrainedModel(PretrainedModel):
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
models.
"""
model_config_file = "model_config.json"
pretrained_init_configuration = {}
resource_files_names = {"model_state": "model_state.pdparams"}
pretrained_resource_files_map = {"model_state": {}}

base_model_prefix = "transformer"
Expand Down
Loading