Fireship · @fireship
PyTorch in 100 Seconds
Uploaded March 20, 2023 · Length 2:43
Summary
PyTorch explained in 100 seconds, a deep learning framework for building AI models.
- pytorch
- deep learning
- artificial intelligence
- machine learning
- gpu computing
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
pie torch an open source deep learning
- 0:02
framework used to build some of the
- 0:04
world's most famous artificial
- 0:05
intelligence products it was created at
- 0:07
The Meta AI research lab in 2016 but is
- 0:10
actually derived from the Lua based
- 0:12
torch library that dates back to 2002.
- 0:14
fundamentally it's a library for
- 0:16
programming with tensors which are
- 0:18
basically just multi-dimensional arrays
- 0:19
that represent data and parameters in
- 0:22
deep neural networks sounds complicated
- 0:23
but its focused on usability will have
- 0:25
you training machine learning models
- 0:27
with just a few lines of python in
- 0:28
addition it facilitates high performance
- 0:30
parallel Computing on a GPU thanks to
- 0:33
nvidia's Cuda platform developers love
- 0:35
prototyping with it because it supports
- 0:37
a dynamic computational graph allowing
- 0:39
models to be optimized at runtime it
- 0:41
does this by constructing a directed
- 0:43
acyclic graph consisting of functions
- 0:45
that keeps track of all the executed
- 0:47
operations on the tensors allowing you
- 0:49
to change the shape size and operations
- 0:50
after every iteration if needed pytorch
- 0:53
has been used to train models for
- 0:54
computer vision AI like Tesla autopilot
- 0:57
image generators like stable diffusion
- 0:59
and speech recognition models like open
- 1:01
AI whisper just to name a few to get
- 1:03
started install Pi torque and optionally
- 1:05
Cuda if you want to accelerate Computing
- 1:07
on your GPU now import it into a python
- 1:09
file or notebook like I mentioned a
- 1:11
tensor is similar to a multi-dimensional
- 1:13
array create a 2d array or Matrix with
- 1:15
python then use torch to convert it into
- 1:17
a tensor now we can run all kinds of
- 1:19
computations on it like we might convert
- 1:21
all these integers into random floating
- 1:23
points we can also perform linear
- 1:25
algebra by taking multiple tensors and
- 1:27
multiplying them together what you came
- 1:29
here to do though is build a deep neural
- 1:31
network like an image classifier to
- 1:33
handle that we can define a new class
- 1:35
that inherits from the neural network
- 1:37
module class inside the Constructor we
- 1:39
can build it out layer by layer the
- 1:41
flattened layer will take a
- 1:42
multi-dimensional input like an image
- 1:44
and convert it to one dimension from
- 1:46
there sequential is used to create a
- 1:48
container of layers that the data will
- 1:49
flow through each layer has multiple
- 1:51
nodes where each node is like its own
- 1:53
mini statistical model as each data
- 1:55
point flows through it it'll try to
- 1:56
guess the output and gradually update a
- 1:58
mapping of weights to determine in the


