Skip to content

Mnist update #469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 13, 2018
Merged

Mnist update #469

merged 5 commits into from
Dec 13, 2018

Conversation

surgan12
Copy link
Contributor

Changing the architecture of the Mnist , simplifying it and increasing the accuracy.
Also added the functionalty of saving the model as an argument.

mnist/main.py Outdated
x = self.fc2(x)
return F.log_softmax(x, dim=1)


def name(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function should be removed

mnist/main.py Outdated
if (args.save_model):
PATH="mnist_cnn.pt"
torch.save(model.state_dict(), PATH)
print("model saved as mnist_cnn.pt in the current working directory\n")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

print is unnecessary

mnist/main.py Outdated
train(args, model, device, train_loader, optimizer, epoch)
test(args, model, device, test_loader)

if (args.save_model):
PATH="mnist_cnn.pt"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

additional PATH is unncessary, do torch.save(model.state_dict(), "mnist_cnn.pt")

mnist/main.py Outdated
@@ -100,10 +107,14 @@ def main():
model = Net().to(device)
optimizer = optim.SGD(model.parameters(), lr=args.lr, momentum=args.momentum)

for epoch in range(1, args.epochs + 1):
for epoch in range(1, args.epochs+1):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

args.epochs + 1 is cleaner. Revert this change

@surgan12
Copy link
Contributor Author

@soumith i have made the changes as asked by you.
Kindly look into it .
Thanks

@soumith soumith merged commit d8dd8ca into pytorch:master Dec 13, 2018
@soumith
Copy link
Member

soumith commented Dec 13, 2018

thank you @surgan12 !

@surgan12
Copy link
Contributor Author

@soumith my pleasure always !

@surgan12 surgan12 deleted the mnist_update branch December 13, 2018 06:07
YinZhengxun pushed a commit to YinZhengxun/mt-exercise-02 that referenced this pull request Mar 30, 2025
* mnist added dcgan

* mnist added

* mnist improved

* Update main.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants