-
Notifications
You must be signed in to change notification settings - Fork 394
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
pytorch中运行train.py的问题 #32
Comments
希望有大佬能帮帮忙 |
我也遇到了你这个问题,问题产生的原因是calculate()函数中的一句话“entity = [id2word[x[j]] + '/' + id2tag[y[j]]]”,其中id2word[x[j]]中的x必须是list类型才正确,但是因为程序在进入calculate()函数之前,给x传的值是tensor类型的,所以会出现这个错误。解决问题的办法就是在调用calcualte()函数之前,先把x从tensor类型转换为list类型,再调用calculate()函数. |
非常感谢。我之前查了好久产生问题的原因,后面是使用和你一样的方法解决的。 |
可以x.numpy()[j]替换x[j]解决 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
这是我运行过程出现的问题,不懂是出错的原因
The text was updated successfully, but these errors were encountered: