Skip to content
Discussion options

You must be logged in to vote

I resolved the first question. For those with a similar problem:
There is a set of rank_zero decorators which can be imported from utilities. The one I used is imported like so:
from pytorch_lightning.utilities.rank_zero import rank_zero_only

Put user interaction into a function like so:

@rank_zero_only
def prelim(args):
    # do as you please here - it will only run once from rank 0

Call it before the trainer.fit(), and it will only run once.

See utilities docs for details ...

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sneiman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment