Skip to content

Commit

Permalink
feat: Updated src/main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-nightly[bot] authored Oct 24, 2023
1 parent 2ab11cb commit 1ff1425
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
from PIL import Image
import torch
import torch.nn as nn
Expand All @@ -6,6 +7,8 @@
from torch.utils.data import DataLoader
import numpy as np

logging.basicConfig(filename='training.log', level=logging.INFO, format='%(asctime)s %(message)s')

# Step 1: Load MNIST Data and Preprocess
transform = transforms.Compose([
transforms.ToTensor(),
Expand Down Expand Up @@ -42,6 +45,7 @@ def forward(self, x):
optimizer.zero_grad()
output = model(images)
loss = criterion(output, labels)
logging.info('Epoch: %s, Loss: %s', epoch, loss.item())
loss.backward()
optimizer.step()

Expand Down

0 comments on commit 1ff1425

Please sign in to comment.