open_flamingo: Imagenet evaluation error
When running
python open_flamingo/eval/evaluate.py \
--lm_path llama/7B-hf \
--lm_tokenizer_path llama/7B-hf \
--checkpoint_path OpenFlamingo-9B/checkpoint.pt \
--imagenet_root datasets/imagenet \
--eval_imagenet \
--cross_attn_every_n_layers 2 \
--device 1
I get the following error:
Using pad_token, but it is not set yet.
Loading checkpoint shards: 100%|
Flamingo model initialized with 2425735200 trainable parameters
Evaluating on ImageNet...
processing batch 0 of 625
0%| | 0/1000 [00:00<?, ?it/s]
Traceback (most recent call last):
File "openflamingo/open_flamingo/eval/evaluate.py", line 961, in <module>
main()
File "openflamingo/open_flamingo/eval/evaluate.py", line 295, in main
imagenet_score = evaluate_imagenet(
File "openflamingo/open_flamingo/eval/evaluate.py", line 917, in evaluate_imagenet
per_sample_probs = compute_per_sample_probs(
File "openflamingo/open_flamingo/eval/classification.py", line 76, in compute_per_sample_probs
shift_logits, shift_labels = compute_shifted_logits_and_labels(
File "openflamingo/open_flamingo/eval/classification.py", line 57, in compute_shifted_logits_and_labels
end_of_prefix = -labels[idx].tolist()[::-1].index(tokenizer.eos_token_id) - 1
ValueError: 2 is not in list
Any ideas how to fix it?
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 19
Till now I still cannot find where causing the crash on ImageNet evaluation.
Instead, I can provide a simple ImageNet evaluation script which is written by myself but is more intuitive than implementation in evaluate.py:
Wish this code can help someone who want to evaluate flamingo on ImageNet! Iām not sure that the script is completely correct. If there are any problem, feel free to comment in this issue. Note that context text input is hard coded. Remember to modify it when you change
context_num.When setting the tokens in
tokenizer_config.jsonmanually, it runs š