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

batch #10

Open
Lorraine-Kwok opened this issue Apr 16, 2023 · 5 comments
Open

batch #10

Lorraine-Kwok opened this issue Apr 16, 2023 · 5 comments

Comments

@Lorraine-Kwok
Copy link

您好,請問使用batch-DCRN進行訓練時顯示
size mismatch for b: copying a param with shape torch.Size([10000, 20]) from checkpoint, the shape in current model is torch.Size([1]).
請問該怎麼解決呢?

@yueliu1999
Copy link
Owner

您好,感谢关注。请问是哪一个数据集呢?这个错误看起来是有个参数b可能模型里面写的是一个vector(Size([1])),而checkpoints里面是一个matrix(Size([10000, 20]))。

@Lorraine-Kwok
Copy link
Author

前輩,我剛剛又試著運行了dblp,報錯如下:
size mismatch for b: copying a param with shape torch.Size([4057, 20]) from checkpoint, the shape in current model is torch.Size([1]).

@yueliu1999
Copy link
Owner

dblp这个数据集我没有使用batch training,一般的gpu都可以使用整张图来训练,我建议可以直接使用非batch版本的代码。如果你需要在dblp上batch training的话可能需要修改一下b这个参数的shape。

@Lorraine-Kwok
Copy link
Author

我有一個其他數據集10000*256,在非batch版本會溢出,生成了預訓練模型加載到batch版本會報此錯,應該如何修改b呢?
直接改動這一行嗎?self.b = Parameter(nn.init.constant_(torch.zeros(1), 0.5), requires_grad=True)
新手還不太會改,麻煩前輩了

@yueliu1999
Copy link
Owner

self.b = Parameter(nn.init.constant_(torch.zeros(n_node, opt.args.n_z), 0.5), requires_grad=True),试试这个看看行不行

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

2 participants