chenshaowei57 / SMHSA

Source code of the paper "Attention as Relation: Learning Supervised Multi-head Self-Attention for Relation Extraction, IJCAI 2020."
16 stars 9 forks source link

Relation detection module cannot learn anything. #6

Open Karldog opened 3 years ago

Karldog commented 3 years ago

In the process of running your public code, after 50 iters, the f1 score on the relation results is 0 nearly. Is there any need to modify your code?

zlh-source commented 3 years ago

I also encountered the same problem. Did you solve it?

chenshaowei57 commented 3 years ago

This is a strange question that I haven't encountered. Is this problem in both datasets? Is the problem caused by the environment version?

zlh-source commented 3 years ago

我只在WebNLG上进行了实验,F1确实一直接近于0。似乎是因为输出矩阵过于稀疏而引起的这个问题。

chenshaowei57 commented 3 years ago

是从第一个epoch就存在问题么?

zlh-source commented 3 years ago

是从第一个epoch就存在问题么?

对。从头到尾一直都是。我训练到第70轮,F1只有0.13

zlh-source commented 3 years ago

是从第一个epoch就存在问题么?

对。从头到尾一直都是。我训练到第70轮,F1只有0.13 我没有修改任何代码。

chenshaowei57 commented 3 years ago

那我再运行试试,这个问题之前还真没遇到过。

zlh-source commented 3 years ago

好的。谢谢啦! ------------------ 原始邮件 ------------------ 发件人: "chenshaowei57"<notifications@github.com> 发送时间: 2020年10月15日(星期四) 凌晨0:13 收件人: "chenshaowei57/SMHSA"<SMHSA@noreply.github.com>; 抄送: "zlh"<2650603623@qq.com>;"Comment"<comment@noreply.github.com>; 主题: Re: [chenshaowei57/SMHSA] Relation detection module cannot learn anything. (#6)

Karldog commented 3 years ago

那我再运行试试,这个问题之前还真没遇到过。

有进展麻烦同步下我,感谢🙏

Sirius11311 commented 3 years ago

是从第一个epoch就存在问题么?

对。从头到尾一直都是。我训练到第70轮,F1只有0.13

我也遇到了这样的情况,在webnlg上F1几乎所有epoch都为0,但是nyt的F1和论文给的结果差不多。

chenshaowei57 commented 3 years ago

可以把main函数中的随机种子设置注释掉,应该就可以了。 seed_num = 57 random.seed(seed_num) torch.manual_seed(seed_num) np.random.seed(seed_num) 原因可能是我没有加参数初始化的范围约束,所以我设的种子在你们的机器上可能会使得参数初始化到一个难以优化的区间。