DeepKE icon indicating copy to clipboard operation
DeepKE copied to clipboard

预测过程,CNN中对输入x进行mask操作时的维度问题

Open Nunjikk opened this issue 3 years ago • 3 comments

Describe the question 您好,我在尝试Quick Start进行到python predict.py时出现错误:

RuntimeError: The size of tensor a (19) must match the size of tensor b (512) at non-singleton dimension 2

发现CNN中(x = x.masked_fill_(mask.bool(), 1e-12))对输入进行mask时x与mask的维度无法进行广播,这个怎么解决呢?

Environment (please complete the following information):

  • OS: Ubuntu20
  • Python Version 3.8

Screenshots

If applicable, add screenshots to help explain your problem. image

Additional context

Add any other context about the problem here.

Nunjikk avatar Oct 18 '23 05:10 Nunjikk

打印输出的x和mask1是哪两个向量呢

tlk1997 avatar Oct 18 '23 10:10 tlk1997

请问您问题是否已解决?

zxlzr avatar Oct 21 '23 00:10 zxlzr

打印输出的x和mask1是哪两个向量呢

print的mask和x是DeepKE/src/deepke/relation_extraction/standard/module/CNN.py中的,也是在这个地方报的错 image 目前使用llm已经可以成功使用,感谢回复!

Nunjikk avatar Oct 21 '23 01:10 Nunjikk