muzairkhattak / multimodal-prompt-learning

[CVPR 2023] Official repository of paper titled "MaPLe: Multi-modal Prompt Learning".
https://muzairkhattak.github.io/multimodal-prompt-learning/
MIT License
619 stars 43 forks source link

About dim0 of prompts #14

Closed SHIBOYA closed 1 year ago

SHIBOYA commented 1 year ago

in the def construct_prompts(self, ctx, prefix, suffix, label=None) of maple.py, you note "dim0 is either batch_size (during training) or n_cls (during testing)". but when I print the dim on some datasets, say caltech101, the dim0 is always 50 both in train and test settings. where is the batch size? and the class number of caltech101 can't be 50

muzairkhattak commented 1 year ago

Hi @SHIBOYA,

Thank you for showing interest in MaPLe.

but when I print the dim on some datasets, say caltech101, the dim0 is always 50 both in train and test settings. where is the batch size? and the class number of caltech101 can't be 50

Actually you are running MaPLe in base-to-novel generalization setting, in which a given dataset is split into base and novel classes. So for the case of Caltech, we split it into 50 base and 50 novel classes. So thats why the dim0 is always 50 for the case of Caltech.

It will be 50 for other datasets too that have around 100 classes in total.

I hope your query is answered.

Kindly let us know incase there is any further question. Thank you!

SHIBOYA commented 1 year ago

Thank you very much for answering my question, but I still can't find where to set the batch size?

muzairkhattak commented 1 year ago

Hi @SHIBOYA,

The batch size here corresponds to the number of classes for the dataset.

So as the number of classes are fixed for a dataset, we cannot change the batch size.

You can only change batch size for images, not for text embeddings.

I hope your query has been answered.

Thank you!

SHIBOYA commented 1 year ago

where to change the batch size for images?

muzairkhattak commented 1 year ago

You can change the batch size for images in the respective config files.

For example, please change the batch size at this line in the config file for the case of MaPLe.

Thank you.

SHIBOYA commented 1 year ago

Thank you very much!