CasRelPyTorch icon indicating copy to clipboard operation
CasRelPyTorch copied to clipboard

更换数据集的问题

Open GekiKaraa opened this issue 2 years ago • 2 comments

你好!我按照readme里面的格式定义了我的数据集,但是运行时在loss_fn中计算predict['obj_heads']的时候会出现传入的gold参数tensor多出一维的问题,使用code中自带的baidu数据集就不会出现这种情况,数据的格式都是一样的,请问这是因为处理过程有什么不同吗? 具体报错信息如下:

File "/CasRelPyTorch/Run.py", line 38, in loss_fn
    loss = F.binary_cross_entropy(pred, gold, reduction='none')
 
File "/python3.7/site-packages/torch/nn/functional.py", line 2752, in binary_cross_entropy
    "Please ensure they have the same size.".format(target.size(), input.size())

ValueError: Using a target size (torch.Size([8, 148, 1])) that is different to the input size (torch.Size([8, 148])) is deprecated. Please ensure they have the same size.

GekiKaraa avatar Nov 18 '22 11:11 GekiKaraa

你好!我按照readme里面的格式定义了我的数据集,但是运行时在loss_fn中计算predict['obj_heads']的时候会出现传入的gold参数tensor多出一维的问题,使用code中自带的baidu数据集就不会出现这种情况,数据的格式都是一样的,请问这是因为处理过程有什么不同吗? 具体报错信息如下:

File "/CasRelPyTorch/Run.py", line 38, in loss_fn
    loss = F.binary_cross_entropy(pred, gold, reduction='none')
 
File "/python3.7/site-packages/torch/nn/functional.py", line 2752, in binary_cross_entropy
    "Please ensure they have the same size.".format(target.size(), input.size())

ValueError: Using a target size (torch.Size([8, 148, 1])) that is different to the input size (torch.Size([8, 148])) is deprecated. Please ensure they have the same size.

我跟你一样的问题,请问你解决了吗?

ericzikun avatar Feb 18 '23 14:02 ericzikun

你好,请问解决了吗

258508 avatar Aug 30 '23 13:08 258508