Why my CNN IS NOT LEARNING.Couldn't able to use CNNs #479
msarathrahul
started this conversation in
General
Replies: 1 comment 1 reply
-
|
I faced a similar issue. changing the lr (learning rate) from 0.1 to 0.01 might solve the issue. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
import torch
from torch import nn
from torch.utils.data import DataLoader,Dataset
import torchvision
from torchvision.transforms import ToTensor
from torchvision import datasets,models
train_data = datasets.FashionMNIST(root = 'data',train = True,transform=ToTensor(),download=True)
test_data = datasets.FashionMNIST(root = 'data',train = False,transform=ToTensor(),download=True)
train_batches = DataLoader(dataset=train_data,batch_size=64,shuffle=True)
test_batches = DataLoader(dataset=test_data,batch_size=64)
class ClassificationModel(nn.Module):
torch.manual_seed(42)
model = ClassificationModel()
lossfn = nn.CrossEntropyLoss()
optimizer = torch.optim.Adam(params=model.parameters(),lr = 0.1)
epochs = 3
for epoch in range(epochs):
THE TRAIN LOSS IS AROUND 2.3, FOR ALL THE EPOCHS.
PLEASE HELP!!
Beta Was this translation helpful? Give feedback.
All reactions