Paddle icon indicating copy to clipboard operation
Paddle copied to clipboard

batch_size must be small than data pool_size?why?

Open wangsouc opened this issue 9 years ago • 1 comments

batch_size = 128, data pool_size = 500, train well batch_size = 128, data pool_size = 50, train hang

batch_size must be small than data pool_size? why? how to set a better data pool_size?

wangsouc avatar May 12 '17 00:05 wangsouc

Data feeding interface in PaddlePaddle is implemented by python generator so that the user only needs to focus on how to generate a single training sample from the original data file. At the meanwhile, how well training data are shuffled often affects the learning performance.

In PaddlePaddle pool_size defined a minimum amount of training samples to be shuffled. Simply speaking, PaddlePaddle maintains a pool with the size indicated by pool_size. Before starting training, PaddlePaddle first fills the pool and shuffle it, and then feeds the shuffled data to the training process batch by batch.

If a small pool size is set, the training data will not be well shuffled, which usually leads to a decline in learning performance according to my experience. A large pool size requires much more memory, but if you have enough CPU memory, I suggest a large pool size to guarantee the randomness of training samples.

It is not reasonable that the training is hung if pool_size is set smaller than batch size, we will check it.

lcy-seso avatar May 12 '17 01:05 lcy-seso