Snippets Collections
# Unoptimized generator
training_generator = SomeSingleCoreGenerator('some_training_set_with_labels.pt')

# Train model
for epoch in range(max_epochs):
    for local_X, local_y in training_generator:
        # Your model
        [...]
# Load entire dataset
X, y = torch.load('some_training_set_with_labels.pt')

# Train model
for epoch in range(max_epochs):
    for i in range(n_batches):
        # Local batches and labels
        local_X, local_y = X[i*n_batches:(i+1)*n_batches,], y[i*n_batches:(i+1)*n_batches,]

        # Your model
        [...]
star

Fri Jul 02 2021 13:44:34 GMT+0000 (UTC) https://stanford.edu/~shervine/blog/pytorch-how-to-generate-data-parallel

#gnn #pytorch #loaddata #trainset
star

Fri Jul 02 2021 13:43:59 GMT+0000 (UTC) https://stanford.edu/~shervine/blog/pytorch-how-to-generate-data-parallel

#gnn #pytorch #trainset #loaddata

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension