-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
904 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Using this Studio" | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"You can find the code covered in the Unit 3 videos in the `./code-units` subfolder. I recommend you first watch the videos and then experiment with the code.\n", | ||
"\n", | ||
"<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/5XL-FdlsRqg?si=-4gbMduPXAvCK7SB\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen></iframe>\n", | ||
"\n", | ||
"<br>\n", | ||
"<br>\n", | ||
"\n", | ||
"<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/MMcOAT3KNgo?si=NXRcoL6oEN_5SWKv\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen></iframe>\n", | ||
"\n", | ||
"<br>\n", | ||
"<br>\n", | ||
"\n", | ||
"<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/tyHhsY5mVt4?si=KunnM2EbxphAN9bs\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen></iframe>\n", | ||
"\n", | ||
"- [The complete YouTube Playlist](https://www.youtube.com/playlist?list=PLaMu-SDt_RB6dG-0C78fmIkMeXL6mzpmm) with all 17 videos in Unit 3\n", | ||
"- [Or access the Unit 3 videos on the Lightning website](https://lightning.ai/courses/deep-learning-fundamentals/3-0-overview-model-training-in-pytorch/), which includes additional quizzes" | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"After exploring the code, you may want to try the following exercises in the `./exercises` subfolder. (Solutions to the excercises can be found in the `./solutions` subfolder)." | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.10" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Deep Learning Fundamentals Unit 3 | ||
|
||
## Model Training in PyTorch | ||
|
||
Unit 3 introduces the concept of single-layer neural networks and a simple classification model: logistic regression. While *Deep Learning Fundamentals* is about deep learning, logistic regression is an excellent model for studying all the fundamental concepts we will use to implement deep neural networks in the upcoming units. | ||
|
||
This Studio provides a reproducible environment with the supplementary code for Unit 3 of the [**Deep Learning Fundamentals**](https://lightning.ai/pages/courses/deep-learning-fundamentals/) class by Sebastian Raschka, which is freely available at Lightning AI. | ||
|
||
|
||
<br> | ||
|
||
**What's included?** | ||
|
||
Click the "Run Template" button at the top of this page to launch into a Studio environment that contains the following materials: | ||
|
||
- `3.6-logreg-in-pytorch`: The code materials used in *3.6 Training a Logistic Regression Model in PyTorch – Parts 1-3* | ||
|
||
|
||
- `exercises/`: | ||
- `1_banknotes`: Exercise 1, applying logistic regression to a banknote authentication dataset | ||
- `2_standardization`: Exercise 2, extending exercise 1 by adding code to standardize the features for better training performance | ||
- `solutions/`: Solutions to the exercises above | ||
|
||
--- | ||
|
||
<br> | ||
|
||
<iframe width="560" height="315" src="https://www.youtube.com/embed/5XL-FdlsRqg?si=5Hmhj_u3Ud9zeKPK" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe> | ||
|
||
- Videos of [Part 2](https://www.youtube.com/watch?v=MMcOAT3KNgo&list=PLaMu-SDt_RB6dG-0C78fmIkMeXL6mzpmm&index=14) and [Part 3](https://www.youtube.com/watch?v=tyHhsY5mVt4&list=PLaMu-SDt_RB6dG-0C78fmIkMeXL6mzpmm&index=15) | ||
- [The complete YouTube Playlist](https://www.youtube.com/playlist?list=PLaMu-SDt_RB6dG-0C78fmIkMeXL6mzpmm) with all 17 videos in Unit 3 | ||
- [Or access the Unit 3 videos on the Lightning website](https://lightning.ai/courses/deep-learning-fundamentals/3-0-overview-model-training-in-pytorch/), which includes additional quizzes | ||
|
||
<br> | ||
|
||
## About Unit 3: Model Training in PyTorch | ||
|
||
Logistic regression, similar to the perceptron, is a model for binary classification. In fact, many of its concepts, such as the sigmoid activation and the logistic loss, are also used in deep neural networks. So, it’s an important model that we will look at closely in Unit 3. | ||
|
||
 | ||
|
||
In this Studio, you'll learn how to implement a logistic regression model using the `torch.nn.Module` class. Then, you'll train this logistic regression model by implementing a training loop based on PyTorch’s automatic differentiation capabilities. | ||
|
||
After completing Unit 3, we covered all the essential tools for implementing deep neural networks in the next unit: activation functions, loss functions, and essential deep learning utilities of the PyTorch API. | ||
|
||
Learn more by watching the videos of Deep Learning Fundamentals linked above and follow along with the code and exercises in this Studio. You can launch it by clicking the "Run Template" button at the top of this page to get started. | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Using this Studio" | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"You can find the code covered in the Unit 4 videos in the `./code-units` subfolder. I recommend you first watch the videos and then experiment with the code.\n", | ||
"\n", | ||
"- [The complete YouTube Playlist](https://www.youtube.com/playlist?list=PLaMu-SDt_RB6KyP_bNaTghy4_Py2X4hq_) with all 21 videos in Unit 4\n", | ||
"- [Or access the Unit 4 videos on the Lightning website](https://lightning.ai/courses/deep-learning-fundamentals/training-multilayer-neural-networks-overview/), which includes additional quizzes" | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"After exploring the code, you may want to try the following exercises in the `./exercises` subfolder. (Solutions to the excercises can be found in the `./solutions` subfolder)." | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.10" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Deep Learning Fundamentals Unit 4 | ||
|
||
## Training Multilayer Neural Networks | ||
|
||
Unit 4 covers training multilayer perceptrons in PyTorch with datasets like MNIST, optimizing data loading using PyTorch's Dataset and DataLoader classes for efficiency, and adapting neural networks for regression tasks by modifying the output layer and loss function. | ||
|
||
This Studio provides a reproducible environment with the supplementary code for Unit 4 of the [**Deep Learning Fundamentals**](https://lightning.ai/pages/courses/deep-learning-fundamentals/) class by Sebastian Raschka, which is freely available at Lightning AI. | ||
|
||
<br> | ||
|
||
**What's included?** | ||
|
||
Click the "Run Template" button at the top of this page to launch into a Studio environment that contains the following materials: | ||
|
||
- `code-units/`: | ||
|
||
- `4.3-mlp-pytorch`: The code materials used in *Training a Multilayer Perceptron in PyTorch – Parts 1-5* | ||
|
||
- `4.4-dataloaders`: The code materials used in *Defining Efficient Data Loaders – Parts 1-4* | ||
|
||
- `4.5-mlp-regression`: The code materials used in *Multilayer Neural Networks for Regression – Parts 1 & 2* | ||
|
||
|
||
- `exercises/`: | ||
- `ex1_changing-layers`: Exercise 1, changing a multilayer percepron architecture to achieve the same (or better) performance with fewer parameters | ||
- `ex2_fashion-mnist`: Exercise 2, implementing a custom Dataset class for Fashion MNIST | ||
- `solutions/`: Solutions to the exercises above | ||
|
||
--- | ||
|
||
<br> | ||
|
||
<iframe width="560" height="315" src="https://www.youtube.com/embed/XNi5TPSxmZA?si=6Mv0h-svvRk3rfzg" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe> | ||
|
||
- Videos of [Part 2](https://www.youtube.com/watch?v=3LzPXjobVdM&list=PLaMu-SDt_RB6KyP_bNaTghy4_Py2X4hq_&index=11), [Part 3](https://www.youtube.com/watch?v=1LGkjcAtt8E&list=PLaMu-SDt_RB6KyP_bNaTghy4_Py2X4hq_&index=12), [Part 4](https://www.youtube.com/watch?v=OzQ6jo54rtM&list=PLaMu-SDt_RB6KyP_bNaTghy4_Py2X4hq_&index=13), and [Part 5](https://www.youtube.com/watch?v=jrPTiNgHj5s&list=PLaMu-SDt_RB6KyP_bNaTghy4_Py2X4hq_&index=14) | ||
- [The complete YouTube Playlist](https://www.youtube.com/watch?v=vrAQPyHKFas&list=PLaMu-SDt_RB6KyP_bNaTghy4_Py2X4hq_) with all 21 videos in Unit 4 | ||
- [Or access the Unit 4 videos on the Lightning website](https://lightning.ai/courses/deep-learning-fundamentals/), which includes additional quizzes | ||
|
||
<br> | ||
|
||
## About Unit 4: Training Multilayer Neural Networks | ||
|
||
We begin with Unit 4.3, training a multilayer perceptron model using PyTorch, starting with the XOR dataset as a warm-up before advancing to the more complex MNIST handwritten digit classification dataset. This part focuses on reshaping the 28×28 images into vectors for the model and achieving high prediction accuracy, demonstrating the basic application of multilayer perceptrons for classification tasks. | ||
|
||
 | ||
|
||
As the complexity of neural networks and datasets increases, optimizing the data-loading pipeline becomes crucial. We address this in Unit 4.4 by discussing PyTorch's Dataset and DataLoader classes, which are designed to efficiently fetch training batches in the background using multiple processes. This ensures computational efficiency by preparing the next batch of data while the model is completing its current processing, thereby preventing bottlenecks. | ||
|
||
 | ||
|
||
Moving beyond classification, Unit 4.5 explores how deep neural networks, specifically multilayer perceptrons, can be adapted for regression tasks. This is achieved with two key adjustments: removing the logistic sigmoid or softmax activation function from the output layer, and replacing the cross entropy loss with the mean squared error loss. This part highlights the versatility of neural networks in handling various types of predictive modeling tasks beyond the commonly used classification frameworks. | ||
|
||
 | ||
|
||
Learn more by watching the videos of Deep Learning Fundamentals linked above and follow along with the code and exercises in this Studio. You can launch it by clicking the "Run Template" button at the top of this page to get started. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Using this Studio" | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"You can find the code covered in the Unit 5 videos in the `./code-units` subfolder. I recommend you first watch the videos and then experiment with the code.\n", | ||
"\n", | ||
"- [The complete YouTube Playlist](https://www.youtube.com/watch?v=x4UvpMsyG8M&list=PLaMu-SDt_RB7QZz-kTjdE_IkNDG0ZcHr-) with all 19 videos in Unit 5\n", | ||
"- [Or access the Unit 5 videos on the Lightning website](https://lightning.ai/courses/deep-learning-fundamentals/), which includes additional quizzes" | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"After exploring the code, you may want to try the following exercises in the `./exercises` subfolder. (Solutions to the excercises can be found in the `./solutions` subfolder)." | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.10" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Deep Learning Fundamentals Unit 5 | ||
|
||
## Organizing your Code with PyTorch Lightning | ||
|
||
In Unit 5, we introduce the PyTorch Lightning Trainer, which helps us organize our PyTorch code and take care of lots of the mundane boilerplate code. | ||
|
||
In particular you will learn how to … | ||
|
||
- organize our PyTorch code with Lightning; | ||
- compute metrics efficiently with TorchMetrics; | ||
- make our code reproducible; | ||
- organize our data loaders via DataModules; | ||
- logging results during training; | ||
- adding extra functionality with callbacks. | ||
|
||
This Studio provides a reproducible environment with the supplementary code for Unit 5 of the [**Deep Learning Fundamentals**](https://lightning.ai/pages/courses/deep-learning-fundamentals/) class by Sebastian Raschka, which is freely available at Lightning AI. | ||
|
||
<br> | ||
|
||
**What's included?** | ||
|
||
Click the "Run Template" button at the top of this page to launch into a Studio environment that contains the following materials: | ||
|
||
- `code-units/`: | ||
|
||
- `5.2-mlp-lightning`: training a multilayer perceptron using the PyTorch Lightning Trainer | ||
|
||
- `5.3-torchmetrics`: computing metrics efficiently with TorchMetrics | ||
|
||
- `5.4-reproducibility`: making code reproducible | ||
|
||
- `5.5-datamodules`: organizing your data loaders with data modules | ||
|
||
- `5.6-logging`: the benefits of logging your model training | ||
|
||
- `5.7-evaluating`: Evaluating and using models on new data | ||
|
||
|
||
- `exercises/`: | ||
- `1_lightning-regression`: Exercise 1, changing a classifier to a regression model | ||
- `2_custom-callback`: Exercise 2, developing a custom plugin for tracking training and validation accuracy | ||
- `solutions/`: Solutions to the exercises above | ||
|
||
--- | ||
|
||
<br> | ||
|
||
<iframe width="560" height="315" src="https://www.youtube.com/embed/DxALtmlxQ4U?si=Qa8hF9NPVdQRRMVf" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe> | ||
|
||
- Videos of [Part 2](https://www.youtube.com/watch?v=Y11-leJtC1k&list=PLaMu-SDt_RB7QZz-kTjdE_IkNDG0ZcHr-&index=4) and [Part 3](https://www.youtube.com/watch?v=8NKXArrnJlQ&list=PLaMu-SDt_RB7QZz-kTjdE_IkNDG0ZcHr-&index=5) | ||
- [The complete YouTube Playlist](https://www.youtube.com/watch?v=x4UvpMsyG8M&list=PLaMu-SDt_RB7QZz-kTjdE_IkNDG0ZcHr-) with all 19 videos in Unit 5 | ||
- [Or access the Unit 5 videos on the Lightning website](https://lightning.ai/courses/deep-learning-fundamentals/), which includes additional quizzes | ||
|
||
<br> | ||
|
||
## About Unit 5: Organizing your Code with PyTorch Lightning | ||
|
||
The previous units focused on learning how deep neural networks work from scratch. Along the way, we introduced PyTorch in units 2 and 3, and we trained our first multilayer neural networks in Unit 4. Personally, I really like PyTorch’s balance between customizability and user-friendliness. | ||
|
||
However, as we start working with more sophisticated features, including model checkpointing, logging, multi-GPU training, and distributed computing, PyTorch can sometimes be a bit too verbose. Hence, in this unit, we will introduce the Lightning Trainer, which helps us organize our PyTorch code and take care of lots of the mundane boilerplate code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Using this Studio" | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"You can find the code covered in the Unit 5 videos in the `./code-units` subfolder. I recommend you first watch the videos and then experiment with the code.\n", | ||
"\n", | ||
"- [The complete YouTube Playlist](https://www.youtube.com/playlist?list=PLaMu-SDt_RB6b4Z_kOUAlT0KI6jTMCKPL) with all 24 videos in Unit 6\n", | ||
"- [Or access the Unit 6 videos on the Lightning website](https://lightning.ai/courses/deep-learning-fundamentals/), which includes additional quizzes" | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"After exploring the code, you may want to try the following exercises in the `./exercises` subfolder. (Solutions to the excercises can be found in the `./solutions` subfolder)." | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.10" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
Oops, something went wrong.