Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
kennymckormick committed Jan 4, 2024
1 parent e87fd1b commit 02e7359
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ xformers
termcolor
xtuner
SwissArmyTransformer
huggingface_hub
visual_genome
wandb
pycocoevalcap
Expand Down
5 changes: 2 additions & 3 deletions vlmeval/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from functools import partial

PandaGPT_ROOT = None
Flamingov2_CKPT_PTH = None
MiniGPT4_ROOT = None
TransCore_ROOT = None

Expand All @@ -23,8 +22,8 @@
'TransCore_M': partial(TransCoreM, root=TransCore_ROOT),
'qwen_chat': partial(QwenVLChat, model_path='Qwen/Qwen-VL-Chat'),
'PandaGPT_13B': partial(PandaGPT, name='PandaGPT_13B', root=PandaGPT_ROOT),
'flamingov2': partial(OpenFlamingo, name='v2', mpt_pth='anas-awadalla/mpt-7b', ckpt_pth=Flamingov2_CKPT_PTH),
'flamingov2_fs': partial(OpenFlamingo, name='v2', with_context=True, mpt_pth='anas-awadalla/mpt-7b', ckpt_pth=Flamingov2_CKPT_PTH),
'flamingov2': partial(OpenFlamingo, name='v2', mpt_pth='anas-awadalla/mpt-7b', ckpt_pth='openflamingo/OpenFlamingo-9B-vitl-mpt7b'),
'flamingov2_fs': partial(OpenFlamingo, name='v2', with_context=True, mpt_pth='anas-awadalla/mpt-7b', ckpt_pth='openflamingo/OpenFlamingo-9B-vitl-mpt7b'),
'idefics_9b_instruct': partial(IDEFICS, name='idefics_9b_instruct', model_path_map=idefics_model_path_map),
'idefics_80b_instruct': partial(IDEFICS, name='idefics_80b_instruct', model_path_map=idefics_model_path_map),
'idefics_9b_instruct_fs': partial(IDEFICS, name='idefics_9b_instruct', model_path_map=idefics_model_path_map, with_context=True),
Expand Down
21 changes: 20 additions & 1 deletion vlmeval/vlm/open_flamingo.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from PIL import Image
import os.path as osp
import warnings
from ..smp import splitlen, get_cache_path
from huggingface_hub import snapshot_download

class OpenFlamingo:

Expand All @@ -22,7 +24,24 @@ def __init__(self,
if ckpt_pth is None:
warnings.warn('Please set `ckpt_pth` to the openflamingo ckpt, which is the `checkpoint.pt` file downloaded from: https://huggingface.co/openflamingo/OpenFlamingo-9B-vitl-mpt7b/tree/main. ' )
sys.exit(-1)

else:
if osp.exists(ckpt_pth):
if ckpt_pth.endswith('checkpoint.pt'):
pass
elif osp.isdir(ckpt_pth):
ckpt_pth = osp.join(ckpt_pth, 'checkpoint.pt')
if not osp.exists(ckpt_pth):
sys.exit(-1)
elif splitlen(ckpt_pth, '/') == 2:
cache_path = get_cache_path(ckpt_pth)
if cache_path is None:
snapshot_download(ckpt_pth)
cache_path = get_cache_path(ckpt_pth)
if cache_path is None:
sys.exit(-1)
else:
ckpt_pth = osp.join(cache_path, 'checkpoint.pt')

self.name = name
assert name in ['v2']
self.mpt_pth = mpt_pth
Expand Down

0 comments on commit 02e7359

Please sign in to comment.