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

第一次接触pytorch和bert模型,有几个问题需要请教一下,程序已经跑起来了,但是有几个问题 #14

Open
shaneNo1 opened this issue Sep 27, 2020 · 5 comments

Comments

@shaneNo1
Copy link

修改了三处地方:

1、model\chinese-bert_chinese_wwm_pytorch\config.json, 其中vocab_size的值改为 30522

2、code\sqlnet\model\sqlbert.py,大约141行附近,增加三行:sel_col_mask = sel_col_mask - 254;where_col_mask = where_col_mask - 254;qcol_mask = qcol_mask - 254,程序才能跑起来

3、log日志的位置。code\sqlnet.utils.py文件,950行附近,save_error_case(error_case, gt_cases, dir='./log/')改为save_error_case(error_case, gt_cases, dir='../log/')

最终结果:

Train loss = 2.019
Dev Logic Form Accuracy: 0.732, Execution Accuracy: 0.747
Best Logic Form: 0.732 at epoch 29
Best Execution: 0.747 at epoch 29
Best Mean: 0.740 at epoch 29
Best val acc: (0.9993093922651933, 0.9882596685082873, 0.9861878453038674, 0.975828729281768, 0.9509668508287292, 0.9544198895027625, 0.8031767955801105)
On epoch individually (28, 28, 29, 20, 24, 28, 29)

好像没有预期的高啊

@vdogmcgee
Copy link

修改了三处地方:

1、model\chinese-bert_chinese_wwm_pytorch\config.json, 其中vocab_size的值改为 30522

2、code\sqlnet\model\sqlbert.py,大约141行附近,增加三行:sel_col_mask = sel_col_mask - 254;where_col_mask = where_col_mask - 254;qcol_mask = qcol_mask - 254,程序才能跑起来

3、log日志的位置。code\sqlnet.utils.py文件,950行附近,save_error_case(error_case, gt_cases, dir='./log/')改为save_error_case(error_case, gt_cases, dir='../log/')

最终结果:

Train loss = 2.019
Dev Logic Form Accuracy: 0.732, Execution Accuracy: 0.747
Best Logic Form: 0.732 at epoch 29
Best Execution: 0.747 at epoch 29
Best Mean: 0.740 at epoch 29
Best val acc: (0.9993093922651933, 0.9882596685082873, 0.9861878453038674, 0.975828729281768, 0.9509668508287292, 0.9544198895027625, 0.8031767955801105)
On epoch individually (28, 28, 29, 20, 24, 28, 29)

好像没有预期的高啊

谢谢老哥分享 , 第一处修改有点不懂 , 用的是哈工大讯飞的词表 , 跟bert一样是21128 , 为啥要改成30533呢?

@IAMZn1018
Copy link

修改了三处地方:
1、model\chinese-bert_chinese_wwm_pytorch\config.json, 其中vocab_size的值改为 30522
2、code\sqlnet\model\sqlbert.py,大约141行附近,增加三行:sel_col_mask = sel_col_mask - 254;where_col_mask = where_col_mask - 254;qcol_mask = qcol_mask - 254,程序才能跑起来
3、log日志的位置。code\sqlnet.utils.py文件,950行附近,save_error_case(error_case, gt_cases, dir='./log/')改为save_error_case(error_case, gt_cases, dir='../log/')
最终结果:
Train loss = 2.019
Dev Logic Form Accuracy: 0.732, Execution Accuracy: 0.747
Best Logic Form: 0.732 at epoch 29
Best Execution: 0.747 at epoch 29
Best Mean: 0.740 at epoch 29
Best val acc: (0.9993093922651933, 0.9882596685082873, 0.9861878453038674, 0.975828729281768, 0.9509668508287292, 0.9544198895027625, 0.8031767955801105)
On epoch individually (28, 28, 29, 20, 24, 28, 29)
好像没有预期的高啊

谢谢老哥分享 , 第一处修改有点不懂 , 用的是哈工大讯飞的词表 , 跟bert一样是21128 , 为啥要改成30533呢?

30533是bert英文版本词表大小

@IAMZn1018
Copy link

修改了三处地方:

1、model\chinese-bert_chinese_wwm_pytorch\config.json, 其中vocab_size的值改为 30522

2、code\sqlnet\model\sqlbert.py,大约141行附近,增加三行:sel_col_mask = sel_col_mask - 254;where_col_mask = where_col_mask - 254;qcol_mask = qcol_mask - 254,程序才能跑起来

3、log日志的位置。code\sqlnet.utils.py文件,950行附近,save_error_case(error_case, gt_cases, dir='./log/')改为save_error_case(error_case, gt_cases, dir='../log/')

最终结果:

Train loss = 2.019 Dev Logic Form Accuracy: 0.732, Execution Accuracy: 0.747 Best Logic Form: 0.732 at epoch 29 Best Execution: 0.747 at epoch 29 Best Mean: 0.740 at epoch 29 Best val acc: (0.9993093922651933, 0.9882596685082873, 0.9861878453038674, 0.975828729281768, 0.9509668508287292, 0.9544198895027625, 0.8031767955801105) On epoch individually (28, 28, 29, 20, 24, 28, 29)

好像没有预期的高啊

第二点在133行 # do mask下面加

@hanyonggihub
Copy link

修改了三处地方:

1、model\chinese-bert_chinese_wwm_pytorch\config.json, 其中vocab_size的值改为 30522

2、code\sqlnet\model\sqlbert.py,大约141行附近,增加三行:sel_col_mask = sel_col_mask - 254;where_col_mask = where_col_mask - 254;qcol_mask = qcol_mask - 254,程序才能跑起来

3、log日志的位置。code\sqlnet.utils.py文件,950行附近,save_error_case(error_case, gt_cases, dir='./log/')改为save_error_case(error_case, gt_cases, dir='../log/')

最终结果:

Train loss = 2.019 Dev Logic Form Accuracy: 0.732, Execution Accuracy: 0.747 Best Logic Form: 0.732 at epoch 29 Best Execution: 0.747 at epoch 29 Best Mean: 0.740 at epoch 29 Best val acc: (0.9993093922651933, 0.9882596685082873, 0.9861878453038674, 0.975828729281768, 0.9509668508287292, 0.9544198895027625, 0.8031767955801105) On epoch individually (28, 28, 29, 20, 24, 28, 29)

好像没有预期的高啊

修改了三处地方:
1、model\chinese-bert_chinese_wwm_pytorch\config.json, 其中vocab_size的值改为 30522
2、code\sqlnet\model\sqlbert.py,大约141行附近,增加三行:sel_col_mask = sel_col_mask - 254;where_col_mask = where_col_mask - 254;qcol_mask = qcol_mask - 254,程序才能跑起来
3、log日志的位置。code\sqlnet.utils.py文件,950行附近,save_error_case(error_case, gt_cases, dir='./log/')改为save_error_case(error_case, gt_cases, dir='../log/')
最终结果:
Train loss = 2.019
Dev Logic Form Accuracy: 0.732, Execution Accuracy: 0.747
Best Logic Form: 0.732 at epoch 29
Best Execution: 0.747 at epoch 29
Best Mean: 0.740 at epoch 29
Best val acc: (0.9993093922651933, 0.9882596685082873, 0.9861878453038674, 0.975828729281768, 0.9509668508287292, 0.9544198895027625, 0.8031767955801105)
On epoch individually (28, 28, 29, 20, 24, 28, 29)
好像没有预期的高啊

谢谢老哥分享 , 第一处修改有点不懂 , 用的是哈工大讯飞的词表 , 跟bert一样是21128 , 为啥要改成30533呢?

请问一下这个文件怎么获取?
../model/chinese-bert_chinese_wwm_pytorch/pytorch_model.bin

@vdogmcgee
Copy link

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

No branches or pull requests

4 participants