microsoft / Oscar

Oscar and VinVL
MIT License
1.04k stars 251 forks source link

A JSONDecoder ERROR when inference:‘TypeError: __init__() missing 2 required positional arguments: 'doc' and 'pos'’ #145

Open Nonmy opened 2 years ago

Nonmy commented 2 years ago

I run 'run_caption.py' using provided scripts and checkpoints. Both oscar and vinvl Inference breaks when meet the 16 it or image_id:384012. I check the json file on here and seems to be valid. I'm a new learner, any solution or suggestion may help me a lot. Thanks! 2021-09-19 07:47:58,959 vlpretrain INFO: Evaluate on dataset: test.yaml 16it [04:29, 16.87s/it] Traceback (most recent call last): File "/home/user/PY/pycharm-community-2019.1.3/helpers/pydev/pydevd.py", line 1758, in main() File "/home/user/PY/pycharm-community-2019.1.3/helpers/pydev/pydevd.py", line 1752, in main globals = debugger.run(setup['file'], None, None, is_module) File "/home/user/PY/pycharm-community-2019.1.3/helpers/pydev/pydevd.py", line 1147, in run pydev_imports.execfile(file, globals, locals) # execute the script File "/home/user/PY/pycharm-community-2019.1.3/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/home/user/lta/learning/image_caption/oscar/oscar/run_captioning.py", line 1017, in main() File "/home/user/lta/learning/image_caption/oscar/oscar/run_captioning.py", line 1009, in main test(args, test_dataloader, model, tokenizer, predict_file) File "/home/user/lta/learning/image_caption/oscar/oscar/run_captioning.py", line 708, in test tsv_writer(gen_rows(), cache_file) File "/home/user/lta/learning/image_caption/oscar/oscar/utils/tsv_file_ops.py", line 17, in tsv_writer for value in values: File "/home/user/lta/learning/image_caption/oscar/oscar/run_captioning.py", line 677, in gen_rows for step, (img_keys, batch) in tqdm(enumerate(test_dataloader)): File "/home/user/anaconda3/envs/oscar/lib/python3.7/site-packages/tqdm/std.py", line 1185, in iter for obj in iterable: File "/home/user/anaconda3/envs/oscar/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 819, in next return self._process_data(data) File "/home/user/anaconda3/envs/oscar/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 846, in _process_data data.reraise() File "/home/user/anaconda3/envs/oscar/lib/python3.7/site-packages/torch/_utils.py", line 369, in reraise raise self.exc_type(msg) TypeError: init() missing 2 required positional arguments: 'doc' and 'pos'

Nonmy commented 2 years ago

In this issue #49 they meet very similar question in training time using their customized dataset. However, I just work with the provided code and data, and didn't change anything,