
In this tutorial I'm going to be explaining the very basic concept of deep learning and going to implement neural networks by pytorch using Google’s Colab. We'll cope with FCNN, CNN, RNN, and BERT in the end.
We'll change runtime type to GPU in Colab. We check if pytorch tensor on is available on CUDA.
I'm going to explain what is "Deep" in Deep Learning using schematic figure of a part of brain.
I'm going to explain the basic concept of Perceptron and how to implement it in Pytorch. We'll implement "feed forward" perceptron to be able to judge if a person is fat or not fat by height and weight using that perceptron.
From lecture 5 to 9, we make our perceptron trainable, which means that our network will be able to learn from the data itself by the following step:
1) normalize data
2) change activation function
3) use loss function
4) use gradient descent method.
We will make good use of pytorch.nn module more, which is very convenient and usefule when dealing with more complicated networks.
I know It's a bit confusing technique, but I did it in order to get the one-hot encoded expression by one-line of code.
For instance, suppose if we want to get the one-hot encoded expression of [0,1,2,3,2,1], we first define torch.eye(4) to get the identity matrix of size 4 which can be expressed as follows.
tensor([[1., 0., 0., 0.],
[0., 1., 0., 0.],
[0., 0., 1., 0.],
[0., 0., 0., 1.]])
Then if we give a list [0,1,2,3,2,1] so as to designate the indices of the identity matrix, you'll get the one hot encoded expression as a consequence.
Please also see the code below.
import torch
x = torch.eye(4)
print(x[[0,1,2,3,2,1]])
You could also use torch.nn.functional.one_hot to get the same result actually :)
torch.nn.functional.one_hot(torch.tensor([0,1,2,3,2,1]))
If you have any question, please feel free to ask me.
The range of the screen is not fitted in Lecture 33 and sometimes the code I was explaining was out of the screen. In Lecture 38, you can download the BERT_TransferLearning.ipynb which includes the missing part, so you can follow the code by looking at the ipynb code before I video shoot again. Sorry for the inconvenience.
I've added huggingface's tutorial on English abstract summarization using Google T5 to the Practice section! Why don't you try summarizing with T5 this weekend?
Pytorch&Hugginface Deep Learning Course(Colab Hands-On)
Welcome to Pytorch Deep Learning From Zero To Hero Series.
If you have already mastered the basic syntax of python and don't know what to do next, this course will be a rocket booster to skyrocket your programming skill to a business applicable level.
In this course, you will be able to master implementing deep neural network from the very beginning(simple perceptron) to BERT transfer learning/Google's T5 by using pytorch and huggingface yourself by colab. Each Section will have one assignment for you to think and code yourself.
The Agenda is below.
Agenda:
Introduction
Google Colaboratory
Neuron
Perceptron
Make Your Perceptron Trainable
Normalize Data
Activation Function
Loss Function
Gradient Descent
Elegant Pytorch Gradient Descent
Final Project
Final Project Explained
Multi Layer Perceptron(MLP)
One Hot Encoding
Prepare data for MLP
Define MLP
Train & Evaluate MLP
Final Project for MLP
FCNN Explained
FCNN LOVE Letters Classification using MLP
Final Project For FCNN
CNN Explained
CNN Prepare data(Fashion MNIST)
CNN Define Model
CNN Train&Evaluate Model
CNNInference
Final Project For CNN
RNN Explained
RNN Prepare data
RNN Define Model
RNN Train Model
RNN Inference
BERT Sesame Street
BERT Prepare Data IMDB
BERT Model definition
BERT Model Training
BERT Model Evaluation
BERT Model Prediction
BERT Final Project
T5 Prepare Data
T5 Model definition
T5 Model Training
T5 Model Evaluation
T5 Model Prediction
T5 Final Project
Let's start our journey together.
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren’t special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one– and preferably only one –obvious way to do it.
Although that way may not be obvious at first unless you’re Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it’s a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea — let’s do more of those!