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

有关virtual type words的embedding的初始化问题 #18

Closed
jyf123 opened this issue Dec 28, 2022 · 10 comments
Closed

有关virtual type words的embedding的初始化问题 #18

jyf123 opened this issue Dec 28, 2022 · 10 comments

Comments

@jyf123
Copy link

jyf123 commented Dec 28, 2022

您好,有以下几个问题想要请教您:

  1. 论文和代码中的virtual type words初始化方式不一致问题
    在论文中[sub]和[obj]的初始化是通过embedding乘以概率𝜙_sub和𝜙_obj得到的,但在最新提交的transformer.py的第174-175行代码中似乎是直接取了均值,相当于每个实体类型的𝜙_sub和𝜙_obj都是一样的。想问一下是我对文章或者代码的理解有问题吗?
  2. two_stage设置问题
    请问在代码中实现two_stage是需要设置参数--two_steps为True吗?我在复现过程中,将--two_steps设置为True之后,测试集的结果从70多降到了20多,因此有点疑惑。

谢谢您!

@njcx-ai
Copy link
Contributor

njcx-ai commented Dec 28, 2022

您好,应该是论文中[sub]和[obj]的初始化是通过embedding乘以概率𝜙_sub和𝜙_obj得到的,目前更新的代码是我们后来做项目时候方便更简洁使用简化为取均值。您可以在这段修改为多种设置可选择的逻辑。

@jyf123
Copy link
Author

jyf123 commented Dec 29, 2022

第一个问题我明白啦,谢谢您!请问方便回答一下问题2吗?

@njcx-ai
Copy link
Contributor

njcx-ai commented Dec 29, 2022

  1. two_stage设置问题:
    这里设置参数--two_steps为True的操作并不完整即只实现了第一步,测试集的结果降到了20多应该是因为只tune了prompt的embedding,第二步需要再导入模型继续训练。

@zxlzr zxlzr closed this as completed Dec 31, 2022
@jyf123
Copy link
Author

jyf123 commented Jan 4, 2023

  1. two_stage设置问题:
    这里设置参数--two_steps为True的操作并不完整即只实现了第一步,测试集的结果降到了20多应该是因为只tune了prompt的embedding,第二步需要再导入模型继续训练。

非常感谢您耐心的回答!但有个问题我还是不太清楚:
请问论文中说的two stage具体在代码中是如何实现的呢?是第一个阶段--two_steps这个参数设置为false,第二个阶段设置--two_steps为true并加载第一个阶段的weight嘛?对于设置--two_steps这个参数的意义可以解释一下嘛?

@njcx-ai
Copy link
Contributor

njcx-ai commented Jan 4, 2023

您好,默认是是第一个阶段--two_steps这个参数设置为false,第二个阶段设置--two_steps为true, 代码细节可能不涉及加载weight的内容,您可以通过在这段two_stage设置的代码中实现控制修改加载模型。

@jyf123
Copy link
Author

jyf123 commented Jan 4, 2023

好的,谢谢您!

@jyf123
Copy link
Author

jyf123 commented Jan 5, 2023

您好,想问下“这段two_stage设置的代码”指的是main.py中的if args.two_steps:循环中的代码嘛?

@njcx-ai
Copy link
Contributor

njcx-ai commented Jan 5, 2023

您好,是的。您可以自行简单修改以加载模型。

@jyf123
Copy link
Author

jyf123 commented Jan 5, 2023

那可以理解为如果要实现论文中的两阶段,需要先设置--two_steps为false,学习prompt的embedding,再设置--two_steps为true,加载上一步中最好的模型,同时修改学习率为lr2和训练阶段的目标函数的代码,完成第二阶段的训练嘛?

@njcx-ai
Copy link
Contributor

njcx-ai commented Jan 5, 2023

是的,你也可以简化为一个阶段的训练,其效果也近似。

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

3 participants