CarlanLark / IPGPF

Code for EMNLP 2023 long paper: An Iteratively Parallel Generation Method with the Pre-Filling Strategy for Document-level Event Extraction
14 stars 0 forks source link

dee_model.py代码报错 #1

Open hodorxxx opened 2 weeks ago

hodorxxx commented 2 weeks ago

您好,我正在尝试复现您的代码,运行过程中在dee_model.py文件第486行assert sum(valid_sent_num_list) == ner_token_emb.size(0) == ner_sent_emb.size(0)时报错,sum(valid_sent_num_list)与ner_token_emb.size(0)、ner_sent_emb.size(0)不相等,想向您请教一下该如何修改,谢谢

CarlanLark commented 2 weeks ago

您好!请问您的配置是怎样的,使用几张卡,跑的哪个数据集呢?另外,您运行程序时sum(valid_sent_num_list),ner_token_emb.size()和ner_sent_emb.size()分别是多少呢?

hodorxxx commented 2 weeks ago

感谢您的回复,以下是我的配置:NUM_GPUS=1,ChFinAnn数据集,当batchsize=1时,valid_sent_num_list=[29],ner_token_emb.shape=[15,128,1024],ner_sent_emb.shape=[15,1024]

CarlanLark commented 1 week ago

请问您是在第几个训练样本处报错的?您gradient_accumulation_steps设置的几呢?单卡的话,batchsize需要能整除gradient_accumulation_steps;我尝试了batchsize=1, gradient_accumulation_steps=1, 运行train_chfinann.sh,并没有遇到报错。

另外,如果资源允许的话,最好使用多卡,batchsize和gradient_accumulation_steps设置大一点,batchsize和gradient_accumulation_steps都是1的话,前期训练会非常慢,效果也不如多卡。