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

Add Metaheac model #788

Merged
merged 10 commits into from
Jun 15, 2022
Merged

Add Metaheac model #788

merged 10 commits into from
Jun 15, 2022

Conversation

simuler
Copy link
Contributor

@simuler simuler commented Jun 2, 2022

PR
Add new model metaheac;
Add new tools infer_meta.py;

runner:
train_data_dir: "./data/train"
train_reader_path: "reader_train" # importlib format
use_gpu: True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

demo数据需要使用cpu,方便没有gpu机器的用户体验

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

epochs: 1
print_interval: 100
#model_init_path: "output_model_esmm/2" # init model
model_save_path: "output_model_esmm"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

保存路径和加载路径需要换成自己模型名字,然后全量数据后面要加“_all”以和demo数据的保存路径区分

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

epochs: 1
print_interval: 100
#model_init_path: "output_model_esmm/2" # init model
model_save_path: "output_model_esmm"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

保存和加载路径需要换成自己模型的名字

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

return metrics_list, metrics_list_name

# construct train forward phase
def train_forward(self, dy_model, metric_list, batch, config):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里多加一些注释吧,以方便更多用户能够看懂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改


## 快速开始
本文提供了样例数据可以供您快速体验,在任意目录下均可执行。在MetaHeac模型目录的快速执行命令如下:
```bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

md模式下不需要命令前的“!”或者“%”

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

!python -W ignore -u ../../../tools/trainer.py -m config.yaml
# 动态图预测
# step2: infer 此时test数据集为hot
!python -W ignore -u ../../../tools/infer_meta.py -m config.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不需要添加-W ignore

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

```

## 模型组网
模型整体结构如下:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请补全这一板块

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

|:------|:-------| :------ | :------| :------ |
| MetaHeac | 0.7112 | 1024 | 1 | 3个小时左右 |

```bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

非AI Studio的notebook环境,可以不加“!”等符号

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

# step2: infer 此时test数据集为hot
!python -W ignore -u ../../../tools/infer_meta.py -m config.yaml
# step3:修改config文件中test文件的路径为cold
# !python -W ignore -u ../../../tools/infer_meta.py -m config.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里需要对infer_meta.py有更详细的说明,然后路径为cold和hot的区别需要在readme中写明

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已在readme.md中添加相应说明

dy_model.clear_gradients()
loss.backward()
optimizer.step()
# 对每个子任务进行测试
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以将元学习专属infer的作用和使用方式更新到tools目录下的readme中,方便其他用户快速看动

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已在metaheac目录下readme.md中添加相应说明

Copy link
Contributor

@yinhaofeng yinhaofeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

还需要添加中英文的主页readme表格,contributor.md贡献者表格,doc/source下的目录结构和文档

Copy link
Contributor

@yinhaofeng yinhaofeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tipc可以看一下是否能够添加

frankwhzhang
frankwhzhang previously approved these changes Jun 15, 2022
@frankwhzhang frankwhzhang merged commit 08c367f into PaddlePaddle:master Jun 15, 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