This is code of book "Learn Deep Learning with PyTorch"

Overview

深度学习入门之PyTorch

Learn Deep Learning with PyTorch

非常感谢您能够购买此书,这个github repository包含有深度学习入门之PyTorch的实例代码。由于本人水平有限,在写此书的时候参考了一些网上的资料,在这里对他们表示敬意。由于深度学习的技术在飞速的发展,同时PyTorch也在不断更新,且本人在完成此书的时候也有诸多领域没有涉及,所以这个repository会不断更新作为购买次书的一个后续服务,希望我能够在您深度学习的入门道路上提供绵薄之力。

注意:由于PyTorch版本更迭,书中的代码可能会出现bug,所以一切代码以该github中的为主。

image.png

配置环境

书中已经详细给出了如何基于Anaconda配置python环境,以及PyTorch的安装,如果你使用自己的电脑,并且有Nvidia的显卡,那么你可以愉快地进入深度学习的世界了,如果你没有Nvidia的显卡,那么我们需要一个云计算的平台来帮助我们学习深度学习之旅。如何配置aws计算平台

以下的课程目录和书中目录有出入,因为内容正在更新到第二版,第二版即将上线!!

课程目录

part1: 深度学习基础

part2: 深度学习的应用

一些别的资源

关于深度学习的一些公开课程以及学习资源,可以参考我的这个repository

可以关注我的知乎专栏博客,会经常分享一些深度学习的文章

关于PyTorch的资源

我的github repo pytorch-beginner

pytorch-tutorial

the-incredible-pytorch

practical-pytorch

PyTorchZeroToAll

Awesome-pytorch-list

Acknowledgement

本书的第二版内容其中一些部分参考了 mxnet gluon 的中文教程,通过MXNet/Gluon来动手学习深度学习

Gluon 是一个和 PyTorch 非常相似的框架,非常简单、易上手,推荐大家去学习一下,也安利一下 gluon 的中文课程,全中文授课,有视频,有代码练习,可以说是最全面的中文深度学习教程。

Comments
  • proper acknowledgement

    proper acknowledgement

    It's great to see a new chinese hands-on book for DL. But I noticed several tutorials are very similar https://github.com/mli/gluon-tutorials-zh. It is often recommended to acknowledge the original author. For example, people often put the following sentence at the beginning or end of the tutorial:

    This tutorial is motivated (or adapted) from xxx

    opened by mli 3
  • loss function in

    loss function in "logistic-regression.ipynb "

    计算loss的函数:

    def binary_loss(y_pred, y):
        logits = (y * y_pred.clamp(1e-12).log() + (1 - y) * (1 - y_pred).clamp(1e-12).log()).mean()
        return -logits
    

    前半部分是不是应该使用平均值?即

    logits = (y * y_pred.clamp(1e-12).log().mean() + (1 - y) * (1 - y_pred).clamp(1e-12).log()).mean()
    
    opened by wanpiqiu123 2
  • fcn模型结构

    fcn模型结构

    你好, 我在看您博客上介绍fcn的那篇文章,有个地方不太懂,特来讨教: 最简单的 fcn 前面是一个去掉全连接层的预训练网络,然后将去掉的全连接变为 1x1 的卷积,输出和类别数目相同的通道数,比如 voc 数据集是 21 分类,那么输出的通道数就是 21,然后最后接一个转置卷积将结果变成输入的形状大小,最后在每个 pixel 上做一个分类问题,使用交叉熵作为损失函数就可以了。

    通道数为什么也得是21,这个地方不太懂。。

    opened by kingofoz 2
  • 你好,我用你的代码时,报错了,如何解决啊?

    你好,我用你的代码时,报错了,如何解决啊?

    fcn语义分割的代码。 python main.py train Traceback (most recent call last): File "main.py", line 21, in from data import VocSegDataset, img_transforms, COLORMAP

    ImportError: cannot import name 'VocSegDataset'

    opened by codes-kzhan 1
  • problem in autograd

    problem in autograd

    Anser of the exercise is wrong, the second column of j is wrong due to wrong variable name reference in the code: "m.grad.data.zero_() # 归零之前求得的梯度", change "m" to "x" to fix it.

    opened by rexjoe 1
  • fix one plot problem in nn-sequential-model

    fix one plot problem in nn-sequential-model

    under MacOS X 10.13, conda, python 3.6 Matplotlib 2.1.2

    1. in plot_decision_boundary: change "plt.scatter(x[:, 0], x[:, 1], c=y, cmap=plt.cm.Spectral)" to "plt.scatter(x[:, 0], x[:, 1], c=y.reshape(-1), cmap=plt.cm.Spectral)"
    2. change "plt.scatter(x[:, 0], x[:, 1], c=y, s=40, cmap=plt.cm.Spectral)" to "plt.scatter(x[:, 0], x[:, 1], c=y.reshape(-1), s=40, cmap=plt.cm.Spectral)"
    opened by rexjoe 1
  • 权重衰减可以通过 torch.optim.lr_scheduler 的相关类完成,从而使权重衰减和训练逻辑分离

    权重衰减可以通过 torch.optim.lr_scheduler 的相关类完成,从而使权重衰减和训练逻辑分离

    @L1aoXingyu

    作者你好,非常感谢您的分享。这里我提出一点小小的意见。

    权重衰减可以通过 torch.optim.lr_scheduler 的相关类如 ExponentialLR完成,从而使权重衰减和训练逻辑分离。作权重衰减相关介绍的时候可以这么来介绍(实际使用也是这么使用比较广泛)。

    https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate

    opened by xiaoyuan0203 0
  • 关于cat vs dog中的维度问题

    关于cat vs dog中的维度问题

    net.py文件中的这段: vgg = models.vgg19(pretrained=True) self.feature = nn.Sequential(*list(vgg.children())[:-1]) self.feature.add_module('global average', nn.AvgPool2d(9))

    前两行代码的输出尺寸是7*7,而第三行平均池化的卷积核是9,运行后会出现这样的错误:Given input size: (512x7x7). Calculated output size: (512x0x0). Output size is too small

    我的pytorch版本是1.6,是不是版本的问题?但按理说,Pytorch版本的迭代不会影响VGG这种经典网络的参数啊。这到底是怎么回事呢?

    opened by IIIgnac 0
  • 第三章逻辑斯蒂回归的代码问题

    第三章逻辑斯蒂回归的代码问题

    画出参数更新之前的结果

    w0 = w[0].data[0] w1 = w[1].data[0] b0 = b.data[0]

    plot_x = np.arange(0.2, 1, 0.01) plot_y = (-w0 * plot_x - b0) / w1 # 上面会导致乘法不能正常操作, 应该讲w0,w1,w2转换成numpy array 才能调通

    opened by mengwei-wang 0
  • Chapter_3_logisticRegression_'plot_y = (-w0 * plot_x - b0) / w1'

    Chapter_3_logisticRegression_'plot_y = (-w0 * plot_x - b0) / w1'

    In[10]:# 画出参数更新之前的结果 w0 = w[0].data[0] w1 = w[1].data[0] b0 = b.data[0]

    plot_x = np.arange(0.2, 1, 0.01) plot_y = (-w0 * plot_x - b0) / w1 TypeError TypeError: mul() received an invalid combination of arguments - got (numpy.ndarray), but expected one of:

    • (Tensor other) didn't match because some of the arguments have invalid types: (numpy.ndarray)
    • (Number other) didn't match because some of the arguments have invalid types: (numpy.ndarray)
    opened by cuijia1247 0
Owner
Xingyu Liao
Research Engineer
Xingyu Liao
Jupyter notebooks for the code samples of the book "Deep Learning with Python"

Jupyter notebooks for the code samples of the book "Deep Learning with Python"

François Chollet 16.2k Dec 30, 2022
Experimental solutions to selected exercises from the book [Advances in Financial Machine Learning by Marcos Lopez De Prado]

Advances in Financial Machine Learning Exercises Experimental solutions to selected exercises from the book Advances in Financial Machine Learning by

Brian 1.4k Jan 4, 2023
Repository for scripts and notebooks from the book: Programming PyTorch for Deep Learning

Repository for scripts and notebooks from the book: Programming PyTorch for Deep Learning

Ian Pointer 368 Dec 17, 2022
Official repository of my book: "Deep Learning with PyTorch Step-by-Step: A Beginner's Guide"

This is the official repository of my book "Deep Learning with PyTorch Step-by-Step". Here you will find one Jupyter notebook for every chapter in the book.

Daniel Voigt Godoy 340 Jan 1, 2023
Free Book about Deep-Learning approaches for Chess (like AlphaZero, Leela Chess Zero and Stockfish NNUE)

Free Book about Deep-Learning approaches for Chess (like AlphaZero, Leela Chess Zero and Stockfish NNUE)

Dominik Klein 189 Dec 21, 2022
MATLAB codes of the book "Digital Image Processing Fourth Edition" converted to Python

Digital Image Processing Python MATLAB codes of the book "Digital Image Processing Fourth Edition" converted to Python TO-DO: Refactor scripts, curren

Merve Noyan 24 Oct 16, 2022
Python Algorithm Interview Book Review

파이썬 알고리즘 인터뷰 책 리뷰 리뷰 IT 대기업에 들어가고 싶은 목표가 있다. 내가 꿈꿔온 회사에서 일하는 사람들의 모습을 보면 멋있다고 생각이 들고 나의 목표에 대한 열망이 강해지는 것 같다. 미래의 핵심 사업 중 하나인 SW 부분을 이끌고 발전시키는 우리나라의 I

SharkBSJ 1 Dec 14, 2021
This is the official source code for SLATE. We provide the code for the model, the training code, and a dataset loader for the 3D Shapes dataset. This code is implemented in Pytorch.

SLATE This is the official source code for SLATE. We provide the code for the model, the training code and a dataset loader for the 3D Shapes dataset.

Gautam Singh 66 Dec 26, 2022
TensorFlow code for the neural network presented in the paper: "Structural Language Models of Code" (ICML'2020)

SLM: Structural Language Models of Code This is an official implementation of the model described in: "Structural Language Models of Code" [PDF] To ap

null 73 Nov 6, 2022
Inference code for "StylePeople: A Generative Model of Fullbody Human Avatars" paper. This code is for the part of the paper describing video-based avatars.

NeuralTextures This is repository with inference code for paper "StylePeople: A Generative Model of Fullbody Human Avatars" (CVPR21). This code is for

Visual Understanding Lab @ Samsung AI Center Moscow 18 Oct 6, 2022
A code generator from ONNX to PyTorch code

onnx-pytorch Generating pytorch code from ONNX. Currently support onnx==1.9.0 and torch==1.8.1. Installation From PyPI pip install onnx-pytorch From

Wenhao Hu 94 Jan 6, 2023
This is the code for our KILT leaderboard submission to the T-REx and zsRE tasks. It includes code for training a DPR model then continuing training with RAG.

KGI (Knowledge Graph Induction) for slot filling This is the code for our KILT leaderboard submission to the T-REx and zsRE tasks. It includes code fo

International Business Machines 72 Jan 6, 2023
Convert Python 3 code to CUDA code.

Py2CUDA Convert python code to CUDA. Usage To convert a python file say named py_file.py to CUDA, run python generate_cuda.py --file py_file.py --arch

Yuval Rosen 3 Jul 14, 2021
Empirical Study of Transformers for Source Code & A Simple Approach for Handling Out-of-Vocabulary Identifiers in Deep Learning for Source Code

Transformers for variable misuse, function naming and code completion tasks The official PyTorch implementation of: Empirical Study of Transformers fo

Bayesian Methods Research Group 56 Nov 15, 2022
Reference implementation of code generation projects from Facebook AI Research. General toolkit to apply machine learning to code, from dataset creation to model training and evaluation. Comes with pretrained models.

This repository is a toolkit to do machine learning for programming languages. It implements tokenization, dataset preprocessing, model training and m

Facebook Research 408 Jan 1, 2023
Code for the prototype tool in our paper "CoProtector: Protect Open-Source Code against Unauthorized Training Usage with Data Poisoning".

CoProtector Code for the prototype tool in our paper "CoProtector: Protect Open-Source Code against Unauthorized Training Usage with Data Poisoning".

Zhensu Sun 1 Oct 26, 2021
Low-code/No-code approach for deep learning inference on devices

EzEdgeAI A concept project that uses a low-code/no-code approach to implement deep learning inference on devices. It provides a componentized framewor

On-Device AI Co., Ltd. 7 Apr 5, 2022
Code for all the Advent of Code'21 challenges mostly written in python

Advent of Code 21 Code for all the Advent of Code'21 challenges mostly written in python. They are not necessarily the best or fastest solutions but j

null 4 May 26, 2022
Code to use Augmented Shapiro Wilks Stopping, as well as code for the paper "Statistically Signifigant Stopping of Neural Network Training"

This codebase is being actively maintained, please create and issue if you have issues using it Basics All data files are included under losses and ea

J K Terry 32 Nov 9, 2021