Skip to content

Commit

Permalink
Sandbox run src/main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-nightly[bot] authored Nov 26, 2023
1 parent 375f6d6 commit efdeda6
Showing 1 changed file with 7 additions and 22 deletions.
29 changes: 7 additions & 22 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,21 @@
import torch
import torch.nn as nn
import torch.optim as optim
from cnn import CNN, train
from PIL import Image
from torch.utils.data import DataLoader
from torchvision import datasets, transforms

from cnn import CNN, train

# Step 1: Load MNIST Data and Preprocess
transform = transforms.Compose([
transforms.ToTensor(),
transforms.Normalize((0.5,), (0.5,))
])
transform = transforms.Compose(
[transforms.ToTensor(), transforms.Normalize((0.5,), (0.5,))]
)

trainset = datasets.MNIST('.', download=True, train=True, transform=transform)
trainset = datasets.MNIST(".", download=True, train=True, transform=transform)
trainloader = DataLoader(trainset, batch_size=64, shuffle=True)

















model = Net()
model = CNN()
optimizer = optim.SGD(model.parameters(), lr=0.01)
Expand All @@ -41,4 +26,4 @@
train(model, trainloader, optimizer)


torch.save(model.state_dict(), "mnist_model.pth")
torch.save(model.state_dict(), "mnist_model.pth")

0 comments on commit efdeda6

Please sign in to comment.