ChenRocks / UNITER

Research code for ECCV 2020 paper "UNITER: UNiversal Image-TExt Representation Learning"
https://arxiv.org/abs/1909.11740
784 stars 109 forks source link

Why we need to add size_mul here? #53

Closed VisualJoyce closed 3 years ago

VisualJoyce commented 3 years ago

Hi, I don't quite understand the code here.

https://github.com/ChenRocks/UNITER/blob/80d3602d71d65700eab373acb0507e31e251b7e7/data/sampler.py#L41-L42

self._size_mul is used for partitioning, then why we need to add it when checking if the full token length is exceeded?

badeaadi commented 3 years ago

Hi @VisualJoyce ,

The sampler adds self._size_mul new items to the current batch it is forming. That batch should not exceed the batch_size from your config file, which here is self._max_tok. It must not exceed maximum number of tokens

VisualJoyce commented 3 years ago

Thank you for the answer!

In my case, I am trying to select a best BUCKET_SIZE and self._max_tok. I guess the value is empirically selected, I might need to change this on a different dataset, right?

badeaadi commented 3 years ago

Indeed, they are empirically selected, but I can provide you with my example based on VQA task. I am currently training the uniter large pretrained on 1080 12GB VRAM

So for me, 3072 is the best, and I imagine you can find yours similarly