Skip to content

Instantly share code, notes, and snippets.

@aribornstein
Last active May 5, 2021 19:42
Show Gist options
  • Save aribornstein/511b554ac80015fdf6bb8f7742e2397f to your computer and use it in GitHub Desktop.
Save aribornstein/511b554ac80015fdf6bb8f7742e2397f to your computer and use it in GitHub Desktop.
from pytorch_lighting import seed_everything
from pytorch_lightning.callbacks import EarlyStopping
from pytorch_lightning import Trainer
# seeding for torch, numpy, stdlib random, including DataLoader workers!
seed_everything(123, workers=True)
early_stopping = EarlyStopping(
monitor="val_loss",
stopping_threshold=1e-4,
divergence_threshold=9.0,
check_finite=True,
)
trainer = Trainer(callbacks=[early_stopping],
profiler="pytorch",
tpu_cores=8)
trainer.validate(model, datamodule=datamodule)
trainer.predict(model, datamodule=datamodule)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment