MUNIT icon indicating copy to clipboard operation
MUNIT copied to clipboard

Question about batch_size and training time

Open Rivendile opened this issue 4 years ago • 3 comments

When the batch_size is 1, the training time of each iteration is 0.3s. However, when I changed the batch_size to 3, the training time of each iteration becomes 1.9s, which is about 6x than before. This is really different from other models I have trained. Could anyone tell me why this happened, or is this a normal case?

Rivendile avatar Jan 14 '20 16:01 Rivendile

It seems that it's because of the version of pytorch. When I train with pytorch1.2.0, the speed seems reasonable!

Rivendile avatar Jan 16 '20 02:01 Rivendile

When the batch size is larger, the speed is slower? Or can I increase the batch size and reduce the number of training?

s0966066980 avatar Sep 30 '21 16:09 s0966066980

When you increase the batch size, you are training more images in each iteration. Therefore, you spend more time in each iteration. It is true that you can increase the batch size while reducing the iterations. However, as this experiment shows, batch size = 1 delivers the best result.

ShenZheng2000 avatar Jan 16 '23 04:01 ShenZheng2000