jiasenlu / vilbert_beta

473 stars 96 forks source link

Train ViLBERT for DownStream Tasks for VCR #17

Closed brian7685 closed 5 years ago

brian7685 commented 5 years ago

I encountered an issue in: File "/home/XXX/vilbert_beta/vilbert/vilbert.py", line 322, in forward position_ids = position_ids.unsqueeze(0).expand_as(input_ids) RuntimeError: The expanded size of the tensor (60) must match the existing size (4) at non-singleton dimension 2. Target sizes: [16, 4, 60]. Tensor sizes: [1, 4]

From the code we can see: seq_length = input_ids.size(1) position_ids = torch.arange( seq_length, dtype=torch.long, device=input_ids.device ) The input_ids is [16, 4, 60] position_ids is [4] How do we fit the 60? Thanks!

rmrao commented 5 years ago

I encountered this as well. It seems to be a bug in line 89 of vilbert/task_utils.py. The identifier 'TASK1' is omitted - I think it should be added there.

yangzhch6 commented 5 years ago

@rmrao Your answer has solved my problem! Thank you very much. What I want to add is, in line 29 of vilbert/task_utils.py, I think the identifier 'TASK1' is omitted.

zc-alexfan commented 4 years ago

Just an extra comment. We need to change this line as well in the validation function.