Question about main_process_first

@sayakpaul @patrickvonplaten
I am new to diffuser lib and accelerator , in the example/train_text_to_image.py

diffusers/examples/text_to_image/train_text_to_image.py

Line 700 in c13dbd5

with accelerator.main_process_first():

I see the main_process_first is called, I am confused about this. Is it necessary to use it? why should the main process do the operation first?

Addtionally, I see you pass the seed to the shuffle function, so every process can get the same seed value which can make sure each of them gets the same dataset?

Thanks a lot!