Skip to content

Instantly share code, notes, and snippets.

@Borda
Created September 4, 2021 19:18
Show Gist options
  • Select an option

  • Save Borda/5eb3dea49aff2cd60f8c88e1e3f01a3c to your computer and use it in GitHub Desktop.

Select an option

Save Borda/5eb3dea49aff2cd60f8c88e1e3f01a3c to your computer and use it in GitHub Desktop.
Converting Kaggle Training Notebooks to Shareable Code
from pytorch_lightning import Trainer
from kaggle_plantpatho.data import PlantPathologyDM
from kaggle_plantpatho.models import LitResnet, MultiPlantPathology
# create DataModule with training/validation split
dm = PlantPathologyDM(batch_size=98)
# initialize ResNet50 network
net = LitResnet(arch='resnet50', num_classes=dm.num_classes)
# initialize PL module with ResNet50
model = MultiPlantPathology(model=net, lr=6e-4)
# create Trainer with custome arguments
trainer = Trainer(...)
# train the model
trainer.fit(model=model, datamodule=dm)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment