Created
May 29, 2021 07:09
-
-
Save rish-16/14d96490106411b82cd8f5c4086d74eb to your computer and use it in GitHub Desktop.
A guide on Colab TPU training using PyTorch XLA (Part 5.1)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PATH = "./my_dataset/" # path to dataset on Colab instance | |
TRAIN_PATH = PATH + "train/" | |
VAL_PATH = PATH + "val/" | |
# your custom augmentations | |
T = transforms.Compose([ | |
transforms.ToTensor(), | |
... | |
]) | |
# same procedure but you use datasets.ImageFolder(...) instead | |
if not xm.is_master_ordinal(): | |
xm.rendezvous('download_only_once') | |
data_train = datasets.ImageFolder(TRAIN_PATH, transform=T) | |
data_test = datasets.ImageFolder(VAL_PATH, transform=T) | |
if xm.is_master_ordinal(): | |
xm.rendezvous('download_only_once') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment