DAMO-NLP-SG/VCD

ValueError when initing

Closed this issue · 1 comments

I follow the setup instruction:

conda create -yn vcd python=3.9
conda activate vcd
cd VCD
pip install -r requirements.txt

and then try to use llava model to eval, the code is:

from argparse import ArgumentParser, Namespace

from experiments.eval.object_hallucination_vqa_llava import eval_model

model_path = "/root/llm-project/utils/models/models-repo/llava-v1.5-7b/"
model_base = None
model_name = "llava-v1.5-7b"


def parse_args() -> Namespace:
    parser = ArgumentParser()
    parser.add_argument("--model-path", type=str, default=model_path)
    parser.add_argument("--model-base", type=str, default=model_base)
    parser.add_argument("--model-name", type=str, default=model_name)
    parser.add_argument("--image-folder", type=str, default="my_images/Object_HalBench")
    parser.add_argument("--question-file", type=str, default="dataset/Object_HalBench.jsonl")
    parser.add_argument("--answers-file", type=str, default="./answer.jsonl")
    parser.add_argument("--conv-mode", type=str, default="llava_v1")
    parser.add_argument("--num-chunks", type=int, default=1)
    parser.add_argument("--chunk-idx", type=int, default=0)
    parser.add_argument("--temperature", type=float, default=0.2)
    parser.add_argument("--top_p", type=float, default=None)
    parser.add_argument("--num_beams", type=int, default=1)
    # VCD
    parser.add_argument("--noise_step", type=int, default=500)
    parser.add_argument("--use_cd", action="store_true", default=True)
    parser.add_argument("--cd_alpha", type=float, default=1)
    parser.add_argument("--cd_beta", type=float, default=0.1)
    parser.add_argument("--seed", type=int, default=42)
    return parser.parse_args()


if __name__ == "__main__":
    args: Namespace = parse_args()
    eval_model(args)

But encountered an error:

Traceback (most recent call last):
  File "/root/llm-project/VCD/test_vcd.py", line 3, in <module>
    from experiments.eval.object_hallucination_vqa_llava import eval_model
  File "/root/llm-project/VCD/experiments/eval/object_hallucination_vqa_llava.py", line 11, in <module>
    from llava.constants import DEFAULT_IM_END_TOKEN, DEFAULT_IM_START_TOKEN, DEFAULT_IMAGE_TOKEN, IMAGE_TOKEN_INDEX
  File "/root/llm-project/VCD/experiments/llava/__init__.py", line 1, in <module>
    from .model import LlavaLlamaForCausalLM
  File "/root/llm-project/VCD/experiments/llava/model/__init__.py", line 1, in <module>
    from .language_model.llava_llama import LlavaLlamaForCausalLM, LlavaConfig
  File "/root/llm-project/VCD/experiments/llava/model/language_model/llava_llama.py", line 165, in <module>
    AutoConfig.register("llava", LlavaConfig)
  File "/usr/local/lib/python3.10/dist-packages/transformers/models/auto/configuration_auto.py", line 1059, in register
    CONFIG_MAPPING.register(model_type, config, exist_ok=exist_ok)
  File "/usr/local/lib/python3.10/dist-packages/transformers/models/auto/configuration_auto.py", line 758, in register
    raise ValueError(f"'{key}' is already used by a Transformers config, pick another name.")
ValueError: 'llava' is already used by a Transformers config, pick another name.

I apologize for my carelessness; I resolved the issue by reinstalling the environment.