Giter Club home page Giter Club logo

handsondeeplearningwithpytorch's Introduction

HandsOnDeepLearningWithPytorch

Repository is arranged chapter wise and each folder includes the code used + the visualization of models use. Dataset used for the models are either available in the shared box folder or downloadable from the torch utility packages such as torchvision, torchtext or torchaudio

Chapters

  1. Introduction
  2. A Simple Neural Network
  3. Deep Learning work flow
  4. Computer Vision
  5. Sequential Data Processing
  6. Generative Networks
  7. Reinforcement Learning
  8. PyTorch In Production

Utilities

  • Visualization is handled by Netron -

    pip install netron
    
  • Environment is handled by Pipenv

Usage

  • Clone the repository

    git clone https://github.com/hhsecond/HandsOnDeepLearningWithPytorch.git && cd HandsOnDeepLearningWithPytorch
    
  • Install dependancies. HandsOnDeepLearningWithPytorch is using conda with python3.7

    conda env create -f environment.yml
    
  • CD to chapter directores and execute the models

handsondeeplearningwithpytorch's People

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

handsondeeplearningwithpytorch's Issues

Code in section 2 does not work

in numpy_like_fizbuz.py:

Issue seems to be that you set dtype conditional on whether or not cuda is available. however, if cuda is available dtype is set to torch.cuda.FloatTensor
and the line:
w1 = torch.randn(input_size, hidden_size, requires_grad=True).type(dtype)
causes w1 to forget it is a user created variable and it loses the "requires_grad=True" attribute:

Here is an illustration. I am running pytorch 1.0 and python 3.6 (on a device with an attached gpu)

dtype
<class 'torch.cuda.FloatTensor'>
y = torch.zeros(1, 2, requires_grad=True).type(dtype)
y
tensor([[0., 0.]], device='cuda:0', grad_fn=)
y.requires_grad = True
Traceback (most recent call last):
File "", line 1, in
RuntimeError: you can only change requires_grad flags of leaf variables.
y = torch.zeros(1, 2).type(dtype)
y
tensor([[0., 0.]], device='cuda:0')
y.requires_grad = True
y
tensor([[0., 0.]], device='cuda:0', requires_grad=True)

Environment yml - ResolvePackageNotFound error

Trying to install the environment I get a number of packages reported under ResolvePackageNotFound. I am on WIndows 10 and my current conda version is 4.7.5. My reading about this suggests that this could be resolved by removing version information from the specifications - many of these packages already exist on my PC, including Pytorch 1.1.0.

Additional points:
Could these be resolved by specifying >= rather than ==?
Do we really need Python 3.7 or could this work with >= 3.6?
Since I have a GPU and a later version of Pytorch, is it correct to be specifying pytorch-cpu=1.0.1?

(base) >conda env create -f environment.yml
Collecting package metadata (repodata.json): done
Solving environment: failed

ResolvePackageNotFound:
  - pycosat==0.6.3=py37h14c3975_0
  - tk==8.6.8=hbc83047_0
  - ninja==1.8.2=py37h6bb024c_1
  - mkl_random==1.0.2=py37hd81dba3_0
  - libedit==3.1.20170329=h6b74fdf_2
  - openssl==1.1.1b=h7b6447c_1
  - xz==5.2.4=h14c3975_4
  - python==3.7.1=h0371630_7
  - cryptography==2.4.2=py37h1ba5d50_0
  - zstd==1.3.7=h0b5b093_0
  - libgcc-ng==8.2.0=hdf63c60_1
  - freetype==2.9.1=h8a8886c_1
  - pillow==5.4.1=py37h34e0f95_0
  - ncurses==6.1=he6710b0_1
  - cffi==1.11.5=py37he75722e_1
  - pytorch-cpu==1.0.1=py3.7_cpu_2
  - libpng==1.6.36=hbc83047_0
  - jpeg==9b=h024ee3a_2
  - libffi==3.2.1=hd88cf55_4
  - numpy==1.16.2=py37h7e9f1db_0
  - zlib==1.2.11=h7b6447c_3
  - readline==7.0=h7b6447c_5
  - libgfortran-ng==7.3.0=hdf63c60_0
  - ruamel_yaml==0.15.46=py37h14c3975_0
  - libtiff==4.0.10=h2733197_2
  - yaml==0.1.7=had09818_2
  - numpy-base==1.16.2=py37hde5b4d6_0
  - libstdcxx-ng==8.2.0=hdf63c60_1
  - mkl_fft==1.0.10=py37ha843d7b_0
  - sqlite==3.26.0=h7b6447c_0

My conda info:

     active environment : base
    active env location : G:\Anaconda3
            shell level : 1
       user config file : C:\Users\User\.condarc
 populated config files : C:\Users\User\.condarc
          conda version : 4.7.5
    conda-build version : 3.18.6
         python version : 3.6.6.final.0
       virtual packages : __cuda=10.1
       base environment : G:\Anaconda3  (writable)
           channel URLs : https://conda.anaconda.org/conda-forge/win-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://conda.anaconda.org/ostrokach-forge/win-64
                          https://conda.anaconda.org/ostrokach-forge/noarch
                          https://conda.anaconda.org/anaconda-fusion/win-64
                          https://conda.anaconda.org/anaconda-fusion/noarch
                          https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : G:\Anaconda3\pkgs
                          C:\Users\User\.conda\pkgs
                          C:\Users\User\AppData\Local\conda\conda\pkgs
       envs directories : G:\Anaconda3\envs
                          C:\Users\User\.conda\envs
                          C:\Users\User\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.7.5 requests/2.22.0 CPython/3.6.6 Windows/10 Windows/10.0.17134
          administrator : False
             netrc file : None
           offline mode : False

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.