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

wikievents 等英文数据集实验 #51

Closed
xxllp opened this issue Sep 1, 2022 · 23 comments
Closed

wikievents 等英文数据集实验 #51

xxllp opened this issue Sep 1, 2022 · 23 comments
Labels
question Further information is requested

Comments

@xxllp
Copy link

xxllp commented Sep 1, 2022

准备实验个英文数据集 不知道作者是否在wikievents 上面跑出结果 因为看 scripts 里面的预训练模型名称都是中文的 ~~~

@xxllp xxllp added the question Further information is requested label Sep 1, 2022
@Spico197
Copy link
Owner

Spico197 commented Sep 1, 2022

后期适配了wikievents数据集,不过没有调整参数。预训练模型改成英文即可。

https://github.com/Spico197/DocEE/blob/main/scripts/run_ptpcg_wikievents_wTgg.sh

@Spico197 Spico197 closed this as completed Sep 1, 2022
@xxllp
Copy link
Author

xxllp commented Sep 1, 2022

我这边换成了英文的 但是数据读取报了个错误

   inlcude_complementary_ents=self.include_complementary_ents_flag,
  File "/data/xxl/DocEE/dee/helper/dee.py", line 143, in __init__
    annguid, mspan, str(sent_mrange), sent_text
ValueError: GUID: scenario_en_kairos_14 span range is not correct, span=Prayuth Chan - ocha, range=(11, 15), sent=['[UNK]', 's', '[UNK]', 'o', 'f', '[UNK]', 'e', 'a', 'r', 'l', 'y', '[UNK]', '[UNK]', 'u', 'e', 's', 'd', 'a', 'y', '[UNK]', 't', 'h', 'e', 'r', 'e', '[UNK]', 'w', 'a', 's', '[UNK]', 'n', 'o', '[UNK]', 'c', 'l', 'a', 'i', 'm', '[UNK]', 'o', 'f', '[UNK]', 'r', 'e', 's', 'p', 'o', 'n', 's', 'i', 'b', 'i', 'l', 'i', 't', 'y', '[UNK]', '.', '[UNK]', '[UNK]', 'r', 'a', 'y', 'u', 't', 'h', '[UNK]', '[UNK]', 'h', 'a', 'n', '[UNK]', '-', '[UNK]', 'o', 'c', 'h', 'a', '[UNK]', ',', '[UNK]', 't', 'h', 'e', '[UNK]', 'h', 'e', 'a', 'd', '[UNK]', 'o', 'f', '[UNK]', '[UNK]', 'h', 'a', 'i', 'l', 'a', 'n', 'd', '[UNK]', '’', '[UNK]', 's', '[UNK]', 'm', 'i', 'l', 'i', 't', 'a', 'r', 'y', '[UNK]', 'g', 'o', 'v', 'e', 'r', 'n', 'm', 'e', 'n', 't', '[UNK]', ',', '[UNK]', 's', 'a', 'i', 'd', '[UNK]', 't', 'h', 'a', 't', '[UNK]', 't', 'h', 'e', '[UNK]', 'a', 'u', 't', 'h', 'o', 'r', 'i', 't', 'i', 'e', 's', '[UNK]', 'w', 'e', 'r', 'e', '[UNK]', 's', 'e', 'a', 'r', 'c', 'h', 'i', 'n', 'g', '[UNK]', 'f', 'o', 'r', '[UNK]', 'a', '[UNK]', 'p', 'e', 'r', 's', 'o', 'n', '[UNK]', 's', 'e', 'e', 'n', '[UNK]', 'o', 'n', '[UNK]', 'c', 'l', 'o', 's', 'e', 'd', '[UNK]', '-', '[UNK]', 'c', 'i', 'r', 'c', 'u', 'i', 't', '[UNK]', 'f', 'o', 'o', 't', 'a', 'g', 'e', '[UNK]', 'b', 'u', 't', '[UNK]', 't', 'h', 'a', 't', '[UNK]', 'i', 't', '[UNK]', 'w', 'a', 's', '[UNK]', 'n', 'o', 't', '[UNK]', 'c', 'l', 'e', 'a', 'r', '[UNK]', 'w', 'h', 'o', '[UNK]', 't', 'h', 'e', '[UNK]', 'p', 'e', 'r', 's', 'o', 'n', '[UNK]', 'w', 'a', 's', '[UNK]', ',', '[UNK]', 'n', 'e', 'w', 's', '[UNK]', 'a', 'g', 'e', 'n', 'c', 'i', 'e', 's', '[UNK]', 'r', 'e', 'p', 'o', 'r', 't', 'e', 'd', '[UNK]', '.']

@xxllp
Copy link
Author

xxllp commented Sep 1, 2022

看起来是将单词分成字母了

@Spico197
Copy link
Owner

Spico197 commented Sep 1, 2022

run_modewikievents_w_tgg时,doc_langen,默认使用空格作为tokenize的依据。您dee包的版本是0.3.2吗?

DocEE/dee/utils.py

Lines 144 to 157 in d6b585e

elif self.doc_lang == "en":
self.dee_tokenize = self.dee_space_tokenize
def dee_space_tokenize(self, text):
"""perform space tokenization"""
tokens = text.split()
out_tokens = []
for token in tokens:
if token in self.vocab:
out_tokens.append(token)
else:
out_tokens.append(self.unk_token)
return out_tokens

@xxllp
Copy link
Author

xxllp commented Sep 1, 2022

我是github 下的代码 版本是对的

@xxllp
Copy link
Author

xxllp commented Sep 1, 2022

是不是这个wikievent的数据处理的脚本哪里有点问题

@Spico197
Copy link
Owner

Spico197 commented Sep 1, 2022

线下测试的时候是可以正常跑通的。如果方便的话麻烦提供多一点信息给我,或者您也在本地debug一下。

@xxllp
Copy link
Author

xxllp commented Sep 1, 2022

报错信息在上面
这个英文的句子 tokenizer.dee_tokenize 结果如下 这个是正常的?
['[UNK]', 's', '[UNK]', 'o', 'f', '[UNK]', 'e', 'a', 'r', 'l', 'y', '[UNK]', '[UNK]', 'u', 'e', 's', 'd', 'a', 'y', '[UNK]', 't', 'h', 'e', 'r', 'e', '[UNK]', 'w', 'a', 's', '[UNK]', 'n', 'o', '[UNK]', 'c', 'l', 'a', 'i', 'm', '[UNK]', 'o', 'f', '[UNK]', 'r', 'e', 's', 'p', 'o', 'n', 's', 'i', 'b', 'i', 'l', 'i', 't', 'y', '[UNK]', '.', '[UNK]', '[UNK]', 'r', 'a', 'y', 'u', 't', 'h', '[UNK]', '[UNK]', 'h', 'a', 'n', '[UNK]', '-', '[UNK]', 'o', 'c', 'h', 'a', '[UNK]', ',', '[UNK]', 't', 'h', 'e', '[UNK]', 'h', 'e', 'a', 'd', '[UNK]', 'o', 'f', '[UNK]', '[UNK]', 'h', 'a', 'i', 'l', 'a', 'n', 'd', '[UNK]', '’', '[UNK]', 's', '[UNK]', 'm', 'i', 'l', 'i', 't', 'a', 'r', 'y', '[UNK]', 'g', 'o', 'v', 'e', 'r', 'n', 'm', 'e', 'n', 't', '[UNK]', ',', '[UNK]', 's', 'a', 'i', 'd', '[UNK]', 't', 'h', 'a', 't', '[UNK]', 't', 'h', 'e', '[UNK]', 'a', 'u', 't', 'h', 'o', 'r', 'i', 't', 'i', 'e', 's', '[UNK]', 'w', 'e', 'r', 'e', '[UNK]', 's', 'e', 'a', 'r', 'c', 'h', 'i', 'n', 'g', '[UNK]', 'f', 'o', 'r', '[UNK]', 'a', '[UNK]', 'p', 'e', 'r', 's', 'o', 'n', '[UNK]', 's', 'e', 'e', 'n', '[UNK]', 'o', 'n', '[UNK]', 'c', 'l', 'o', 's', 'e', 'd', '[UNK]', '-', '[UNK]', 'c', 'i', 'r', 'c', 'u', 'i', 't', '[UNK]', 'f', 'o', 'o', 't', 'a', 'g', 'e', '[UNK]', 'b', 'u', 't', '[UNK]', 't', 'h', 'a', 't', '[UNK]', 'i', 't', '[UNK]', 'w', 'a', 's', '[UNK]', 'n', 'o', 't', '[UNK]', 'c', 'l', 'e', 'a', 'r', '[UNK]', 'w', 'h', 'o', '[UNK]', 't', 'h', 'e', '[UNK]', 'p', 'e', 'r', 's', 'o', 'n', '[UNK]', 'w', 'a', 's', '[UNK]', ',', '[UNK]', 'n', 'e', 'w', 's', '[UNK]', 'a', 'g', 'e', 'n', 'c', 'i', 'e', 's', '[UNK]', 'r', 'e', 'p', 'o', 'r', 't', 'e', 'd', '[UNK]', '.']

@Spico197
Copy link
Owner

Spico197 commented Sep 1, 2022

不正常,应该是以空格切分

@xxllp
Copy link
Author

xxllp commented Sep 1, 2022

是的 看起来是分割的时候有问题

@xxllp
Copy link
Author

xxllp commented Sep 1, 2022

这个我刚才改好了 但是后续的训练发现几轮下来 预测的结果统计 全部都是0哈 是英文的结果哪里没对齐吗

@Spico197
Copy link
Owner

Spico197 commented Sep 1, 2022

  • 我在本地重新试了一下,不应该有数据分割的问题,应该是可以直接正常训练的。方便告知一下您做了哪些改动吗?
  • 全是0其实在WikiEvents上挺正常的,因为数据量太小,建议搭配预训练模型使用。如果像DuEE-fin和ChFinAnn一样使用随机初始化的embedding的话效果会非常差劲

@xxllp
Copy link
Author

xxllp commented Sep 1, 2022

我是将 BertTokenizerForDocEE 里面的self.dee_tokenize = self.dee_space_tokenize 不判断语言了
这个应该是在判断的时候识别还是中文的~~

你意思是加载哪个预训练模型 ,初始化加载的是bert 哈 还是你训练后的模型吗 这个没看到有吧

@Spico197
Copy link
Owner

Spico197 commented Sep 1, 2022

  • 这个太奇怪了,我重新clone了repo,并且重新生成了数据,并没有遇到这个问题orz
  • 脚本中有一个use_bertflag,可以改成True,会使用BERT+CRF的encoding方案。不过有可能会OOM,所以需要相应改下batch size等参数

@xxllp
Copy link
Author

xxllp commented Sep 1, 2022

了解了~~~ 可能我本地代码哪里改了导致的这个

@xxllp
Copy link
Author

xxllp commented Sep 1, 2022

我感觉问题不在这个地方 应该是这个 self.dee_space_tokenize 后的结果很多都是 unk 实体里面也是的

@xxllp
Copy link
Author

xxllp commented Sep 1, 2022

bert 也没啥结果

@Spico197
Copy link
Owner

Spico197 commented Sep 1, 2022

您是用cased还是uncased模型?如果是UNK比较多的话可以把所有字符串lower一下,然后用uncased,或者直接用cased试试

@xxllp
Copy link
Author

xxllp commented Sep 2, 2022

用的uncased模型

@xxllp
Copy link
Author

xxllp commented Sep 2, 2022

试了下 貌似还是一样的几轮都是 0 不知道你本地最后跑出来的F1是多少

@Spico197
Copy link
Owner

Spico197 commented Sep 2, 2022

我只开debug模式测试了可以训练,暂无训练结果

@xxllp
Copy link
Author

xxllp commented Sep 2, 2022

这样我感觉这个英文的数据集肯定是需要哪里继续改

@xxllp
Copy link
Author

xxllp commented Sep 5, 2022

换了个数据集是有结果了 但是结果不是很高 这块要是想把unk的去掉如何整比较好

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