mshukor commited on
Commit
7a334a5
·
1 Parent(s): f69cdac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -71,7 +71,7 @@ os.system('wget https://data.isir.upmc.fr/unival/models/unival_refcocog/checkpoi
71
  checkpoint_path = 'checkpoints/unival_caption_stage_1/checkpoint_best_test.pt'
72
 
73
  caption_overrides={"eval_cider":False, "beam":5, "max_len_b":22, "no_repeat_ngram_size":3, "seed":7, "unnormalized": False,
74
- "bpe_dir":"utils/BPE", "video_model_path": None,}
75
 
76
  caption_models, caption_cfg, caption_task = checkpoint_utils.load_model_ensemble_and_task(
77
  utils.split_paths(checkpoint_path),
@@ -81,7 +81,7 @@ caption_models, caption_cfg, caption_task = checkpoint_utils.load_model_ensemble
81
  # Load ckpt & config for Refcoco
82
  checkpoint_path = 'checkpoints/unival_refcocog/checkpoint_best.pt'
83
 
84
- refcoco_overrides = {"bpe_dir":"utils/BPE", "video_model_path": None}
85
 
86
  refcoco_models, refcoco_cfg, refcoco_task = checkpoint_utils.load_model_ensemble_and_task(
87
  utils.split_paths(checkpoint_path),
@@ -98,6 +98,7 @@ refcoco_cfg.generation.no_repeat_ngram_size = 3
98
  # Load pretrained ckpt & config for VQA
99
  checkpoint_path = 'checkpoints/unival_vqa/checkpoint_best.pt'
100
 
 
101
  parser = options.get_generation_parser()
102
  input_args = ["", "--task=vqa_gen", "--beam=100", "--unnormalized", f"--path={checkpoint_path}", "--bpe-dir=utils/BPE"]
103
  args = options.parse_args_and_arch(parser, input_args)
@@ -105,7 +106,8 @@ vqa_cfg = convert_namespace_to_omegaconf(args)
105
  vqa_task = tasks.setup_task(vqa_cfg.task)
106
  vqa_models, vqa_cfg = checkpoint_utils.load_model_ensemble(
107
  utils.split_paths(vqa_cfg.common_eval.path),
108
- task=vqa_task
 
109
  )
110
 
111
  # Load pretrained ckpt & config for Generic Interface
 
71
  checkpoint_path = 'checkpoints/unival_caption_stage_1/checkpoint_best_test.pt'
72
 
73
  caption_overrides={"eval_cider":False, "beam":5, "max_len_b":22, "no_repeat_ngram_size":3, "seed":7, "unnormalized": False,
74
+ "bpe_dir":"utils/BPE", "video_model_path": None, "video_model_path": None, "resnet_model_path": None}
75
 
76
  caption_models, caption_cfg, caption_task = checkpoint_utils.load_model_ensemble_and_task(
77
  utils.split_paths(checkpoint_path),
 
81
  # Load ckpt & config for Refcoco
82
  checkpoint_path = 'checkpoints/unival_refcocog/checkpoint_best.pt'
83
 
84
+ refcoco_overrides = {"bpe_dir":"utils/BPE", "video_model_path": None, "resnet_model_path": None}
85
 
86
  refcoco_models, refcoco_cfg, refcoco_task = checkpoint_utils.load_model_ensemble_and_task(
87
  utils.split_paths(checkpoint_path),
 
98
  # Load pretrained ckpt & config for VQA
99
  checkpoint_path = 'checkpoints/unival_vqa/checkpoint_best.pt'
100
 
101
+ overrides={"video_model_path": None, "resnet_model_path": None}
102
  parser = options.get_generation_parser()
103
  input_args = ["", "--task=vqa_gen", "--beam=100", "--unnormalized", f"--path={checkpoint_path}", "--bpe-dir=utils/BPE"]
104
  args = options.parse_args_and_arch(parser, input_args)
 
106
  vqa_task = tasks.setup_task(vqa_cfg.task)
107
  vqa_models, vqa_cfg = checkpoint_utils.load_model_ensemble(
108
  utils.split_paths(vqa_cfg.common_eval.path),
109
+ task=vqa_task,
110
+ arg_overrides=overrides
111
  )
112
 
113
  # Load pretrained ckpt & config for Generic Interface