BatsResearch / csp

Learning to compose soft prompts for compositional zero-shot learning.
BSD 3-Clause "New" or "Revised" License
83 stars 6 forks source link

Experiment Name bug in open-world setting #21

Closed oldtrick closed 6 months ago

oldtrick commented 7 months ago

Hello,I run evaluate.py in open-world setting, as mentioned in the README.md

python -u evaluate.py --dataset mit-states --soft_embeddings data/model/mit-states/sample_model/soft_embeddings_epoch_5.pt --context_length 16 --text_encoder_batch_size 36 --eval_batch_size 256 --experiment_name czsl --threshold 0.4069159426 --open_world

but I encountered this bug:

File "csp/models/compositional_modules.py", line 20, in get_model raise NotImplementedError( NotImplementedError: Error: Unrecognized Experiment Name czsl.

so, I changed the command:

python -u evaluate.py --dataset mit-states --soft_embeddings data/model/mit-states/sample_model/soft_embeddings_epoch_5.pt --context_length 16 --text_encoder_batch_size 36 --eval_batch_size 256 --experiment_name csp --threshold 0.4069159426 --open_world

then I encountered this bug:

File "evaluate.py", line 728, in model.set_soft_embeddings(soft_embs) File "csp/clip_modules/interface.py", line 79, in set_soft_embeddings raise RuntimeError(f"Error: Incorrect Soft Embedding Shape {se.shape}, Expecting {self.soft_embeddings.shape}!") RuntimeError: Error: Incorrect Soft Embedding Shape torch.Size([360, 768]), Expecting torch.Size([360, 512])!

oldtrick commented 6 months ago

I have solved the problem! Sorry to bother you! It is because of the default clip_model in config is ViT-B/32, but it is set as ViT-L/14 when training!