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

模型训练问题 #31

Closed
5 tasks done
sauceplus opened this issue Apr 28, 2022 · 11 comments
Closed
5 tasks done

模型训练问题 #31

sauceplus opened this issue Apr 28, 2022 · 11 comments
Labels
question Further information is requested

Comments

@sauceplus
Copy link

Agreement

  • Fill the space in brackets with x to check the agreement items.
  • Before submitting this issue, I've fully checked the instructions in README.md.
  • Before submitting this issue, I'd searched in the issue area and didn't find a solved issue that covers my problem.
  • This issue is about the toolkit itself, not Python, pip or other programming basics.
  • I understand if I do not check all the agreemnt items above, my issue MAY BE CLOSED OR REMOVED WITHOUT FURTHER EXPLANATIONS.

Problem

老师你好,我现在想重新训练ptpcg模型,运行run_ptpcg.sh发现我的电脑配置太低,所以准备申请云平台进行加速。我阅读了dee_task.py,现在我是否通过shell运行run_dee_task.py,就可以获得我想要的模型在Exps文件中?(不知道为啥,dee_task.train(save_cpt_flag=in_argv.save_cpt_flag)中的save_cpt_flag=False,意思是不保存模型吗?)

@sauceplus sauceplus added the question Further information is requested label Apr 28, 2022
@Spico197
Copy link
Owner

您好,save_cpt_flag=False 是指每轮评价前不保存模型权重。不过 run_ptpcg.sh 中设置了 save_best_cpt=True,即 评价结束之后若当前轮次的模型结果大于历史最佳值时会保存最佳模型。这样可以降低硬盘空间的占用。不过您也可以把 save_cpt_flag 设置为True,从而每轮都保存一个模型权重。都可以。

@sauceplus
Copy link
Author

QQ截图20220428210940
太巧妙了老师!如图,是不是到“if in_argv.run_inference:”,模型就已经完成训练并输出了呢?“run_inference”这一个if的操作意义是什么呢?

@Spico197
Copy link
Owner

Spico197 commented Apr 28, 2022

  1. 是的,到 run_inference 之前如果没有 skip_train 的话模型就已经训练完毕了;
  2. run_inference 是为了打比赛做的接口,会读取inference_file_name文件,并在inference_dump_filepath中生成输出结果,具体可以看下相关代码。如果是在千言DuEE-fin数据集上做的实验,那么需要生成结果文件,经过dueefin_post_process.py处理后提交至系统进行线上评测。

@sauceplus
Copy link
Author

原来是这样老师,看了半天inference_dump_filepath这个我以为老师又加入了什么测试方法呢hh
{MF7O)V{{4O2C WZGR3JZKV
那既然这样,我的目的只是为了训练模型并输出,剩下我刷蓝的5个if我都可以去掉吧?

@Spico197
Copy link
Owner

图中320行及之后的内容要保留,是输出最终评价结果用的。其它选中部分可以删除或按argparse中的相关设定设置。如果您使用的是run_ptpcg.sh文件运行,那么这些保留也没关系,不会被调用。

@sauceplus
Copy link
Author

好滴老师。云平台无法使用shell,我准备将您shell中的参数转移到python脚本中。最后向您确认一下,我只要按run_ptpcg.sh文件的步骤进行训练,就可以用于预测的模型吧?(因为云平台要按小时付费,害怕训练费了。。)

@Spico197
Copy link
Owner

Spico197 commented Apr 28, 2022

是的。如果不放心的话您可以从train.json里抽48个文档,命名为sample_train_48.json,然后用stat.py处理一下,生成typed_sample_train_48.json文件。或者直接从typed_train.json文件中抽一些实例,把名字改成typed_sample_train_48.json
在确保Data目录中有typed_sample_train_48.json文件之后,把num_train_epochs设置成1,run_mode设置为"debug",然后运行一下看看能不能正常跑通。
这个测试只需要跑几分钟。

@sauceplus
Copy link
Author

{76NF)$I2RU 1{38VG38MJG
老师您在这已经编写了debug的48个样例,我是否可以直接使用?

@Spico197
Copy link
Owner

可以的

@sauceplus
Copy link
Author

HYVMJQ2MP}HLPLOERB4@IIW
芜湖!感谢老师!!

@sauceplus
Copy link
Author

老师再打扰一下,有如下问题:
C6MHDT 7P_ GN4HT@ 40
RNWB25G${M4R J$)A(P@I2H

1.上图中从e1-e4,模型的loss从414降至1.82,请问loss是否可以正确反映模型的精度?
2.Docee项目中,所有包含“inference”的元素,是不是都是老师用于参与比赛的,与模型训练无关?
HO6DV1{0`N6YQ873CH1{~@N

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants