-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Add placeholder for the User Guide #159379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
4dddf07
8c8ae0e
df39c71
7ede97b
7e6d84d
7cf97d2
24f0a6a
72ec1e4
30d65d3
16c070f
6328675
cf19dc1
0840b2c
838b85d
2621566
b7adca6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# User Guide | ||
|
||
PyTorch provides a flexible and efficient platform for building deep | ||
learning models, offering dynamic computation graphs and a rich | ||
ecosystem of tools and libraries. This guide will help you harness the power | ||
of PyTorch to create and deploy machine learning models effectively. | ||
|
||
```{note} | ||
This guide is a work in progress. | ||
``` | ||
|
||
```{toctree} | ||
:maxdepth: 1 | ||
:caption: Introduction | ||
|
||
Pytorch Overview <https://docs.pytorch.org/tutorials/beginner/deep_learning_60min_blitz.html> | ||
Get Started <https://pytorch.org/get-started/locally/> | ||
Learn the Basics <https://docs.pytorch.org/tutorials/beginner/basics/intro.html> | ||
``` | ||
|
||
```{toctree} | ||
:maxdepth: 1 | ||
:caption: Core Concepts | ||
|
||
pytorch_main_components | ||
``` | ||
|
||
```{toctree} | ||
:maxdepth: 1 | ||
:caption: Beyond the Basics | ||
|
||
``` | ||
|
||
```{toctree} | ||
:maxdepth: 1 | ||
:caption: Developer Notes | ||
|
||
../notes | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
(pytorch_main_components)= | ||
# PyTorch Main Components | ||
|
||
PyTorch is a flexible and powerful library for deep learning that provides a comprehensive set of tools for building, training, and deploying machine learning models. | ||
|
||
## PyTorch Components for Basic Deep Learning | ||
|
||
Some of the basic PyTorch components include: | ||
|
||
* **Tensors** - N-dimensional arrays that serve as PyTorch's fundamental | ||
data structure. They support automatic differentiation, hardware acceleration, and provide a comprehensive API for mathematical operations. | ||
|
||
* **Autograd** - PyTorch's automatic differentiation engine | ||
that tracks operations performed on tensors and builds a computational | ||
graph dynamically to be able to compute gradients. | ||
|
||
* **Neural Network API** - A modular framework for building neural networks with pre-defined layers, | ||
activation functions, and loss functions. The {mod}`nn.Module` base class provides a clean interface | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these don't really work as links. Not sure if that's expected There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed them for now |
||
for creating custom network architectures with parameter management. | ||
|
||
* **DataLoaders** - Tools for efficient data handling that provide | ||
features like batching, shuffling, and parallel data loading. They abstract away the complexities | ||
of data preprocessing and iteration, allowing for optimized training loops. | ||
|
||
|
||
## PyTorch Compiler | ||
|
||
The PyTorch compiler is a suite of tools that optimize model execution and | ||
reduce resource requirements. You can learn more about the PyTorch compiler [here](https://docs.pytorch.org/docs/stable/torch.compiler_get_started.html). |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would remove this page and point to the tutorial intro: as done below: https://docs.pytorch.org/tutorials/beginner/basics/intro.html The overall intro the done more in depth there and the two particular examples here don't really work right now and I don't think it's worth blocking this page on fixing them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think keeping this actually helps (assuming fixing the examples isnt a big issue). This doc provides a quick overview without getting too lost in the weeds especially for those users who dont need to go into ML basics but want a quick overview of PyTorch. The page does still link to Learn the basics for those who need it and as suck the two complement each other. Plus for seo purposes this is one more thing that can surface and bring users to the necessary pages. If fixing the examples would take a lot, we could take those out for now since it is a work in progress anyways. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The specific examples here look very weird and I expect will be a lot of work to cleanup. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @albanD took the examples out and just left a basic overview. I do think an overview with basic examples would be good but I agree that we cant let the examples hold up landing his and getting work done on it. Let me know what you think. |
||
file_format: mystnb | ||
kernelspec: | ||
name: python3 | ||
mystnb: | ||
execution_timeout: 30 | ||
merge_streams: True | ||
--- | ||
|
||
```{code-cell} | ||
:tags: [remove-cell] | ||
import torch | ||
``` | ||
|
||
(what_is_pytorch)= | ||
|
||
# What is PyTorch? | ||
|
||
PyTorch, or torch, is an open-source machine learning library written in Python that | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1, probably just drop this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed |
||
provides a platform for deep learning. It features a dynamic computational graph | ||
that allows for flexible model building and debugging. | ||
|
||
At its core, PyTorch uses tensors (multidimensional arrays) that can run on GPUs | ||
for accelerated computation. For example, the gradient descent optimization | ||
process can be represented as: | ||
|
||
```{math} | ||
\theta_{\text{new}} = \theta_{\text{old}} - \alpha \nabla_{\theta} J(\theta) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @albanD 's our mathemetician, I just look at formulas and they look approximately fine to me lol |
||
``` | ||
|
||
* `θ_new` is the updated parameter | ||
* `θ_old` is the current parameter | ||
* `α` is the learning rate | ||
* `∇_θ J(θ)` is the gradient of the cost function with respect to `θ` | ||
|
||
PyTorch's autograd engine automatically computes the gradients needed for neural network training. | ||
|
||
For a quick tutorial on PyTorch, see the [Learn the Basics tutorial](https://pytorch.org/tutorials/beginner/basics/intro.html). | ||
|
||
# Beyond Basic Operations | ||
|
||
PyTorch extends far beyond basic arithmetic operations to provide a complete ecosystem for machine learning development: | ||
* {mod}`torch.nn` module: Offers pre-built neural network layers, activation functions, and loss functions for constructing complex architectures | ||
* {mod}`torch.utils.data`: Provides efficient data loading utilities with support for batching, shuffling, and parallel data loading | ||
* {mod}`torch.optim`: Contains a comprehensive suite of optimization algorithms including SGD, Adam, RMSprop, and many others | ||
* {func}`torch.compile`: Allows for compiling PyTorch models to improve execution speed and efficiency | ||
* {func}`torch.export`: Enables exporting models for deployment in various environments. | ||
* Distributed training: Facilitates training across multiple GPUs and nodes, making it suitable for large-scale machine learning tasks | ||
|
||
```{seealso} | ||
* {ref}`torch.compiler_overview` | ||
* {ref}`torch.export` | ||
* [Learn the basics](https://docs.pytorch.org/tutorials/beginner/basics/intro.html) | ||
``` |
Uh oh!
There was an error while loading. Please reload this page.