Fireship · @fireship

PyTorch in 100 Seconds

Uploaded March 20, 2023 · Length 2:43

PyTorch in 100 Seconds

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.

  1. 0:00

    pie torch an open source deep learning

  2. 0:02

    framework used to build some of the

  3. 0:04

    world's most famous artificial

  4. 0:05

    intelligence products it was created at

  5. 0:07

    The Meta AI research lab in 2016 but is

  6. 0:10

    actually derived from the Lua based

  7. 0:12

    torch library that dates back to 2002.

  8. 0:14

    fundamentally it's a library for

  9. 0:16

    programming with tensors which are

  10. 0:18

    basically just multi-dimensional arrays

  11. 0:19

    that represent data and parameters in

  12. 0:22

    deep neural networks sounds complicated

  13. 0:23

    but its focused on usability will have

  14. 0:25

    you training machine learning models

  15. 0:27

    with just a few lines of python in

  16. 0:28

    addition it facilitates high performance

  17. 0:30

    parallel Computing on a GPU thanks to

  18. 0:33

    nvidia's Cuda platform developers love

  19. 0:35

    prototyping with it because it supports

  20. 0:37

    a dynamic computational graph allowing

  21. 0:39

    models to be optimized at runtime it

  22. 0:41

    does this by constructing a directed

  23. 0:43

    acyclic graph consisting of functions

  24. 0:45

    that keeps track of all the executed

  25. 0:47

    operations on the tensors allowing you

  26. 0:49

    to change the shape size and operations

  27. 0:50

    after every iteration if needed pytorch

  28. 0:53

    has been used to train models for

  29. 0:54

    computer vision AI like Tesla autopilot

  30. 0:57

    image generators like stable diffusion

  31. 0:59

    and speech recognition models like open

  32. 1:01

    AI whisper just to name a few to get

  33. 1:03

    started install Pi torque and optionally

  34. 1:05

    Cuda if you want to accelerate Computing

  35. 1:07

    on your GPU now import it into a python

  36. 1:09

    file or notebook like I mentioned a

  37. 1:11

    tensor is similar to a multi-dimensional

  38. 1:13

    array create a 2d array or Matrix with

  39. 1:15

    python then use torch to convert it into

  40. 1:17

    a tensor now we can run all kinds of

  41. 1:19

    computations on it like we might convert

  42. 1:21

    all these integers into random floating

  43. 1:23

    points we can also perform linear

  44. 1:25

    algebra by taking multiple tensors and

  45. 1:27

    multiplying them together what you came

  46. 1:29

    here to do though is build a deep neural

  47. 1:31

    network like an image classifier to

  48. 1:33

    handle that we can define a new class

  49. 1:35

    that inherits from the neural network

  50. 1:37

    module class inside the Constructor we

  51. 1:39

    can build it out layer by layer the

  52. 1:41

    flattened layer will take a

  53. 1:42

    multi-dimensional input like an image

  54. 1:44

    and convert it to one dimension from

  55. 1:46

    there sequential is used to create a

  56. 1:48

    container of layers that the data will

  57. 1:49

    flow through each layer has multiple

  58. 1:51

    nodes where each node is like its own

  59. 1:53

    mini statistical model as each data

  60. 1:55

    point flows through it it'll try to

  61. 1:56

    guess the output and gradually update a

  62. 1:58

    mapping of weights to determine in the