Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

additional argument not recognized in MODEL_TYPES #123

Open
arnabk001 opened this issue Mar 21, 2024 · 0 comments
Open

additional argument not recognized in MODEL_TYPES #123

arnabk001 opened this issue Mar 21, 2024 · 0 comments

Comments

@arnabk001
Copy link

Created a new file models/mrl_clip.py and updated the models/__init__.py, but the MODEL_TYPES is not updated.

from typing import Union
import torch
from .open_clip import load_open_clip
from .japanese_clip import load_japanese_clip
from .mrl_clip import load_mrl_clip

# loading function must return (model, transform, tokenizer)
TYPE2FUNC = {
    "open_clip": load_open_clip,
    "ja_clip": load_japanese_clip,
    "mrl_clip": load_mrl_clip,
}
MODEL_TYPES = list(TYPE2FUNC.keys())


def load_clip(
        model_type: str,
        model_name: str,
        pretrained: str,
        cache_dir: str,
        device: Union[str, torch.device] = "cuda"
):
    assert model_type in MODEL_TYPES, f"model_type={model_type} is invalid!"
    load_func = TYPE2FUNC[model_type]
    return load_func(model_name=model_name, pretrained=pretrained, cache_dir=cache_dir, device=device)

Error details:

(/gscratch/krishna/arnabk1/pyclip) [arnabk1@g3041 clip_benchmark]$ python3 cli.py eval --model_type "mrl_clip" --pretrained "/gscratch/krishna/arnabk1/clip_benchmark/clip_benchmark/models/mrl_true_mp_rank_00_model_stat
es.pt" --task "zeroshot_classification" --dataset "imagenet1k"
usage: cli.py eval [-h] [--dataset DATASET [DATASET ...]] [--dataset_root DATASET_ROOT] [--split SPLIT]
                   [--test_split SPLIT] [--train_split TRAIN_SPLIT [TRAIN_SPLIT ...]]
                   [--val_split VAL_SPLIT [VAL_SPLIT ...] | --val_proportion VAL_PROPORTION
                   [VAL_PROPORTION ...]] [--model MODEL [MODEL ...]]
                   [--pretrained PRETRAINED [PRETRAINED ...]]
                   [--pretrained_model PRETRAINED_MODEL [PRETRAINED_MODEL ...]]
                   [--task {zeroshot_classification,zeroshot_retrieval,linear_probe,captioning,image_caption_selection,auto}]
                   [--no_amp] [--num_workers NUM_WORKERS] [--recall_k RECALL_K [RECALL_K ...]]
                   [--fewshot_k FEWSHOT_K] [--fewshot_epochs FEWSHOT_EPOCHS] [--fewshot_lr FEWSHOT_LR]
                   [--skip_load] [--distributed] [--seed SEED] [--batch_size BATCH_SIZE]
                   [--normalize NORMALIZE] [--model_cache_dir MODEL_CACHE_DIR]
                   [--feature_root FEATURE_ROOT] [--annotation_file ANNOTATION_FILE]
                   [--custom_classname_file CUSTOM_CLASSNAME_FILE]
                   [--custom_template_file CUSTOM_TEMPLATE_FILE] [--dump_classnames] [--dump_templates]
                   [--language LANGUAGE [LANGUAGE ...]] [--output OUTPUT] [--quiet] [--save_clf SAVE_CLF]
                   [--load_clfs LOAD_CLFS [LOAD_CLFS ...]] [--skip_existing]
                   [--model_type {open_clip,ja_clip}] [--wds_cache_dir WDS_CACHE_DIR]
cli.py eval: error: argument --model_type: invalid choice: 'mrl_clip' (choose from 'open_clip', 'ja_clip')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant