Official repository of OFA (ICML 2022). Paper: OFA: Unifying Architectures, Tasks, and Modalities Through a Simple Sequence-to-Sequence Learning Framework
Hi, I pretrained OFA-tiny on my private a tsv file in the form of only VQA (or a tsv file including only caption).
For example,
1 000002b66c9c498e what is the danger for an object in the given image? 1.0|!+Person trips over Table relation qa
After pretaining, I tried to evalutate my model with the provided VQA dataset
I got an error with both files vqa_val.tsv and vqa_test.tsv
Traceback (most recent call last):
File "../../evaluate.py", line 184, in <module>
cli_main()
File "../../evaluate.py", line 178, in cli_main
distributed_utils.call_main(
File "/workspace/mindmap/fairseq/fairseq/distributed/utils.py", line 376, in call_main
distributed_main(cfg.distributed_training.device_id, main, cfg, kwargs)
File "/workspace/mindmap/fairseq/fairseq/distributed/utils.py", line 350, in distributed_main
main(cfg, **kwargs)
File "../../evaluate.py", line 110, in main
model.load_state_dict(checkpoint_utils.load_ema_from_checkpoint(ckpt_path)['model'])
File "/workspace/mindmap/utils/checkpoint_utils.py", line 856, in load_ema_from_checkpoint
model_params = new_state['extra_state']['ema']
KeyError: 'ema'
I guess I missed some parameters (for EMA) to resume, however, I did not change the scripts much.
#!/usr/bin/env bash
# The port for communication. Note that if you want to run multiple tasks on the same machine,
# you need to specify different port numbers.
export MASTER_PORT=8082
user_dir=../../ofa_module
bpe_dir=../../utils/BPE
# val or test
split=$1
data=/media/ssd1/users/jhkim/datasets/mindmap/finetuning/dataset/vqa_data/vqa_${split}.tsv
ans2label_file=../../dataset/vqa_data/trainval_ans2label.pkl
path=../../checkpoints/vqa_last.pt
#path=../../checkpoints/vqa_1_50000.pt
result_path=../../results/vqa_${split}_beam
selected_cols=0,5,2,3,4
CUDA_VISIBLE_DEVICES=0 python3 -m torch.distributed.launch --nproc_per_node=1 --master_port=${MASTER_PORT} ../../evaluate.py \
${data} \
--path=${path} \
--user-dir=${user_dir} \
--task=vqa_gen \
--batch-size=16 \
--log-format=simple --log-interval=10 \
--seed=7 \
--gen-subset=${split} \
--results-path=${result_path} \
--fp16 \
--ema-eval \
--beam-search-vqa-eval \
--beam=5 \
--unnormalized \
--temperature=1.0 \
--num-workers=0 \
--model-overrides="{\"data\":\"${data}\",\"bpe_dir\":\"${bpe_dir}\",\"selected_cols\":\"${selected_cols}\",\"ans2label_file\":\"${ans2label_file}\"}"
With pretrained models from checkpoints.md, I get another error
Hi, I pretrained OFA-tiny on my private a tsv file in the form of only VQA (or a tsv file including only caption). For example,
1 000002b66c9c498e what is the danger for an object in the given image? 1.0|!+Person trips over Table relation qa
After pretaining, I tried to evalutate my model with the provided VQA dataset I got an error with both files vqa_val.tsv and vqa_test.tsv
I guess I missed some parameters (for EMA) to resume, however, I did not change the scripts much.
This is the pretraining script I use:
and this is the evaluation script I use:
With pretrained models from checkpoints.md, I get another error
I would appreciate any help!