Coder Social home page Coder Social logo

dl_pytorch's Introduction

Deep Learning with PyTorch

This repo contains notebooks and related code for Udacity's Deep Learning with PyTorch lesson. This lesson appears in our AI Programming with Python Nanodegree program.

  • Part 1: Introduction to PyTorch and using tensors
  • Part 2: Building fully-connected neural networks with PyTorch
  • Part 3: How to train a fully-connected network with backpropagation on MNIST
  • Part 4: Exercise - train a neural network on Fashion-MNIST
  • Part 5: Using a trained network for making predictions and validating networks
  • Part 6: How to save and load trained models
  • Part 7: Load image data with torchvision, also data augmentation
  • Part 8: Use transfer learning to train a state-of-the-art image classifier for dogs and cats

Archival Note

This repository is deprecated; therefore, we are going to archive it. However, learners will be able to fork it to their personal Github account but cannot submit PRs to this repository. If you have any issues or suggestions to make, feel free to:

dl_pytorch's People

Contributors

mcleonard avatar sudkul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dl_pytorch's Issues

Incorrect solution for Part 1 - Tensors in PyTorch(Solutions).ipynb (v2)

The notebook states that the answer is:

h = activation(torch.mm(features, W1)) + B1
output = activation(torch.mm(h, W2)) + B2

The output evaluates to tensor([[ 0.4813]]) which is also mentioned as the correct solution in the markdown in the below cell.

The correct answer, however, should be:

h = activation(torch.mm(features, W1) + B1)
output = activation(torch.mm(h1, W2) + B2)

which evaluates to tensor([[0.3171]]).

The video solution shows the correct code as the latter, but the cell is never run in the video segment. The expected answer as seen in the notebook from the video is tensor([[ 0.4813]]).

Typo should be fixed in Part 6

Under the subheading "Saving and loading networks" there is a sentence:

The simplest thing to do is simply save the state **** with torch.save. For example, we can save it to a file 'checkpoint.pth'.

I'm going to out on a limb and say you wanted to type "dict" with a T not a K.

Parts 2-6: Fix for PyTorch 1.1

Current code in Parts 2-6 causes an error in PyTorch 1.1.

transform = transforms.Compose([transforms.ToTensor(),
transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)),
])
RuntimeError: output with shape [1, 28, 28] doesn't match the broadcast shape [3, 28, 28]

I made the following change and it worked for PyTorch 0.4 and 1.1:

transform = transforms.Compose([transforms.ToTensor(),
transforms.Normalize([0.5], [0.5])])

confusing explanation

"I'll build a network with `nn.Sequential` here. Only difference from the last part is I'm not actually using softmax on the output, but instead just using the raw output from the last layer. This is because the output from softmax is a probability distribution. Often, the output will have values really close to zero or really close to one. Due to [inaccuracies with representing numbers as floating points](https://docs.python.org/3/tutorial/floatingpoint.html), computations with a softmax output can lose accuracy and become unstable. To get around this, we'll use the raw output, called the **logits**, to calculate the loss."

"Often, the output will have values really close to zero or really close to one. Due to inaccuracies with representing numbers as floating points, computations with a softmax output can lose accuracy and become unstable. To get around this, we'll use the raw output, called the logits, to calculate the loss."

The description for the nn.CrossEntropyLoss() say: "This criterion combines :func:nn.LogSoftmax and :func:nn.NLLLoss in one single class.".

I'm a bit confused about this explanation, since the nn.CrossEntropyLoss() criterion contains a nn.LogSoftmax function.

fix typo in part 7

"dataset = datasets.ImageFolder('path/to/data', transform=transforms)\n",

"transforms = transforms.Compose([transforms.Resize(255),\n",

"transforms = # TODO: compose transforms here\n",

By naming the transform; transforms, we are overwriting the imported library; transforms.

"from torchvision import datasets, transforms\n",

I'm not sure if this was an intentional error left in as part of the lesson

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.