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

Conversation

wj-Mcat
Copy link
Contributor

@wj-Mcat wj-Mcat commented Sep 7, 2022

PR types

optimization

PR changes

Models

Description

我发现在PretrainedModel的下游模型当中很多都有model_config_fileresource_files_names的配置,并且配置都是一样。而这些配置在基类PretrainedModel里面其实是已经写了的,派生类中不需要再重复写,所以在这个PR当中我将其删掉。

我在Bert单测上跑了相关单测,都通过了的。

@wj-Mcat wj-Mcat requested review from gongel and guoshengCS September 7, 2022 13:52
@wj-Mcat
Copy link
Contributor Author

wj-Mcat commented Sep 8, 2022

为什么要删除?删除的逻辑如下:

class A:
    name = "model_config.json"

class B(A):
    name = "model_config.json"

在派生类B中根本就没必要再重新把name属性定义一遍。

在基类中定义的位置:

model_config_file = "model_config.json"
pretrained_init_configuration = {}
# TODO: more flexible resource handle, namedtuple with fields as:
# resource_name, saved_file, handle_name_for_load(None for used as __init__
# arguments), handle_name_for_save
resource_files_names = {"model_state": "model_state.pdparams"}

@wj-Mcat
Copy link
Contributor Author

wj-Mcat commented Sep 8, 2022

ping @guoshengCS

guoshengCS
guoshengCS previously approved these changes Sep 8, 2022
@gongel
Copy link
Member

gongel commented Sep 8, 2022

gptj是漏掉了吗?

@wj-Mcat
Copy link
Contributor Author

wj-Mcat commented Sep 8, 2022

gptj是漏掉了吗?

更新之后发现有三个新模型没有删除,我已经在新的commit中调整了。 你有时间可重新approve一下 @gongel

@wj-Mcat wj-Mcat merged commit 2f84f97 into PaddlePaddle:develop Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants