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

CapsGNN (Loss=nan)? #16

Open
diesel248 opened this issue May 19, 2020 · 13 comments
Open

CapsGNN (Loss=nan)? #16

diesel248 opened this issue May 19, 2020 · 13 comments

Comments

@diesel248
Copy link

I was trying to run this code but got this error. See pic below

2020-05-18_231633

@lishu0716
Copy link

In layers.py, add a line b_ij = b_ij + u_vj1 before line 143 b_max = torch.max(b_ij, dim = 2, keepdim = True)

@diesel248
Copy link
Author

In layers.py, add a line b_ij = b_ij + u_vj1 before line 143 b_max = torch.max(b_ij, dim = 2, keepdim = True)

Hi,

Thank you for your help. Actually, I checked the author's commit history and have already added this line. It worked on the small size dataset (30 train, 30 test), but still got the same problem on the large size dataset (1000 train, 1000 test) after several iterations. And the predictions are all 0.

image

@imSeaton
Copy link

In layers.py, add a line b_ij = b_ij + u_vj1 before line 143 b_max = torch.max(b_ij, dim = 2, keepdim = True)

Hi,

Thank you for your help. Actually, I checked the author's commit history and have already added this line. It worked on the small size dataset (30 train, 30 test), but still got the same problem on the large size dataset (1000 train, 1000 test) after several iterations. And the predictions are all 0.

image

Hi! I have meet the same problems with you! Have you got the solutions?

@diesel248
Copy link
Author

In layers.py, add a line b_ij = b_ij + u_vj1 before line 143 b_max = torch.max(b_ij, dim = 2, keepdim = True)

Hi,
Thank you for your help. Actually, I checked the author's commit history and have already added this line. It worked on the small size dataset (30 train, 30 test), but still got the same problem on the large size dataset (1000 train, 1000 test) after several iterations. And the predictions are all 0.
image

Hi! I have meet the same problems with you! Have you got the solutions?

Not yet. Still waiting for someone's help.

@holoword
Copy link

In layers.py, add a line b_ij = b_ij + u_vj1 before line 143 b_max = torch.max(b_ij, dim = 2, keepdim = True)

same problem, need help!

@dtzfast
Copy link

dtzfast commented Jul 4, 2020

Graph level classification, how to add batchsize?

@jack6756
Copy link

wow

@Wanghongyu97
Copy link

In layers.py, add a line b_ij = b_ij + u_vj1 before line 143 b_max = torch.max(b_ij, dim = 2, keepdim = True)

same problem
when epoch is 20, accuracy is only 0.33, and loss is around 2.5

@imSeaton
Copy link

In layers.py, add a line b_ij = b_ij + u_vj1 before line 143 b_max = torch.max(b_ij, dim = 2, keepdim = True)

same problem
when epoch is 20, accuracy is only 0.33, and loss is around 2.5

大兄弟,一起撸他的代码呀。我觉得他的代码中可能存在一些问题,例如:1、attention模块之前,tensor 的view操作打乱了数据分布,hidden_representation那里的view也是。2、attention模块和论文里的有点不一样。3、squash操作中,|mag|作为除数没有加小数防止溢出。4、正常的胶囊网络算法中,动态路由的前两次迭代中capsule是不要梯度的,应该用detach()隔绝一下,他这里没有这么做。
大兄弟,要不要加个QQ一起交流呀?

@imSeaton
Copy link

Graph level classification, how to add batchsize?

If the graph classification algorithm uses the DGL framework, it can divided a graph into mini-batches to accelerate the training.However, in my opinion, the author only uses the concept of batch to compute the average loss of a batch without distributed compution in the CapsGNN code above.

Repository owner deleted a comment from shamnastv Feb 19, 2021
@zhangxin9988
Copy link

In layers.py, add a line b_ij = b_ij + u_vj1 before line 143 b_max = torch.max(b_ij, dim = 2, keepdim = True)

same problem
when epoch is 20, accuracy is only 0.33, and loss is around 2.5

大兄弟,一起撸他的代码呀。我觉得他的代码中可能存在一些问题,例如:1、attention模块之前,tensor 的view操作打乱了数据分布,hidden_representation那里的view也是。2、attention模块和论文里的有点不一样。3、squash操作中,|mag|作为除数没有加小数防止溢出。4、正常的胶囊网络算法中,动态路由的前两次迭代中capsule是不要梯度的,应该用detach()隔绝一下,他这里没有这么做。
大兄弟,要不要加个QQ一起交流呀?

他这里面的维度变换真的很迷,特别是路由部分,真的有必要搞得如此复杂吗?

@Wanghongyu97
Copy link

In layers.py, add a line b_ij = b_ij + u_vj1 before line 143 b_max = torch.max(b_ij, dim = 2, keepdim = True)

same problem
when epoch is 20, accuracy is only 0.33, and loss is around 2.5

大兄弟,一起撸他的代码呀。我觉得他的代码中可能存在一些问题,例如:1、attention模块之前,tensor 的view操作打乱了数据分布,hidden_representation那里的view也是。2、attention模块和论文里的有点不一样。3、squash操作中,|mag|作为除数没有加小数防止溢出。4、正常的胶囊网络算法中,动态路由的前两次迭代中capsule是不要梯度的,应该用detach()隔绝一下,他这里没有这么做。
大兄弟,要不要加个QQ一起交流呀?

他这里面的维度变换真的很迷,特别是路由部分,真的有必要搞得如此复杂吗?
github上有人复现了,可以参考shamnastv/GraphCaps

@zezeze97
Copy link

In layers.py, add a line b_ij = b_ij + u_vj1 before line 143 b_max = torch.max(b_ij, dim = 2, keepdim = True)

same problem
when epoch is 20, accuracy is only 0.33, and loss is around 2.5

大兄弟,一起撸他的代码呀。我觉得他的代码中可能存在一些问题,例如:1、attention模块之前,tensor 的view操作打乱了数据分布,hidden_representation那里的view也是。2、attention模块和论文里的有点不一样。3、squash操作中,|mag|作为除数没有加小数防止溢出。4、正常的胶囊网络算法中,动态路由的前两次迭代中capsule是不要梯度的,应该用detach()隔绝一下,他这里没有这么做。 大兄弟,要不要加个QQ一起交流呀?

加个qq交流一下不?

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

9 participants