Open1

PyTorch Lightning の忘れがちな Tips

ちくわぶちくわぶ

再現性確保をしたいときは,Lightning の seed_everything()Trainerdeterministic=True を指定する.

from lightning.pytorch import Trainer, seed_everything

seed_everything(42, workers=True)
# sets seeds for numpy, torch and python.random.
model = Model()
trainer = Trainer(deterministic=True)

https://lightning.ai/docs/pytorch/latest/common/trainer.html#reproducibility