The imagenet example: examples/main.py at master · pytorch/examples (github.com) is a good starting point. If you have an existing dataset, you should just be able to use a pretrained model and plug in your existing dataset with minimal changes (e.g., replace the fully connected layer with one that matches the number of classes you have).