-
Notifications
You must be signed in to change notification settings - Fork 7
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
RuntimeError: 1D target tensor expects 2D input tensors, but found inputs with sizes [46, 8, 50] and [46, 8, 50]. #5
Comments
Hello, have you solved it? I also encountered the same problem |
Are there details of the errors reported? I haven't encountered this problem yet |
File "/media/data2/zhukang/bigmodel_shared_and_private/DMD-main/train.py", line 6, in |
sorry,I haven‘t solve this problem,but adjusted the 2D to 3D could get the another result.Good luck!
我往北追_?
***@***.***
…------------------ 原始邮件 ------------------
发件人: ***@***.***>;
发送时间: 2023年7月11日(星期二) 下午3:24
收件人: ***@***.***>;
抄送: ***@***.***>; ***@***.***>;
主题: Re: [mdswyz/DMD] RuntimeError: 1D target tensor expects 2D input tensors, but found inputs with sizes [46, 8, 50] and [46, 8, 50]. (Issue #5)
Are there details of the errors reported? I haven't encountered this problem yet
File "/media/data2/zhukang/bigmodel_shared_and_private/DMD-main/train.py", line 6, in
DMD_run(model_name='dmd', dataset_name='mosi', is_tune=False, seeds=[1111], model_save_dir="./pt",
File "/media/data2/zhukang/bigmodel_shared_and_private/DMD-main/run.py", line 94, in DMD_run
result = _run(args, num_workers, is_tune)
File "/media/data2/zhukang/bigmodel_shared_and_private/DMD-main/run.py", line 179, in _run
epoch_results = trainer.do_train(model, dataloader, return_epoch_results=from_sena)
File "/media/data2/zhukang/bigmodel_shared_and_private/DMD-main/trains/singleTask/DMD.py", line 141, in do_train
cosine_similarity_s_c_l = self.cosine(output['s_l'], output['c_l'],
File "/media/data2/zhukang/anaconda3/envs/zk/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "/media/data2/zhukang/anaconda3/envs/zk/lib/python3.8/site-packages/torch/nn/modules/loss.py", line 1276, in forward
return F.cosine_embedding_loss(input1, input2, target, margin=self.margin, reduction=self.reduction)
File "/media/data2/zhukang/anaconda3/envs/zk/lib/python3.8/site-packages/torch/nn/functional.py", line 3490, in cosine_embedding_loss
return torch.cosine_embedding_loss(input1, input2, target, margin, reduction_enum)
RuntimeError: 1D target tensor expects 2D input tensors, but found inputs with sizes [46, 16, 50] and [46, 16, 50]
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
You can change to output['s_l'].transpose(0,1).contigouuous.view(labels.size(0),-1). Other outputs that use to calculate cosine_similarity can be changed in the same way. If you use pytorch1.9.1 as we used, this error will not appear. |
Hello,when I review the process of t
![Uploading NQN42)~KA9S8C_UZTB(CC]A.png…]()
rain,this problem has been generated。 Could you tell me how to solve this question?
The text was updated successfully, but these errors were encountered: