GithubHelp home page GithubHelp logo

era_s5_assignment's Introduction

ERA - Session 5 Assignment

We are building a simple classifier model for the MNIST dataset. Our project comprises mainly of three files, which are -

1. S5.ipynb

This is the main notebook file of our project in which we train our classifier model and test its accuracy

2. model.py

This file contains the model definition - the layers involved along with the forward function

usage

paste the below code in the S5 notebook to use the model

from model import Net
import torch
cuda = torch.cuda.is_available()
device = torch.device("cuda" if cuda else "cpu")
model = Net().to(device)

3. utils.py

This file contains the functions we use for getting the data loaders. We can also define the train and test functions (for 1 epoch) used for generic model training and evaluation

usage

paste the below code in the S5 notebook to import and use the functions required for training, testing and getting data loaders

from utils import loaders, train, test
batch_size = 512
kwargs = {'batch_size': batch_size, 'shuffle': True, 'num_workers': 2, 'pin_memory': True}
train_loader, test_loader = loaders(batch_size, kwargs)

after initialising model, device, optimizer and criterion in the S5 notebook, run the following -

train_accuracy, train_loss = train(model, device, train_loader, optimizer, criterion)
test_accuracy, test_loss = test(model, device, test_loader, criterion)

era_s5_assignment's People

Contributors

shashank411 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.