text stringlengths 0 1.73k | source stringlengths 35 119 | category stringclasses 2
values |
|---|---|---|
return output
```
Batching
Hardware accelerators are optimized for parallelism, and batching — feeding a model multiple inputs in a single step — helps saturate all available capacity, typically resulting in higher throughputs. Excessively high batch sizes, however, can increase latency with minimal improvement in thro... | https://pytorch.org/blog/amazon-ads-case-study/ | pytorch blogs |
Parallelism
Model parallelism on multi-cores also improves throughput and latency, which is crucial for our heavy workloads. Each Inferentia chip contains four NeuronCores that can either run separate models simultaneously or form a pipeline to stream a single model. In our use case, the data parallel configuration off... | https://pytorch.org/blog/amazon-ads-case-study/ | pytorch blogs |
We use SageMaker Model Monitor to track parity between the training and production data. Model Monitor notifies us when predictions in production begin to deviate from the training and validation results. Thanks to this early warning, we can restore accuracy — by retraining the model if necessary — before our advertise... | https://pytorch.org/blog/amazon-ads-case-study/ | pytorch blogs |
A rewarding result
Our DL models, developed in PyTorch and deployed on Inferentia, sped up our ads analysis while cutting costs. Starting with our first explorations in DL, programming in PyTorch felt natural. Its user-friendly features helped smooth the course from our early experiments to the deployment of our multim... | https://pytorch.org/blog/amazon-ads-case-study/ | pytorch blogs |
layout: blog_detail
title: "Accelerated Generative Diffusion Models with PyTorch 2"
author: Grigory Sizov, Michael Gschwind, Hamid Shojanazeri, Driss Guessous, Daniel Haziza, Christian Puhrsch
TL;DR: PyTorch 2.0 nightly offers out-of-the-box performance improvement for Generative Diffusion models by using the new tor... | https://pytorch.org/blog/accelerated-generative-diffusion-models/ | pytorch blogs |
We took an open source implementation of a popular text-to-image diffusion model as a starting point and accelerated its generation using two optimizations available in PyTorch 2: compilation and fast attention implementation. Together with a few minor memory processing improvements in the code these optimizations give... | https://pytorch.org/blog/accelerated-generative-diffusion-models/ | pytorch blogs |
The table below shows the improvement in runtime between the original implementation with xFormers installed and our optimized version with PyTorch-integrated memory efficient attention (originally developed for and released in the xFormers library) and PyTorch compilation. The compilation time is excluded.
Runtime im... | https://pytorch.org/blog/accelerated-generative-diffusion-models/ | pytorch blogs |
10.51
14.2
A10
-2.34
8.99
10.57
V100
18.63
6.39
10.43
A100
38.5
20.33
12.17
One can notice the following:
* The improvements are significant for powerful GPUs like A100 and V100. For those GPUs the improvement is most pronounced for batch size 1
* For less power... | https://pytorch.org/blog/accelerated-generative-diffusion-models/ | pytorch blogs |
Specifically, we benchmark 5 configurations and the plots below compare their absolute performance for different GPUs and batch sizes. For definitions of these configurations see section “Benchmarking setup and results”.
Optimizations | https://pytorch.org/blog/accelerated-generative-diffusion-models/ | pytorch blogs |
Optimizations
Here we’ll go into more detail about the optimizations introduced into the model code. These optimizations rely on features of PyTorch 2.0 which has been released recently.
Optimized Attention
One part of the code which we optimized is the scaled dot-product attention. Attention is known to be a heavy op... | https://pytorch.org/blog/accelerated-generative-diffusion-models/ | pytorch blogs |
def init(self, ...):
# Create matrices: Q, K, V, out_proj
...
def forward(self, x, context=None, mask=None):
# Compute out = SoftMax(Q*K/sqrt(d))V
# Return out_proj(out)
…
gets replaced with
class CrossAttention(nn.Module):
def init(self, ...):
self.mha = nn.Multihe... | https://pytorch.org/blog/accelerated-generative-diffusion-models/ | pytorch blogs |
return self.mha(x, context, context)
```
The optimized implementation of attention was available already in PyTorch 1.13 (see here) and widely adopted (see e.g. HuggingFace transformers library example). In particular, it integrates memory-efficient attention from the xFormers library and flash attention from https://a... | https://pytorch.org/blog/accelerated-generative-diffusion-models/ | pytorch blogs |
Flash attention is available on GPUs with compute capability SM 7.5 or SM 8.x - for example, on T4, A10, and A100, which are included in our benchmark (you can check compute capability of each NVIDIA GPU here). However, in our tests on A100 the memory efficient attention performed better than flash attention for the pa... | https://pytorch.org/blog/accelerated-generative-diffusion-models/ | pytorch blogs |
Compilation
Compilation is a new feature of PyTorch 2.0, enabling significant speedups with a very simple user experience. To invoke the default behavior, simply wrap a PyTorch module or a function into torch.compile:
model = torch.compile(model)
PyTorch compiler then turns Python code into a set of instructions which... | https://pytorch.org/blog/accelerated-generative-diffusion-models/ | pytorch blogs |
Although the one-liner above is enough for compilation, certain modifications in the code can squeeze a larger speedup. In particular, one should avoid so-called graph breaks - places in the code which PyTorch can’t compile. As opposed to previous PyTorch compilation approaches (like TorchScript), PyTorch 2 compiler do... | https://pytorch.org/blog/accelerated-generative-diffusion-models/ | pytorch blogs |
Theoretically, one can apply torch.compileon the whole diffusion sampling loop. However, in practice it is enough to just compile the U-Net. The reason is that torch.compile doesn’t yet have a loop analyzer and would recompile the code for each iteration of the sampling loop. Moreover, compiled sampler code is likely t... | https://pytorch.org/blog/accelerated-generative-diffusion-models/ | pytorch blogs |
Other optimizations
In addition, we have improved efficiency of GPU memory operations by eliminating some common pitfalls, e.g. creating a tensor on GPU directly rather than creating it on CPU and later moving to GPU. The places where such optimizations were necessary were determined by line-profiling and looking at CP... | https://pytorch.org/blog/accelerated-generative-diffusion-models/ | pytorch blogs |
As the original version we took the version of the code which uses PyTorch 1.12 and a custom implementation of attention. The optimized version uses nn.MultiheadAttention in CrossAttention and PyTorch 2.0.0.dev20230111+cu117. It also has a few other minor optimizations in PyTorch-related code.
The table below shows ru... | https://pytorch.org/blog/accelerated-generative-diffusion-models/ | pytorch blogs |
29.8s (-77.3%)
13.0s (-83.9%)
10.9s (-33.1%)
8.0s (-19.3%)
Original with xFormers
25.5s (0.0%)
16.8s (0.0%)
7.1s (0.0%)
8.2s (0.0%)
6.7s (0.0%)
Optimized with vanilla math attention, no compilation
27.3s (-7.0%)
19.9s (-18.7%)
13.2s (-87.2%)
7.5s (8.7%)
5.7s ... | https://pytorch.org/blog/accelerated-generative-diffusion-models/ | pytorch blogs |
-
16.4s (2.1%)
7.2s (-2.3%)
6.6s (18.6%)
4.1s (38.5%)
Runtimes for batch size 2
Configuration
P100
T4
A10
V100
A100
Original without xFormers
58.0s (-21.6%)
57.6s (-84.0%)
24.4s (-95.2%)
18.6s (-63.0%)
12.0s (-50.6%)
Original with xFormers
47.7s (0.0%)
31.... | https://pytorch.org/blog/accelerated-generative-diffusion-models/ | pytorch blogs |
8.0s (0.0%)
Optimized with vanilla math attention, no compilation
49.3s (-3.5%)
37.9s (-21.0%)
17.8s (-42.2%)
12.7s (-10.7%)
7.8s (1.8%)
Optimized with mem. efficient attention, no compilation
47.5s (0.4%)
31.2s (0.5%)
12.2s (2.6%)
11.5s (-0.7%)
7.0s (12.6%)
Optimize... | https://pytorch.org/blog/accelerated-generative-diffusion-models/ | pytorch blogs |
Configuration
P100
T4
A10
V100
A100
Original without xFormers
117.9s (-20.0%)
112.4s (-81.8%)
47.2s (-101.7%)
35.8s (-71.9%)
22.8s (-78.9%)
Original with xFormers
98.3s (0.0%)
61.8s (0.0%)
23.4s (0.0%)
20.8s (0.0%)
12.7s (0.0%)
Optimized with vanilla math attentio... | https://pytorch.org/blog/accelerated-generative-diffusion-models/ | pytorch blogs |
14.5s (-13.9%)
Optimized with mem. efficient attention, no compilation
92.9s (5.5%)
61.1s (1.2%)
23.9s (-1.9%)
20.8s (-0.1%)
12.8s (-0.9%)
Optimized with mem. efficient attention and compilation
-
53.1s (14.2%)
20.9s (10.6%)
18.6s (10.4%)
11.2s (12.2%)
| https://pytorch.org/blog/accelerated-generative-diffusion-models/ | pytorch blogs |
To minimize fluctuations and external influence on the performance of the benchmarked code, we ran each version of the code one after another, and then repeated this sequence 10 times: A, B, C, D, E, A, B, … So the results of a typical run would look like the one in the picture below.. Note that one shouldn’t rely ... | https://pytorch.org/blog/accelerated-generative-diffusion-models/ | pytorch blogs |
Each run of text-to-image generation script produces several batches, the number of which is regulated by the CLI parameter --n_iter. In the benchmarks we used n_iter = 2, but introduced an additional “warm-up” iteration, which doesn’t contribute to the run time. This was necessary for the runs with compilation, becaus... | https://pytorch.org/blog/accelerated-generative-diffusion-models/ | pytorch blogs |
Conclusions and next steps
We have shown that new features of PyTorch 2 - compiler and optimized attention implementation - give performance improvements exceeding or comparable with what previously required installation of an external dependency (xFormers). PyTorch achieved this, in particular, by integrating memory e... | https://pytorch.org/blog/accelerated-generative-diffusion-models/ | pytorch blogs |
We intentionally minimized changes to the original model code. Further profiling and optimization can probably bring more improvements
At the moment compilation is applied only to the U-Net model inside the sampler. Since there is a lot happening outside of U-Net (e.g. operations directly in the sampling loop), it wou... | https://pytorch.org/blog/accelerated-generative-diffusion-models/ | pytorch blogs |
Resources
PyTorch 2.0 overview, which has a lot of information on torch.compile: https://pytorch.org/get-started/pytorch-2.0/
Tutorial on torch.compile: https://pytorch.org/tutorials/intermediate/torch_compile_tutorial.html
General compilation troubleshooting: https://pytorch.org/docs/master/dynamo/troubleshooting.ht... | https://pytorch.org/blog/accelerated-generative-diffusion-models/ | pytorch blogs |
Tutorial on optimized attention in PyTorch 1.12: https://pytorch.org/tutorials/beginner/bettertransformer_tutorial.html
Acknowledgements
We would like to thank Geeta Chauhan, Natalia Gimelshein, Patrick Labatut, Bert Maher, Mark Saroufim, Michael Voznesensky and Francisco Massa for their valuable advice and early fe... | https://pytorch.org/blog/accelerated-generative-diffusion-models/ | pytorch blogs |
layout: blog_detail
title: "Performance Debugging of Production PyTorch Models at Meta"
author: CK Luk, Lei Tian
featured-img: "/assets/images/performance-debugging-of-production-pytorch-models-at-meta-1.png"
1. Meta’s AI Performance Profiling (MAIProf)
Figure 1: A simplified illustration of the Meta’s AI perform... | https://pytorch.org/blog/performance-debugging-of-production-pytorch-models-at-meta/ | pytorch blogs |
Figure 1 gives a simplified illustration of the AI performance profiling infrastructure at Meta. ML research and performance engineers submit through the User Portal a profiling request for a training job to the Profiling Service, which subsequently broadcasts the request to all the GPU hosts running the training job.... | https://pytorch.org/blog/performance-debugging-of-production-pytorch-models-at-meta/ | pytorch blogs |
Once both trace and metrics collections are completed, the Profiling Service will automatically download traces from the Object Store for trace analysis and performance metrics from the Time Series DB for metric analysis. Finally, an overall profiling report with detailed and insightful analysis is delivered to the use... | https://pytorch.org/blog/performance-debugging-of-production-pytorch-models-at-meta/ | pytorch blogs |
Provide multiple tools that target a wide range of AI partitioners: At Meta, there are engineers with different backgrounds who may need to tune their AI workload performance. Some of them are AI experts while others are general software engineers. Therefore, MAIProf provides a variety of tools for different levels of... | https://pytorch.org/blog/performance-debugging-of-production-pytorch-models-at-meta/ | pytorch blogs |
To be concrete, we use a case study on a protection PyTorch model used in production. First, we discuss our steps for identifying the performance bottlenecks in the model with MAIProf. Then we describe the corresponding optimizations applied and their impacts.
2.1 Performance Bottlenecks
Step 1:
Inspect the CPU and GPU... | https://pytorch.org/blog/performance-debugging-of-production-pytorch-models-at-meta/ | pytorch blogs |
Step 2:
Collect a Python function call trace on the CPU with MAIProf while the GPU is idle, which is shown in Figure 3.
Figure 3: A Python call trace.
| https://pytorch.org/blog/performance-debugging-of-production-pytorch-models-at-meta/ | pytorch blogs |
Figure 3: A Python call trace.
The Python trace shows that most of the CPU time is spent inside a Python function sharded_iterrows(). From the source code of the model, we learned that this function processes a big feature table in parallel. The number of worker threads used is controlled by a configurable parameter (... | https://pytorch.org/blog/performance-debugging-of-production-pytorch-models-at-meta/ | pytorch blogs |
Figure 4: GPU performance metrics in MAIProf.
We made the following observations from Figure 4:
- The streaming multiprocessor (SM) runs the model’s CUDA kernels. Its utilization [1] is 9.1%, indicating that the parallel compute units on the GPU are not well utilized.
- Tensor Core utilization is 0, meaning that Ten... | https://pytorch.org/blog/performance-debugging-of-production-pytorch-models-at-meta/ | pytorch blogs |
Since commonly used PyTorch functions are already annotated, their names are automatically shown on the trace. With them, we can roughly divide the trace into the four phases in a training iteration: (1) data loading, (2) forward pass, (3) backward pass, (4) gradient optimization (note: In Figure 5, the “optimizer” ph... | https://pytorch.org/blog/performance-debugging-of-production-pytorch-models-at-meta/ | pytorch blogs |
| Use automatic mixed precision in PyTorch | 13 source lines | Zero Tensor Core utilization |
| Use mulitensor optimizer in PyTorch | 1 source line | Many small GPU kernels in the optimizer |
Figure 6: Four simple optimizations applied.
3. Concluding Remarks
Performance tuning for PyTorch in production environments i... | https://pytorch.org/blog/performance-debugging-of-production-pytorch-models-at-meta/ | pytorch blogs |
At Meta, MAIProf has been used by 100s of engineers, from performance novices to experts, to identify many more types of bottlenecks. These include slow data loading, small and/or slow GPU kernels, distributed training issues such as load imbalance and excessive communication. MAIProf covers major classes of models, in... | https://pytorch.org/blog/performance-debugging-of-production-pytorch-models-at-meta/ | pytorch blogs |
layout: blog_detail
title: 'Everything You Need To Know About Torchvision’s SSD Implementation'
author: Vasilis Vryniotis
featured-img: 'assets/images/prediction-examples.png'
In TorchVision v0.10, we’ve released two new Object Detection models based on the SSD architecture. Our plan is to cover the key implementatio... | https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
In part 1 of the series, we will focus on the original implementation of the SSD algorithm as described on the Single Shot MultiBox Detector paper. We will briefly give a high-level description of how the algorithm works, then go through its main components, highlight key parts of its code, and finally discuss how we t... | https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
The SSD algorithm uses a CNN backbone, passes the input image through it and takes the convolutional outputs from different levels of the network. The list of these outputs are called feature maps. These feature maps are then passed through the Classification and Regression heads which are responsible for predicting... | https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
Since the feature maps of each image contain outputs from different levels of the network, their size varies and thus they can capture objects of different dimensions. On top of each, we tile several default boxes which can be thought as our rough prior guesses. For each default box, we predict whether there is an obje... | https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
DefaultBoxGenerator
The DefaultBoxGenerator class is responsible for generating the default boxes of SSD and operates similarly to the AnchorGenerator of FasterRCNN (for more info on their differences see pages 4-6 of the paper). It produces a set of predefined boxes of specific width and height which are tiled across ... | https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
The class is parameterized by a set of hyperparameters that control their shape and tiling. The implementation will provide automatically good guesses with the default parameters for those who want to experiment with new backbones/datasets but one can also pass optimized custom values.
SSDMatcher | https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
The SSDMatcher class extends the standard Matcher used by FasterRCNN and it is responsible for matching the default boxes to the ground truth. After estimating the IoUs of all combinations, we use the matcher to find for each default box the best candidate ground truth with overlap higher than the IoU threshold. The SS... | https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
Classification and Regression Heads
The SSDHead class is responsible for initializing the Classification and Regression parts of the network. Here are a few notable details about their code:
* Both the Classification and the Regression head inherit from the same class which is responsible for making the predictions for... | https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
Each level of the feature map uses a separate 3x3 Convolution to estimate the class logits and box locations.
The number of predictions that each head makes per level depends on the number of default boxes and the sizes of the feature maps.
Backbone Feature Extractor
The feature extractor reconfigures and enhances a... | https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
The class supports all VGG models of TorchVision and one can create a similar extractor class for other types of CNNs (see this example for ResNet). Here are a few implementation details of the class:
* Patching the ceil_mode parameter of the 3rd Maxpool layer is necessary to get the same feature map sizes as the pape... | https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
It adds a series of extra feature layerson top of VGG. If the highres parameter is True during its construction, it will append an extra convolution. This is useful for the SSD512 version of the model.
As discussed on section 3 of the paper, the fully connected layers of the original VGG are converted to convolutions ... | https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
As described on section 3.1, L2 normalization is used on the output of conv4_3 and a set of learnable weights are introduced to control its scaling.
SSD Algorithm
The final key piece of the implementation is on the SSD class. Here are some notable details: | https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
The algorithm is parameterized by a set of arguments similar to other detection models. The mandatory parameters are: the backbone which is responsible for estimating the feature maps, the anchor_generator which should be a configured instance of the DefaultBoxGenerator class, the size to which the input images will b... | https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
If a head is not provided, the constructor will initialize the default SSDHead. To do so, we need to know the number of output channels for each feature map produced by the backbone. Initially we try to retrieve this information from the backbone but if not available we will dynamically estimate it.
| https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
The algorithm reuses the standard BoxCoder class used by other Detection models. The class is responsible for encoding and decoding the bounding boxes and is configured to use the same prior variances as the original implementation.
| https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
Though we reuse the standard GeneralizedRCNNTransform class to resize and normalize the input images, the SSD algorithm configures it to ensure that the image size will remain fixed.
Here are the two core methods of the implementation:
| https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
The compute_loss method estimates the standard Multi-box loss as described on page 5 of the SSD paper. It uses the smooth L1 loss for regression and the standard cross-entropy loss with hard-negative sampling for classification.
| https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
As in all detection models, the forward method currently has different behaviour depending on whether the model is on training or eval mode. It starts by resizing & normalizing the input images and then passes them through the backbone to get the feature maps. The feature maps are then passed through the head to get t... | https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
If the model is on training mode, the forward will estimate the IoUs of the default boxes with the ground truth, use the SSDmatcher to produce matches and finally estimate the losses by calling the compute_loss method.
| https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
If the model is on eval mode, we first select the best detections by keeping only the ones that pass the score threshold, select the most promising boxes and run NMS to clean up and select the best predictions. Finally we postprocess the predictions to resize them to the original image size.
The SSD300 VGG16 Model | https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
The SSD300 VGG16 Model
The SSD is a family of models because it can be configured with different backbones and different Head configurations. In this section, we will focus on the provided SSD pre-trained model. We will discuss the details of its configuration and the training process used to reproduce the reported res... | https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
Paper Hyperparameters
In order to achieve the best possible results on COCO, we adopted the hyperparameters described on the section 3 of the paper concerning the optimizer configuration, the weight regularization etc. Moreover we found it useful to adopt the optimizations that appear in the official implementation con... | https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
Data Augmentation
Implementing the SSD Data Augmentation strategy as described on page 6 and page 12 of the paper was critical to reproducing the results. More specifically the use of random “Zoom In” and “Zoom Out” transformations make the model robust to various input sizes and improve its precision on the small and ... | https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
Another aspect that we found beneficial was to follow the weight initialization scheme proposed by the paper. To do that, we had to adapt our input scaling method by undoing the 0-1 scaling performed by ToTensor() and use pre-trained ImageNet weights fitted with this scaling (shoutout to Max deGroot for providing them ... | https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
LR Scheme
As reported on the paper, after applying aggressive data augmentations it’s necessary to train the models for longer. Our experiments confirm this and we had to tweak the Learning rate, batch sizes and overall steps to achieve the best results. Our proposed learning scheme is configured to be rather on the sa... | https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
Breakdown of Key Accuracy Improvements
It is important to note that implementing a model directly from a paper is an iterative process that circles between coding, training, bug fixing and adapting the configuration until we match the accuracies reported on the paper. Quite often it also involves simplifying the traini... | https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
Model Configuration
mAP delta
mAP
Baseline with "FasterRCNN-style" Hyperparams
-
19.5
+ Paper Hyperparams
1.6
21.1
+ Data Augmentation
1.8
22.9
+ Weight Initialization & Input Scaling
1
23.9
+ LR scheme
1.2
25.1
Our final model achieves an mAP of 25.1 and reproduces exactly the COCO results reported... | https://pytorch.org/blog/torchvision-ssd-implementation/ | pytorch blogs |
layout: blog_detail
title: "PyTorch strengthens its governance by joining the Linux Foundation"
author: Soumith Chintala
featured-img: "/assets/images/pytorch-foundation-blog-image.jpg"
| https://pytorch.org/blog/PyTorchfoundation/ | pytorch blogs |
Today, I am proud to announce that PyTorch is moving to the Linux Foundation (LF) as a top-level project under the name PyTorch Foundation. The core mission of the Linux Foundation is the collaborative development of open source software. With a governing board of leaders from AMD, Amazon Web Services (AWS), Google Clo... | https://pytorch.org/blog/PyTorchfoundation/ | pytorch blogs |
This January, PyTorch celebrated its 5 year anniversary! I reflected on what it meant to me in this tweet thread, and this conversation with my colleagues Mike Schroepfer, Lin Qiao, and Yann LeCun. When we started PyTorch development in 2016, it was a collective effort by a band of people from the [Lua]Torch community ... | https://pytorch.org/blog/PyTorchfoundation/ | pytorch blogs |
Since 2017, PyTorch has grown far beyond our initial vision. With over 2,400 contributors who have built nearly 154,000 projects using PyTorch as a foundation, PyTorch has become one of the primary platforms for AI research, as well as commercial production use. We’ve seen its impact across industry and academia, from ... | https://pytorch.org/blog/PyTorchfoundation/ | pytorch blogs |
As PyTorch grew, many companies have made foundational investments around it. While Meta remains the largest contributor to PyTorch, companies such as AMD, Amazon Web Services (AWS), Google Cloud, HuggingFace, Lightning AI, Microsoft Azure, Nvidia, and many others have made significant investments, including both tec... | https://pytorch.org/blog/PyTorchfoundation/ | pytorch blogs |
The business governance of PyTorch was fairly unstructured for quite some time since launch – we operated like a scrappy startup. Team members at Meta spent the time and energy to structure this properly and organize PyTorch into an organizationally more healthy entity. Meta helped PyTorch with introducing many structu... | https://pytorch.org/blog/PyTorchfoundation/ | pytorch blogs |
Simultaneously, the technical governance of PyTorch has been a loosely structured community model of open-source development — A set of people maintaining PyTorch by area with their responsibility often tied to their individual identity rather than their employment. While we kept a codified list at the PyTorch - Mainta... | https://pytorch.org/blog/PyTorchfoundation/ | pytorch blogs |
It’s been an exciting journey since 2016. I am grateful for the experiences and people I’ve met along the way. PyTorch started with a small group of contributors which have grown and diversified over the years, all bringing in new ideas and innovations that would not have been possible without our community. We want to... | https://pytorch.org/blog/PyTorchfoundation/ | pytorch blogs |
layout: blog_detail
title: 'PyTorch 1.3 adds mobile, privacy, quantization, and named tensors'
author: Team PyTorch
PyTorch continues to gain momentum because of its focus on meeting the needs of researchers, its streamlined workflow for production use, and most of all because of the enthusiastic support it has recei... | https://pytorch.org/blog/pytorch-1-dot-3-adds-mobile-privacy-quantization-and-named-tensors/ | pytorch blogs |
We are now advancing the platform further with the release of PyTorch 1.3, which includes experimental support for features such as seamless model deployment to mobile devices, model quantization for better performance at inference time, and front-end improvements, like the ability to name tensors and create clearer co... | https://pytorch.org/blog/pytorch-1-dot-3-adds-mobile-privacy-quantization-and-named-tensors/ | pytorch blogs |
Additionally, we’ve collaborated with Google and Salesforce to add broad support for Cloud Tensor Processing Units, providing a significantly accelerated option for training large-scale deep neural networks. Alibaba Cloud also joins Amazon Web Services, Microsoft Azure, and Google Cloud as supported cloud platforms for... | https://pytorch.org/blog/pytorch-1-dot-3-adds-mobile-privacy-quantization-and-named-tensors/ | pytorch blogs |
Named tensors (experimental)
Cornell University’s Sasha Rush has argued that, despite its ubiquity in deep learning, the traditional implementation of tensors has significant shortcomings, such as exposing private dimensions, broadcasting based on absolute position, and keeping type information in documentation. He pro... | https://pytorch.org/blog/pytorch-1-dot-3-adds-mobile-privacy-quantization-and-named-tensors/ | pytorch blogs |
```
Quantization (experimental)
It’s important to make efficient use of both server-side and on-device compute resources when developing ML applications. To support more efficient deployment on servers and edge devices, PyTorch 1.3 now supports 8-bit model quantization using the familiar eager mode Python API. Quantiza... | https://pytorch.org/blog/pytorch-1-dot-3-adds-mobile-privacy-quantization-and-named-tensors/ | pytorch blogs |
To learn more about the design and architecture, check out the API docs here, and get started with any of the supported techniques using the tutorials available here.
PyTorch mobile (experimental)
Running ML on edge devices is growing in importance as applications continue to demand lower latency. It is also a foundati... | https://pytorch.org/blog/pytorch-1-dot-3-adds-mobile-privacy-quantization-and-named-tensors/ | pytorch blogs |
High level API: Extend mobile native APIs to cover common preprocessing and integration tasks needed for incorporating ML in mobile applications. e.g. Computer vision and NLP
Learn more or get started on Android or iOS here.
New tools for model interpretability and privacy
Captum
As models become ever more complex, i... | https://pytorch.org/blog/pytorch-1-dot-3-adds-mobile-privacy-quantization-and-named-tensors/ | pytorch blogs |
noise_tunnel = NoiseTunnel(integrated_gradients)
attributions_ig_nt, delta = noise_tunnel.attribute(input, n_samples=10, nt_type='smoothgrad_sq', target=pred_label_idx)
_ = viz.visualize_image_attr_multiple(["original_image", "heat_map"],
["all", "positive"],
... | https://pytorch.org/blog/pytorch-1-dot-3-adds-mobile-privacy-quantization-and-named-tensors/ | pytorch blogs |
CrypTen
Practical applications of ML via cloud-based or machine-learning-as-a-service (MLaaS) platforms pose a range of security and privacy challenges. In particular, users of these platforms may not want or be able to share unencrypted data, which prevents them from taking full advantage of ML tools. To address these... | https://pytorch.org/blog/pytorch-1-dot-3-adds-mobile-privacy-quantization-and-named-tensors/ | pytorch blogs |
Tools for multimodal AI systems
Digital content is often made up of several modalities, such as text, images, audio, and video. For example, a single public post might contain an image, body text, a title, a video, and a landing page. Even one particular component may have more than one modality, such as a video that c... | https://pytorch.org/blog/pytorch-1-dot-3-adds-mobile-privacy-quantization-and-named-tensors/ | pytorch blogs |
Detectron2
Object detection and segmentation are used for tasks ranging from autonomous vehicles to content understanding for platform integrity. To advance this work, Facebook AI Research (FAIR) is releasing Detectron2, an object detection library now implemented in PyTorch. Detectron2 provides support for the latest ... | https://pytorch.org/blog/pytorch-1-dot-3-adds-mobile-privacy-quantization-and-named-tensors/ | pytorch blogs |
Speech extensions to fairseq
Language translation and audio processing are critical components in systems and applications such as search, translation, speech, and assistants. There has been tremendous progress in these fields recently thanks to the development of new architectures like transformers, as well as large-s... | https://pytorch.org/blog/pytorch-1-dot-3-adds-mobile-privacy-quantization-and-named-tensors/ | pytorch blogs |
Cloud provider and hardware ecosystem support
Cloud providers such as Amazon Web Services, Microsoft Azure, and Google Cloud provide extensive support for anyone looking to develop ML on PyTorch and deploy in production. We’re excited to share the general availability of Google Cloud TPU support and a newly launched in... | https://pytorch.org/blog/pytorch-1-dot-3-adds-mobile-privacy-quantization-and-named-tensors/ | pytorch blogs |
Google Cloud TPU support now broadly available. To accelerate the largest-scale machine learning (ML) applications deployed today and enable rapid development of the ML applications of tomorrow, Google created custom silicon chips called Tensor Processing Units (TPUs). When assembled into multi-rack ML supercomputers ... | https://pytorch.org/blog/pytorch-1-dot-3-adds-mobile-privacy-quantization-and-named-tensors/ | pytorch blogs |
Alibaba adds support for PyTorch in Alibaba Cloud. The initial integration involves a one-click solution for PyTorch 1.x, Data Science Workshop notebook service, distributed training with Gloo/NCCL, as well as seamless integration with Alibaba IaaS such as OSS, ODPS, and NAS. Together with the toolchain provided by Al... | https://pytorch.org/blog/pytorch-1-dot-3-adds-mobile-privacy-quantization-and-named-tensors/ | pytorch blogs |
Growth in the PyTorch community
As an open source, community-driven project, PyTorch benefits from wide range of contributors bringing new capabilities to the ecosystem. Here are some recent examples:
* Mila SpeechBrain aims to provide an open source, all-in-one speech toolkit based on PyTorch. The goal is to develop a... | https://pytorch.org/blog/pytorch-1-dot-3-adds-mobile-privacy-quantization-and-named-tensors/ | pytorch blogs |
SpaCy is a new wrapping library with consistent and easy-to-use interfaces to several models, in order to extract features to power NLP pipelines. Support is provided for via spaCy’s standard training API. The library also calculates an alignment so the transformer features can be related back to actual words instead ... | https://pytorch.org/blog/pytorch-1-dot-3-adds-mobile-privacy-quantization-and-named-tensors/ | pytorch blogs |
PyTorch Lightning is a Keras-like ML library for PyTorch. It leaves core training and validation logic to you and automates the rest. Reproducibility is a crucial requirement for many fields of research, including those based on ML techniques. As the number of research papers submitted to arXiv and conferences skyrock... | https://pytorch.org/blog/pytorch-1-dot-3-adds-mobile-privacy-quantization-and-named-tensors/ | pytorch blogs |
Torchmeta, which provides extensions for PyTorch to simplify the development of meta-learning algorithms in PyTorch. It features a unified interface inspired by TorchVision for both few-shot classification and regression problems, to allow easy benchmarking on multiple data sets to aid with reproducibility.
Open-Unmix... | https://pytorch.org/blog/pytorch-1-dot-3-adds-mobile-privacy-quantization-and-named-tensors/ | pytorch blogs |
We’d like to thank the entire PyTorch team and the community for all their contributions to this work. | https://pytorch.org/blog/pytorch-1-dot-3-adds-mobile-privacy-quantization-and-named-tensors/ | pytorch blogs |
layout: blog_detail
title: "Deprecation of CUDA 11.6 and Python 3.7 Support"
For the upcoming PyTorch 2.0 feature release (target March 2023), we will target CUDA 11.7 as the stable version and CUDA 11.8 as the experimental version of CUDA and Python >=3.8, <=3.11.
If you are still using or depending on CUDA 11.6 or... | https://pytorch.org/blog/deprecation-cuda-python-support/ | pytorch blogs |
1.13
>=3.7, <=3.10
CUDA 11.6, CUDNN 8.3.2.44
CUDA 11.7, CUDNN 8.5.0.96
1.12
>=3.7, <=3.10
CUDA 11.3, CUDNN 8.3.2.44
CUDA 11.6, CUDNN 8.3.2.44
As of 2/1/2023
For more information on PyTorch releases, updated compatibility matrix and release policies, please see (and bookmark) Read... | https://pytorch.org/blog/deprecation-cuda-python-support/ | pytorch blogs |
layout: blog_detail
title: "Straggler Mitigation On PyTorch DDP By Hierarchical SGD"
author: Yi Wang (Cruise AI), Rohan Varma (Meta AI)
PyTorch DDP has been widely adopted across the industry for distributed training, which by default runs synchronous SGD to synchronize gradients across model replicas at every step. ... | https://pytorch.org/blog/straggler-mitigation/ | pytorch blogs |
The Need For Straggler Mitigation
In DDP setup, a straggler problem can occur when one or more processes run much slower ("stragglers") than other processes. When this happens, all the processes have to wait for the stragglers before synchronizing gradients and completing the communication, which essentially bottleneck... | https://pytorch.org/blog/straggler-mitigation/ | pytorch blogs |
Besides data loading, other phases before gradient synchronization can also cause stragglers, such as unbalanced workloads of embedding table lookup during the forward pass in recommendation systems.
The Appearance of Stragglers
If we profile DDP training jobs that have stragglers, we can find that some processes may h... | https://pytorch.org/blog/straggler-mitigation/ | pytorch blogs |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.