ChenRocks / UNITER

Research code for ECCV 2020 paper "UNITER: UNiversal Image-TExt Representation Learning"
https://arxiv.org/abs/1909.11740
784 stars 109 forks source link

TypeError: forward() got an unexpected keyword argument 'input_ids' #35

Closed foxm79 closed 4 years ago

foxm79 commented 4 years ago

Hello I am just onboarding this repo and am stuck at the following step:

  1. Run inference for the NLVR2 task and then evaluate.

inference

python inf_nlvr2.py --txt_db /txt/nlvr2_test1.db/ --img_db /img/nlvr2_test/ \ --train_dir /storage/nlvr-base/ --ckpt 6500 --output_dir . --fp16

.

I first got an hvd error that I resolved by adding a hvd.init() in the /data/data.py after importing hvd.

But now I get the error below. Can you please let me know what I could be doing incorrectly?

Traceback (most recent call last): File "inf_nlvr2.py", line 138, in main(args) File "inf_nlvr2.py", line 71, in main results = evaluate(model, eval_dataloader, device) File "/opt/conda/lib/python3.6/site-packages/torch/autograd/grad_mode.py", line 43, in decorate_no_grad return func(args, kwargs) File "inf_nlvr2.py", line 92, in evaluate scores = model(batch, targets=None, compute_loss=False) File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in call result = self.forward(input, kwargs) File "/opt/conda/lib/python3.6/site-packages/apex/amp/_initialize.py", line 177, in new_fwd applier(kwargs, input_caster)) TypeError: forward() got an unexpected keyword argument 'input_ids'

ChenRocks commented 4 years ago

Thanks for reporting. It should be fixed now.

For more details, this bug was introduced in this commit, where we change the input format for the models.

foxm79 commented 4 years ago

That was very quick ChenRocks:)

Thanks for fixing this and also for all the great work!!!

Thanks, Regards, -Abhinav.


From: Yen-Chun Chen notifications@github.com Sent: Monday, October 12, 2020 1:19 PM To: ChenRocks/UNITER UNITER@noreply.github.com Cc: Abhinav Mathur m_abhinav@hotmail.com; Author author@noreply.github.com Subject: Re: [ChenRocks/UNITER] TypeError: forward() got an unexpected keyword argument 'input_ids' (#35)

Closed #35https://github.com/ChenRocks/UNITER/issues/35.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ChenRocks/UNITER/issues/35#event-3868157472, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGCDUBHCRUW43WWYOYOGYT3SKNQELANCNFSM4SMCV3XA.

foxm79 commented 4 years ago

Hi ChenRocks,

I have trained the VQA after following your work here.

Is there a code to just input one single image and a corresponding question and get the answer back?

Do you have some kind of a demo like this? https://github.com/lichengunc/MAttNet#demo

Thanks, Regards, -Abhinav.


From: Yen-Chun Chen notifications@github.com Sent: Monday, October 12, 2020 1:19 PM To: ChenRocks/UNITER UNITER@noreply.github.com Cc: Abhinav Mathur m_abhinav@hotmail.com; Author author@noreply.github.com Subject: Re: [ChenRocks/UNITER] TypeError: forward() got an unexpected keyword argument 'input_ids' (#35)

Thanks for reporting. It should be fixed now.

For more details, this bug was introduced in this commithttps://github.com/ChenRocks/UNITER/commit/cd546652babc8304e09dd057742d86399de8f53d#diff-ea97d53e356967e430941d4fdd588f01L244, where we change the input format for the models.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ChenRocks/UNITER/issues/35#issuecomment-707325786, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGCDUBCAN2UGNPD5H27OTQ3SKNQEJANCNFSM4SMCV3XA.