diff --git "a/blogs_splitted_dataset.jsonl" "b/blogs_splitted_dataset.jsonl" new file mode 100644--- /dev/null +++ "b/blogs_splitted_dataset.jsonl" @@ -0,0 +1,5982 @@ +{"text":"text: ---\nlayout: blog_detail\ntitle: \"PyTorch Trace Analysis for the Masses\"\nauthor: Anupam Bhatnagar, Xizhou Feng, Brian Coutinho, Yifan Liu, Sung-Han Lin, Louis Feng, and Yuzhen Huang\n---","__index_level_0__":0} +{"text":"We are excited to announce the public release of Holistic Trace Analysis (HTA), an open source performance analysis and visualization Python library for PyTorch users. HTA takes as input [Kineto traces](https:\/\/github.com\/pytorch\/kineto) collected by the [PyTorch profiler](https:\/\/pytorch.org\/blog\/introducing-pytorch-profiler-the-new-and-improved-performance-tool\/), which are complex and challenging to interpret, and up-levels the performance information contained in these traces. It was initially developed internally at Meta to understand and debug performance problems for large-scale distributed training jobs on GPUs. The multidisciplinary team has made a number of enhancements to HTA\u2019s features and scaled them to support state-of-the-art ML workloads. ","__index_level_0__":1} +{"text":"ML researchers and systems engineers often struggle to computationally scale up their models because they are not aware of the performance bottlenecks in their workloads. The resources requested for a job (e.g. GPUs, memory) are often misaligned with the resources actually required due to lack of visibility \u201cunder the hood\u201d. To achieve the best performance from the hardware stack, it is imperative to understand the resource utilization and bottlenecks for distributed training workloads.","__index_level_0__":2} +{"text":"The initial HTA implementation was specifically targeted at Deep Learning Based Recommendation Models (DLRM). To make the features in HTA generic and applicable to use cases such as analyzing Vision and NLP models, we decided to refactor the HTA codebase and make the library available to the larger community. This new codebase has implemented several important ideas which lead to significant efficiency and performance improvements. ","__index_level_0__":3} +{"text":"In this blog, we present several features implemented in the open source version of HTA, which can be used as a Python script as well as interactively in a Jupyter notebook. HTA provides the following features:","__index_level_0__":4} +{"text":"1. **Breakdown by Dimensions**\n 1. **Temporal**: Breakdown of GPU time in terms of time spent in computation, communication, memory events, and idle time on a single node and across all ranks.\n 1. **Idle Time**: Breakdown of GPU idle time into waiting for the host, waiting for another kernel or attributed to an unknown cause.\n 1. **Kernel**: Find kernels with the longest duration on each rank.\n 1. **Communication Computation Overlap**: Calculate the percentage of time when communication overlaps computation.\n1. **Statistical Analysis**\n 1. **Kernel Duration Distribution**: Distribution of average time taken by longest kernels across different ranks.\n 1. **CUDA Kernel Launch**: Distributions of GPU kernels with very small duration, large duration, and excessive launch time.\n 1. **Augmented Counters (Memory bandwidth, Queue length)**: Augmented trace files which provide insights into memory copy bandwidth and number of outstanding operations on each CUDA stream.\n1. **Patterns**\n 1. **Frequent CUDA Kernels**: Find the CUDA kernels most frequently launched by any given PyTorch or user defined operator.\n1. **Trace Comparison**\n 1. **Trace Diff**: A trace comparison tool to identify and visualize the differences between traces.","__index_level_0__":5} +{"text":"HTA source code is available to users via [Github](https:\/\/github.com\/facebookresearch\/HolisticTraceAnalysis). Users can request new features or build their own analysis using the core libraries and data structures provided in the codebase in addition to the features mentioned above.","__index_level_0__":6} +{"text":"## GPU Training Performance Debugging 101","__index_level_0__":7} +{"text":"To understand the GPU performance in distributed training jobs, we consider how the model operators interact with the GPU devices and how such interactions are reflected in certain measurable metrics. ","__index_level_0__":8} +{"text":"At a high level, we can break down the GPU operations in a model execution into three broad categories, henceforth referred to as kernel types: \n1. **Computation (COMP)** - Compute kernels execute compiled routines for matrix multiplication and similar numeric calculations. They are responsible for all of the number-crunching necessary for model execution. \n1. **Communication (COMM)** - Communication kernels are routines which are responsible for exchanging and synchronizing data between different GPU devices in a distributed training job. The NVIDIA Collective Communication Library (NCCL) is a widely used communication library and all its kernels have the prefix \u201cnccl\u201d. Example NCCL kernels include NCCL_AllGather, NCCL_ReduceScatter, NCCL_AllReduce, etc. \n1. **Memory (MEM)** - Memory kernels manage the memory allocations\/deallocations on the GPU devices and data movement between the memory space on the host and the GPUs. The memory kernels include Memcpy_H2D, Memcpy_D2H, Memcpy_D2D, Memset, etc. Here, H represents the Host and D represents the GPU Device. Thus, H2D, D2H, D2D stands for Host to Device, Device to Host and Device to Device respectively. ","__index_level_0__":9} +{"text":"Because a modern GPU device like the NVIDIA A100 GPU is a massively parallel device which is capable of running multiple kernels simultaneously, it is possible to overlap the computation, communication, and memory kernels to reduce the model execution time. One common technique to achieve the overlap is to utilize multiple CUDA streams. A CUDA stream is a sequence of operations that execute on a GPU device in the order in which they are issued by the host code. Different CUDA streams can be interleaved and even run concurrently, thus achieving the effect of kernel overlap. ","__index_level_0__":10} +{"text":"To help understand the above concepts, Figure 1 provides a timeline of the GPU kernels in a sample distributed training job on 8 GPUs for one iteration. In the figure below, each rank represents one GPU and the kernels on each GPU run on 6 CUDA streams. In the right column of the figure, you can see names of the GPU kernels used. In the middle of the figure, you see the overlap between compute and communicate kernels. This figure is created using the [plot_timeline example notebook](https:\/\/github.com\/facebookresearch\/HolisticTraceAnalysis\/blob\/main\/examples\/plot_timeline.ipynb) available in HTA.","__index_level_0__":11} +{"text":"{:width=\"100%\"}","__index_level_0__":12} +{"text":"*Figure 1. An example of the execution timeline of GPU Kernels across multiple ranks*\n{: style=\"text-align: center;\"}","__index_level_0__":13} +{"text":"The performance of multiple GPU training jobs is affected by multiple factors. Among these factors, how does a model execution create and orchestrate the GPU kernels plays a critical role. HTA provides insights on how the model execution interacts with the GPU devices and highlights the opportunities for performance improvement.","__index_level_0__":14} +{"text":"With the features we built in HTA, we aim to provide users insights into \u201cwhat is happening under the hood in a distributed GPU training?\u201d We briefly describe these features in the next few paragraphs.","__index_level_0__":15} +{"text":"## Features in Holistic Trace Analysis ","__index_level_0__":16} +{"text":"For most users, understanding the performance of GPU training jobs is nontrivial. Thus, we built this library to simplify the task of trace analysis and provide the user useful insights by examining the model execution traces. As the first step, we developed features which are important and generic enough so that most users can benefit from this library.","__index_level_0__":17} +{"text":"**Temporal Breakdown**: We begin by asking whether the GPU is spending time on computation, communication, memory events, or is it idle? To answer this question, the temporal breakdown feature presents a breakdown in terms of these categories. To achieve high training efficiency the code should maximize time used by computation kernels and minimize idle time and non-compute time (time used by communication or memory kernels). This is accomplished by implementing concurrent execution of computation kernels with communication or memory kernels. *Note that, during concurrent execution of computation kernels with communication\/memory kernels the time spent by communication\/memory kernels is accounted for under compute time.*","__index_level_0__":18} +{"text":"{:width=\"100%\"}","__index_level_0__":19} +{"text":"*Figure 2: Temporal Breakdown across 8 GPUs*\n{: style=\"text-align: center;\"}","__index_level_0__":20} +{"text":"**Kernel Breakdown**: It is natural to ask which kernels are taking the most amount of time. The next feature breaks down the time spent within each kernel type (COMM, COMP, MEM) and sorts them by duration. We present this information for each kernel type and for each rank as a pie chart. See figure 3 below. ","__index_level_0__":21} +{"text":"{:width=\"100%\"}","__index_level_0__":22} +{"text":"*Figure 3: Pie chart of top computation and communication kernels*\n{: style=\"text-align: center;\"}","__index_level_0__":23} +{"text":"**Kernel Duration Distribution**: Subsequently, one can also ask - for any given kernel, what is the distribution of the time spent across the ranks? To answer this, HTA generates bar graphs for the average duration of a given kernel across all ranks. Additionally, the error bars in the bar graphs show the minimum and maximum amount of time taken by a given kernel on a given rank. Figure 4 below shows a discrepancy between average duration on rank 0 as compared to other ranks. This anomalous behavior on rank 0 guides the user on where to look for possible bugs.","__index_level_0__":24} +{"text":"{:width=\"100%\"}","__index_level_0__":25} +{"text":"*Figure 4: Average duration of NCCL AllReduce Kernel across 8 ranks*\n{: style=\"text-align: center;\"}","__index_level_0__":26} +{"text":"**Communication Computation Overlap**: In distributed training, a significant amount of time is spent in communication and synchronization events among multiple GPU devices. To achieve high GPU efficiency (i.e. TFLOPS\/GPU) it is vital to keep the GPU doing actual computation work. In other words, a GPU should not be blocked because of waiting for data from other GPUs. One way to measure the extent to which computation is blocked by data dependencies is to calculate the computation-communication overlap. Higher GPU efficiency is observed if communication events overlap computation events. Lack of communication and computation overlap will lead to the GPU being idle, thus the efficiency would be low. Thus, the communication computation overlap feature calculates the percentage of time communication and computation overlap in a job for each rank and generates a bar graph representation. See figure below. More precisely, we measure the following ratio","__index_level_0__":27} +{"text":"(time spent in computation while communicating) \/ (time spent in communication)\n{: style=\"text-align: center;\"}","__index_level_0__":28} +{"text":"\n{:width=\"100%\"}","__index_level_0__":29} +{"text":"*Figure 5: Communication computation overlap*\n{: style=\"text-align: center;\"}","__index_level_0__":30} +{"text":"**Augmented Counters (Queue length, Memory bandwidth)**: To aid in debugging, HTA calculates the memory bandwidth statistics for D2H, H2D and D2D memory copy (memcpy) and memory set (memset) events. Additionally, HTA also computes the number of outstanding CUDA operations on each CUDA stream. We refer to this as queue length. When the queue length on a stream is 1024 or larger new events cannot be scheduled on that stream and the CPU will stall until the GPU events have processed. Additionally, HTA generates a new trace file containing tracks with the memory bandwidth and queue length time series. See Figure 6 below.","__index_level_0__":31} +{"text":"{:width=\"100%\"}","__index_level_0__":32} +{"text":"*Figure 6: Memory Bandwidth and Queue Length*\n{: style=\"text-align: center;\"}","__index_level_0__":33} +{"text":"These primary features give us a peek into the system performance and help answer \u201cwhat is happening in the system?\u201d. As HTA evolves, we hope to address \u201cwhy is X happening?\u201d and also suggest possible solutions to overcome the bottlenecks.","__index_level_0__":34} +{"text":"## Installation and Usage","__index_level_0__":35} +{"text":"### Installation","__index_level_0__":36} +{"text":"For installing the HTA please refer to the [README](https:\/\/github.com\/facebookresearch\/HolisticTraceAnalysis\/blob\/main\/README.md). In brief, the user is required to clone the [repo](https:\/\/github.com\/facebookresearch\/HolisticTraceAnalysis) and install the necessary Python packages via pip.","__index_level_0__":37} +{"text":"This version of Holistic Trace Analysis is currently in beta and we recommend using HTA in a Jupyter notebook. A [demo notebook](https:\/\/github.com\/facebookresearch\/HolisticTraceAnalysis\/blob\/main\/examples\/trace_analysis_demo.ipynb) is provided for your convenience. To get started, import the hta package in a Jupyter notebook, create a TraceAnalysis object and off we go in exactly two lines of code.","__index_level_0__":39} +{"text":"```python\nfrom hta.trace_analysis import TraceAnalysis\nanalyzer = TraceAnalysis(trace_dir = \u201c\/trace\/folder\/path\u201d)\n```","__index_level_0__":40} +{"text":"### Requirements","__index_level_0__":41} +{"text":"- All trace files for a training or inference job must be stored in a unique folder.\n- Trace files are in json or gzipped json format.","__index_level_0__":42} +{"text":"#### Q. How can I install HTA?","__index_level_0__":44} +{"text":"Please see the [README](https:\/\/github.com\/facebookresearch\/HolisticTraceAnalysis\/blob\/main\/README.md) in the root directory of the repository.","__index_level_0__":45} +{"text":"#### Q. Is there any documentation on the features and API in HTA?","__index_level_0__":46} +{"text":"The documentation and detailed API is available [here](https:\/\/hta.readthedocs.io\/).","__index_level_0__":47} +{"text":"#### Q. Can you implement feature X?","__index_level_0__":48} +{"text":"Depending on how widely the feature is needed and the level of effort required to implement it we would consider developing the feature. Please open a [Github Issue](https:\/\/github.com\/facebookresearch\/HolisticTraceAnalysis\/issues) and tag it with the feature-request label.","__index_level_0__":49} +{"text":"#### Q. Can I modify the code?","__index_level_0__":50} +{"text":"Please do and [send a PR](https:\/\/github.com\/facebookresearch\/HolisticTraceAnalysis\/pulls) along the way, if you think it would be useful for others.","__index_level_0__":51} +{"text":"#### Q. How can I collect traces in PyTorch?","__index_level_0__":52} +{"text":"Please refer to this tutorial [here](https:\/\/pytorch.org\/tutorials\/intermediate\/tensorboard_profiler_tutorial.html#use-profiler-to-record-execution-events).","__index_level_0__":53} +{"text":"#### Q. Can HTA be used at production scale?","__index_level_0__":54} +{"text":"Yes, please see a use case study [here](https:\/\/pytorch.org\/blog\/performance-debugging-of-production-pytorch-models-at-meta\/).\n \n source: https:\/\/pytorch.org\/blog\/trace-analysis-for-masses\/ \n category: pytorch blogs","__index_level_0__":55} +{"text":"text: ---\nlayout: blog_detail\ntitle: 'PyTorch adds new dev tools as it hits production scale'\nauthor: The PyTorch Team\n---","__index_level_0__":56} +{"text":"_This is a partial re-post of the original blog post on the Facebook AI Blog. The full post can be [viewed here](https:\/\/ai.facebook.com\/blog\/pytorch-adds-new-dev-tools-as-it-hits-production-scale\/)_","__index_level_0__":57} +{"text":"Since its release just a few months ago, [PyTorch 1.0](http:\/\/pytorch.org\/) has been rapidly adopted as a powerful, flexible deep learning platform that enables engineers and researchers to move quickly from research to production. We are highlighting some of the ways the AI engineering and research community is using PyTorch 1.0. We\u2019re also sharing new details about the latest release, PyTorch 1.1, and showcasing some of the new development tools created by the community.","__index_level_0__":58} +{"text":"Building on the initial launch of PyTorch in 2017, we partnered with the AI community to ship the stable release of PyTorch 1.0 [last December](https:\/\/code.fb.com\/ai-research\/pytorch-developer-ecosystem-expands-1-0-stable-release\/). Along with enhanced production-oriented capabilities and deep integration with leading cloud platforms, PyTorch 1.0 expands on the open source library\u2019s core features, with the addition of PyTorch JIT (Just in time compilation) that seamlessly transitions between eager mode and graph mode to provide both flexibility and speed.","__index_level_0__":59} +{"text":"Leading businesses across industries are beginning to use PyTorch to both facilitate their research and then also deploy at large scale for applications such as translation, computer vision, conversational interfaces, pharmaceutical research, factory optimization, and automated driving research. Community adoption of PyTorch has also continued to expand. Stanford, UC Berkeley, Caltech, and other universities are using PyTorch as a fundamental tool for their machine learning (ML) courses; new ecosystem projects have launched to support development on PyTorch; and major cloud platforms have expanded their integration with PyTorch.","__index_level_0__":60} +{"text":"## Using PyTorch across industries","__index_level_0__":61} +{"text":"Many leading businesses are moving to PyTorch 1.0 to accelerate development and deployment of new AI systems. Here are some examples:","__index_level_0__":62} +{"text":"- Airbnb leveraged PyTorch's rich libraries and APIs for conversational AI and deployed a Smart Reply to help the company\u2019s service agents respond more effectively to customers.\n- [ATOM](https:\/\/atomscience.org\/) is building a platform to generate and optimize new drug candidates significantly faster and with greater success than conventional processes. Using machine learning frameworks such as PyTorch, ATOM was able to design a variational autoencoder for representing diverse chemical structures and designing new drug candidates.\n- Genentech is utilizing PyTorch\u2019s flexible control structures and dynamic graphs to train deep learning models that will aid in the development of individualized cancer therapy.\n- Microsoft is using PyTorch across its organization to develop ML models at scale and deploy them via the ONNX Runtime. Using PyTorch, Microsoft Cognition has built distributed language models that scale to billions of words and are now in production in offerings such as Cognitive Services.\n- Toyota Research Institute (TRI) is developing a two-pronged approach toward automated driving with Toyota Guardian and Toyota Chauffeur technologies. The Machine Learning Team at TRI is creating new deep learning algorithms to leverage Toyota's 10 million sales per year data advantage. The flexibility of PyTorch has vastly accelerated their pace of exploration and its new production features will enable faster deployment towards their safety critical applications.","__index_level_0__":63} +{"text":"Following the release of PyTorch 1.0 in December 2018, we\u2019re now announcing the availability of v1.1, which improves performance, adds new model understanding and visualization tools to improve usability, and provides new APIs.","__index_level_0__":64} +{"text":"Key features of PyTorch v1.1 include:","__index_level_0__":65} +{"text":"- [TensorBoard](https:\/\/www.tensorflow.org\/tensorboard): First-class and native support for visualization and model debugging with TensorBoard, a web application suite for inspecting and understanding training runs and graphs. PyTorch now natively supports TensorBoard with a simple \u201cfrom torch.utils.tensorboard import SummaryWriter\u201d command.\n- JIT compiler: Improvements to just-in-time (JIT) compilation. These include various bug fixes as well as expanded capabilities in TorchScript, such as support for dictionaries, user classes, and attributes.\n- New APIs: Support for Boolean tensors and better support for custom recurrent neural networks.\n- Distributed Training: Improved performance for common models such as CNNs, added support for multi device modules including the ability to split models across GPUs while still using Distributed Data Parallel (DDP) and support for modules where not all parameters are used in every iteration (e.g. control flow, like adaptive softmax, etc). See the latest tutorials [here](https:\/\/pytorch.org\/tutorials\/intermediate\/model_parallel_tutorial.html).","__index_level_0__":66} +{"text":"We\u2019ve also continued to partner with the community to foster projects and tools aimed at supporting ML engineers for needs ranging from improved model understanding to auto-tuning using AutoML methods. With the release of Ax and BoTorch (below), we will be sharing some of our core algorithms, including meta-learning for efficiently optimizing hyperparameters from based on historical tasks. We are excited to see this work open-sourced for the community to build on.","__index_level_0__":67} +{"text":"This ecosystem includes open source projects and tools that have been deployed at production scale, as well as products and services from our partnership with industry leaders who share our vision of an open and collaborative AI community. Here are a few of the latest tools:","__index_level_0__":68} +{"text":"- [BoTorch](https:\/\/ai.facebook.com\/blog\/open-sourcing-ax-and-botorch-new-ai-tools-for-adaptive-experimentation\/): BoTorch is a research framework built on top of PyTorch to provide Bayesian optimization, a sample-efficient technique for sequential optimization of costly-to-evaluate black-box functions.\n- [Ax](https:\/\/ai.facebook.com\/blog\/open-sourcing-ax-and-botorch-new-ai-tools-for-adaptive-experimentation\/): Ax is an ML platform for managing adaptive experiments. It enables researchers and engineers to systematically explore large configuration spaces in order to optimize machine learning models, infrastructure, and products.\n- [PyTorch-BigGraph](https:\/\/ai.facebook.com\/blog\/open-sourcing-pytorch-biggraph-for-faster-embeddings-of-extremely-large-graphs\/): PBG is a distributed system for creating embeddings of very large graphs with billions of entities and trillions of edges. It includes support for sharding and negative sampling and it offers sample use cases based on Wikidata embeddings.\n- [Google AI Platform Notebooks](https:\/\/cloud.google.com\/ai-platform-notebooks\/): AI Platform Notebooks is a new, hosted JupyterLab service from Google Cloud Platform. Data scientists can quickly create virtual machines running JupyterLab with the latest version of PyTorch preinstalled. It is also tightly integrated with GCP services such as BigQuery, Cloud Dataproc, Cloud Dataflow, and AI Factory, making it easy to execute the full ML cycle without ever leaving JupyterLab.","__index_level_0__":69} +{"text":"We\u2019re also excited to see many interesting new projects from the broader PyTorch community. Highlights include:","__index_level_0__":70} +{"text":"- [BigGAN-PyTorch](https:\/\/github.com\/ajbrock\/BigGAN-PyTorch):This is a full PyTorch reimplementation that uses gradient accumulation to provide the benefits of big batches on as few as four GPUs.\n- [GeomLoss](http:\/\/www.kernel-operations.io\/geomloss\/index.html): A Python API that defines PyTorch layers for geometric loss functions between sampled measures, images, and volumes. It includes MMD, Wasserstein, Sinkhorn, and more.","__index_level_0__":71} +{"text":"
\n \n<\/p>","__index_level_0__":84}
+{"text":"## Metal Acceleration","__index_level_0__":85}
+{"text":"Accelerated GPU training is enabled using Apple\u2019s Metal Performance Shaders (MPS) as a backend for PyTorch. The MPS backend extends the PyTorch framework, providing scripts and capabilities to set up and run operations on Mac. MPS optimizes compute performance with kernels that are fine-tuned for the unique characteristics of each Metal GPU family. The new device maps machine learning computational graphs and primitives on the MPS Graph framework and tuned kernels provided by MPS. ","__index_level_0__":86}
+{"text":"## Training Benefits on Apple Silicon","__index_level_0__":87}
+{"text":"Every Apple silicon Mac has a unified memory architecture, providing the GPU with direct access to the full memory store. This makes Mac a great platform for machine learning, enabling users to train larger networks or batch sizes locally. This reduces costs associated with cloud-based development or the need for additional local GPUs. The Unified Memory architecture also reduces data retrieval latency, improving end-to-end performance. ","__index_level_0__":88}
+{"text":"In the graphs below, you can see the performance speedup from accelerated GPU training and evaluation compared to the CPU baseline:","__index_level_0__":89}
+{"text":"
\n \n<\/p>","__index_level_0__":90}
+{"text":"
\nAccelerated GPU training and evaluation speedups over CPU-only (times faster)\n<\/p>","__index_level_0__":91} +{"text":"\n## Getting Started","__index_level_0__":92} +{"text":"To get started, just install the latest [Preview (Nightly) build](https:\/\/pytorch.org\/get-started\/locally\/) on your Apple silicon Mac running macOS 12.3 or later with a native version (arm64) of Python.\n \nYou can also learn more about Metal and MPS on [Apple\u2019s Metal page](https:\/\/developer.apple.com\/metal\/).","__index_level_0__":93} +{"text":"\\* _Testing conducted by Apple in April 2022 using production Mac Studio systems with Apple M1 Ultra, 20-core CPU, 64-core GPU 128GB of RAM, and 2TB SSD. Tested with macOS Monterey 12.3, prerelease PyTorch 1.12, ResNet50 (batch size=128), HuggingFace BERT (batch size=64), and VGG16 (batch size=64). Performance tests are conducted using specific computer systems and reflect the approximate performance of Mac Studio._\n \n source: https:\/\/pytorch.org\/blog\/introducing-accelerated-pytorch-training-on-mac\/ \n category: pytorch blogs","__index_level_0__":94} +{"text":"text: ---\nlayout: blog_detail\ntitle: \"Accelerating Hugging Face and TIMM models with PyTorch 2.0\"\nauthor: Mark Saroufim\nfeatured-img: \"assets\/images\/pytorch-2.0-feature-img.png\"\n---","__index_level_0__":95} +{"text":"`torch.compile()` makes it easy to experiment with different compiler backends to make PyTorch code faster with a single line decorator `torch.compile()`. It works either directly over an nn.Module as a drop-in replacement for `torch.jit.script()` but without requiring you to make any source code changes. We expect this one line code change to provide you with between 30%-2x training time speedups on the vast majority of models that you\u2019re already running.","__index_level_0__":96} +{"text":"opt_module = torch.compile(module)","__index_level_0__":98} +{"text":"torch.compile supports arbitrary PyTorch code, control flow, mutation and comes with experimental support for dynamic shapes. We\u2019re so excited about this development that we call it PyTorch 2.0.","__index_level_0__":100} +{"text":"What makes this announcement different for us is we\u2019ve already benchmarked some of the most popular open source PyTorch models and gotten substantial speedups ranging from 30% to 2x [https:\/\/github.com\/pytorch\/torchdynamo\/issues\/681](https:\/\/github.com\/pytorch\/torchdynamo\/issues\/681).","__index_level_0__":101} +{"text":"There are no tricks here, we\u2019ve pip installed popular libraries like [https:\/\/github.com\/huggingface\/transformers](https:\/\/github.com\/huggingface\/transformers), [https:\/\/github.com\/huggingface\/accelerate](https:\/\/github.com\/huggingface\/accelerate) and [https:\/\/github.com\/rwightman\/pytorch-image-models](https:\/\/github.com\/rwightman\/pytorch-image-models) and then ran torch.compile() on them and that\u2019s it.","__index_level_0__":102} +{"text":"It\u2019s rare to get both performance and convenience, but this is why the core team finds PyTorch 2.0 so exciting. The Hugging Face team is also excited, in their words:","__index_level_0__":103} +{"text":"Ross Wightman the primary maintainer of TIMM: \u201cPT 2.0 works out of the box with majority of timm models for inference and train workloads and no code changes\u201d","__index_level_0__":104} +{"text":"Sylvain Gugger the primary maintainer of transformers and accelerate: \"With just one line of code to add, PyTorch 2.0 gives a speedup between 1.5x and 2.x in training Transformers models. This is the most exciting thing since mixed precision training was introduced!\"","__index_level_0__":105} +{"text":"This tutorial will show you exactly how to replicate those speedups so you can be as excited as to PyTorch 2.0 as we are.","__index_level_0__":106} +{"text":"## Requirements and Setup","__index_level_0__":107} +{"text":"For GPU (newer generation GPUs will see drastically better performance)","__index_level_0__":108} +{"text":"```\npip3 install numpy --pre torch --force-reinstall --extra-index-url https:\/\/download.pytorch.org\/whl\/nightly\/cu117","__index_level_0__":109} +{"text":"```\npip3 install --pre torch --extra-index-url https:\/\/download.pytorch.org\/whl\/nightly\/cpu","__index_level_0__":112} +{"text":"Optional: Verify Installation","__index_level_0__":114} +{"text":"```\ngit clone https:\/\/github.com\/pytorch\/pytorch\ncd tools\/dynamo\npython verify_dynamo.py\n```","__index_level_0__":115} +{"text":"Optional: Docker installation","__index_level_0__":116} +{"text":"We also provide all the required dependencies in the PyTorch nightly\nbinaries which you can download with","__index_level_0__":117} +{"text":"```\ndocker pull ghcr.io\/pytorch\/pytorch-nightly","__index_level_0__":118} +{"text":"And for ad hoc experiments just make sure that your container has access\nto all your GPUs","__index_level_0__":120} +{"text":"```\ndocker run --gpus all -it ghcr.io\/pytorch\/pytorch-nightly:latest \/bin\/bash","__index_level_0__":121} +{"text":"## Getting started","__index_level_0__":123} +{"text":"### a toy exmaple","__index_level_0__":124} +{"text":"Let\u2019s start with a simple example and make things more complicated step\nby step. Please note that you\u2019re likely to see more significant speedups the newer your GPU is.","__index_level_0__":125} +{"text":"```python\nimport torch\ndef fn(x, y):\n a = torch.sin(x).cuda()\n b = torch.sin(y).cuda()\n return a + b\nnew_fn = torch.compile(fn, backend=\"inductor\")\ninput_tensor = torch.randn(10000).to(device=\"cuda:0\")\na = new_fn(input_tensor, input_tensor)\n```","__index_level_0__":126} +{"text":"This example won\u2019t actually run faster but it\u2019s educational.","__index_level_0__":127} +{"text":"example that features `torch.cos()` and `torch.sin()` which are examples of pointwise ops as in they operate element by element on a vector. A more famous pointwise op you might actually want to use would be something like `torch.relu()`.","__index_level_0__":128} +{"text":"Pointwise ops in eager mode are suboptimal because each one would need to read a tensor from memory, make some changes and then write back those changes.","__index_level_0__":129} +{"text":"The single most important optimization that PyTorch 2.0 does for you is fusion.","__index_level_0__":130} +{"text":"So back to our example we can turn 2 reads and 2 writes into 1 read and 1 write which is crucial especially for newer GPUs where the bottleneck is memory bandwidth (how quickly you can send data to a GPU) instead of compute (how quickly your GPU can crunch floating point operations)","__index_level_0__":131} +{"text":"The second most important optimization that PyTorch 2.0 does for you is CUDA graphs","__index_level_0__":132} +{"text":"CUDA graphs help eliminate the overhead from launching individual kernels from a python program.","__index_level_0__":133} +{"text":"torch.compile() supports many different backends but one that we\u2019re particularly excited about is Inductor which generates Triton kernels [https:\/\/github.com\/openai\/triton](https:\/\/github.com\/openai\/triton) which are written in Python yet outperform the vast majority of handwritten CUDA kernels. Suppose our example above was called trig.py we can actually inspect the code generated triton kernels by running.","__index_level_0__":134} +{"text":"```\nTORCH_COMPILE_DEBUG=1 python trig.py\n```","__index_level_0__":135} +{"text":"@pointwise(size_hints=[16384], filename=__file__, meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': 0, 'constants': {}, 'configs': [instance_descriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]})\n@triton.jit\ndef kernel(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 10000\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.reshape(tl.arange(0, XBLOCK), [XBLOCK])\n xmask = xindex < xnumel\n x0 = xindex\n tmp0 = tl.load(in_ptr0 + (x0), xmask)\n tmp1 = tl.sin(tmp0)\n tmp2 = tl.sin(tmp1)\n tl.store(out_ptr0 + (x0 + tl.zeros([XBLOCK], tl.int32)), tmp2, xmask)","__index_level_0__":137} +{"text":"And you can verify that fusing the two `sins` did actually occur because the two `sin` operations occur within a single Triton kernel and the temporary variables are held in registers with very fast access.","__index_level_0__":139} +{"text":"### a real model","__index_level_0__":140} +{"text":"As a next step let\u2019s try a real model like resnet50 from the PyTorch hub.","__index_level_0__":141} +{"text":"```python\nimport torch\nmodel = torch.hub.load('pytorch\/vision:v0.10.0', 'resnet18', pretrained=True)\nopt_model = torch.compile(model, backend=\"inductor\")\nmodel(torch.randn(1,3,64,64))","__index_level_0__":142} +{"text":"If you actually run you may be surprised that the first run is slow and that\u2019s because the model is being compiled. Subsequent runs will be faster so it's common practice to warm up your model before you start benchmarking it.","__index_level_0__":144} +{"text":"You may have noticed how we also passed in the name of a compiler explicitly here with \u201cinductor\u201d but it\u2019s not the only available backend, you can run in a REPL `torch._dynamo.list_backends()` to see the full list of available backends. For fun you should try out `aot_cudagraphs` or `nvfuser`.","__index_level_0__":145} +{"text":"### Hugging Face models","__index_level_0__":146} +{"text":"Let\u2019s do something a bit more interesting now, our community frequently\nuses pretrained models from transformers [https:\/\/github.com\/huggingface\/transformers](https:\/\/github.com\/huggingface\/transformers) or TIMM [https:\/\/github.com\/rwightman\/pytorch-image-models](https:\/\/github.com\/rwightman\/pytorch-image-models) and one of our design goals for PyTorch 2.0 was that any new compiler stack needs to work out of the box with the vast majority of models people actually run.","__index_level_0__":147} +{"text":"So we\u2019re going to directly download a pretrained model from the Hugging Face hub and optimize it","__index_level_0__":148} +{"text":"import torch\nfrom transformers import BertTokenizer, BertModel\n# Copy pasted from here https:\/\/huggingface.co\/bert-base-uncased\ntokenizer = BertTokenizer.from_pretrained('bert-base-uncased')\nmodel = BertModel.from_pretrained(\"bert-base-uncased\").to(device=\"cuda:0\")\nmodel = torch.compile(model) # This is the only line of code that we changed\ntext = \"Replace me by any text you'd like.\"\nencoded_input = tokenizer(text, return_tensors='pt').to(device=\"cuda:0\")\noutput = model(**encoded_input)","__index_level_0__":150} +{"text":"If you remove the `to(device=\"cuda:0\")` from the model and `encoded_input` then PyTorch 2.0 will generate C++ kernels that will be optimized for running on your CPU. You can inspect both Triton or C++ kernels for BERT, they\u2019re obviously more complex than the trigonometry example we had above but you can similarly skim it and understand if you understand PyTorch.","__index_level_0__":152} +{"text":"The same code also works just fine if used with [https:\/\/github.com\/huggingface\/accelerate](https:\/\/github.com\/huggingface\/accelerate) and DDP","__index_level_0__":153} +{"text":"Similarly let\u2019s try out a TIMM example","__index_level_0__":154} +{"text":"```python\nimport timm\nimport torch\nmodel = timm.create_model('resnext101_32x8d', pretrained=True, num_classes=2)\nopt_model = torch.compile(model, backend=\"inductor\")\nopt_model(torch.randn(64,3,7,7))\n```","__index_level_0__":155} +{"text":"Our goal with PyTorch was to build a breadth-first compiler that would speed up the vast majority of actual models people run in open source. The Hugging Face Hub ended up being an extremely valuable benchmarking tool for us, ensuring that any optimization we work on actually helps accelerate models people want to run.","__index_level_0__":156} +{"text":"So please try out PyTorch 2.0, enjoy the free perf and if you\u2019re not seeing it then please open an issue and we will make sure your model is supported [https:\/\/github.com\/pytorch\/torchdynamo\/issues](https:\/\/github.com\/pytorch\/torchdynamo\/issues)","__index_level_0__":157} +{"text":"After all, we can\u2019t claim we\u2019re created a breadth-first unless YOUR models actually run faster.\n \n source: https:\/\/pytorch.org\/blog\/Accelerating-Hugging-Face-and-TIMM-models\/ \n category: pytorch blogs","__index_level_0__":158} +{"text":"text: ---\nlayout: blog_detail\ntitle: 'PyTorch 1.6 now includes Stochastic Weight Averaging'\nauthor: Pavel Izmailov, Andrew Gordon Wilson and Vincent Queneneville-Belair\n---","__index_level_0__":159} +{"text":"Do you use stochastic gradient descent (SGD) or Adam? Regardless of the procedure you use to train your neural network, you can likely achieve significantly better generalization at virtually no additional cost with a simple new technique now natively supported in PyTorch 1.6, Stochastic Weight Averaging (SWA) [1]. Even if you have already trained your model, it\u2019s easy to realize the benefits of SWA by running SWA for a small number of epochs starting with a pre-trained model. [Again](https:\/\/twitter.com\/MilesCranmer\/status\/1282140440892932096) and [again](https:\/\/twitter.com\/leopd\/status\/1285969855062192129), researchers are discovering that SWA improves the performance of well-tuned models in a wide array of practical applications with little cost or effort!","__index_level_0__":160} +{"text":"\nSWA has a wide range of applications and features:\n* SWA significantly improves performance compared to standard training techniques in computer vision (e.g., VGG, ResNets, Wide ResNets and DenseNets on ImageNet and CIFAR benchmarks [1, 2]).\n* SWA provides state-of-the-art performance on key benchmarks in semi-supervised learning and domain adaptation [2].\n* SWA was shown to improve performance in language modeling (e.g., AWD-LSTM on WikiText-2 [4]) and policy-gradient methods in deep reinforcement learning [3].\n* SWAG, an extension of SWA, can approximate Bayesian model averaging in Bayesian deep learning and achieves state-of-the-art uncertainty calibration results in various settings. Moreover, its recent generalization MultiSWAG provides significant additional performance gains and mitigates double-descent [4, 10]. Another approach, Subspace Inference, approximates the Bayesian posterior in a small subspace of the parameter space around the SWA solution [5].\n* SWA for low precision training, SWALP, can match the performance of full-precision SGD training, even with all numbers quantized down to 8 bits, including gradient accumulators [6].\n* SWA in parallel, SWAP, was shown to greatly speed up the training of neural networks by using large batch sizes and, in particular, set a record by training a neural network to 94% accuracy on CIFAR-10 in 27 seconds [11].","__index_level_0__":161} +{"text":"\n
\n \n<\/p>","__index_level_0__":252}
+{"text":"Emformer is an efficient memory-transformer-based streaming acoustic model that has demonstrated state-of-the-art streaming automatic speech recognition (ASR) performance in low-latency, resource-constrained scenarios, such as on-device applications (citation: [https:\/\/arxiv.org\/abs\/2010.10759](https:\/\/arxiv.org\/abs\/2010.10759)).","__index_level_0__":253}
+{"text":"The TorchAudio v0.11 release includes the following beta features:","__index_level_0__":254}
+{"text":"- Implementation of Emformer ([docs](https:\/\/pytorch.org\/audio\/main\/models.html#emformer))\n- Recurrent neural network transducer (RNN-T) streaming ASR model that uses Emformer for its transcription network ([docs](https:\/\/pytorch.org\/audio\/main\/models.html#rnn-t))\n- RNN-T beam search decoder with TorchScript support ([docs](https:\/\/pytorch.org\/audio\/main\/models.html#rnntbeamsearch))\n- LibriSpeech Emformer RNN-T training recipe ([GitHub](https:\/\/github.com\/pytorch\/audio\/tree\/release\/0.11\/examples\/asr\/librispeech_emformer_rnnt)) and corresponding pre-trained streaming ASR inference pipeline ([docs](https:\/\/pytorch.org\/audio\/main\/pipelines.html#emformer-rnnt-base-librispeech))","__index_level_0__":255}
+{"text":"Also there are prototype features that are available from nightly builds or the main branch.","__index_level_0__":256}
+{"text":"- Training recipes trained on MuST-C and TED-LIUM3 datasets. ([GitHub](https:\/\/github.com\/pytorch\/audio\/tree\/main\/examples\/asr\/emformer_rnnt))\n- Pre-trained pipelines corresponding to the recipes. ([docs](https:\/\/pytorch.org\/audio\/main\/prototype.pipelines.html))\n- Tutorial that steps through performing online speech recognition with RNN-T Emformer model. ([docs](https:\/\/pytorch.org\/audio\/main\/tutorials\/online_asr_tutorial.html))","__index_level_0__":257}
+{"text":"Collectively, these features cover the full development lifecycle of a streaming ASR model, from definition through training and inference, and enable users to easily develop their own Emformer- and RNN-T-based models.","__index_level_0__":258}
+{"text":"Special thanks to Yangyang Shi, Jay Mahadeokar, and Gil Keren for their code contributions and guidance.","__index_level_0__":259}
+{"text":"#### (Beta) HuBERT Pretrain Model","__index_level_0__":260}
+{"text":"The masked prediction training of HuBERT model requires the masked logits, unmasked logits, and feature norm as the outputs. The logits are for cross-entropy losses and the feature norm is for penalty loss. The release adds [HuBERTPretrainModel](https:\/\/github.com\/pytorch\/audio\/blob\/main\/torchaudio\/models\/wav2vec2\/model.py#L120-L205) and corresponding factory functions ([hubert_pretrain_base](https:\/\/github.com\/pytorch\/audio\/blob\/main\/torchaudio\/models\/wav2vec2\/model.py#L964-L1027), [hubert_pretrain_large](https:\/\/github.com\/pytorch\/audio\/blob\/main\/torchaudio\/models\/wav2vec2\/model.py#L1030-L1090), and [hubert_pretrain_xlarge](https:\/\/github.com\/pytorch\/audio\/blob\/main\/torchaudio\/models\/wav2vec2\/model.py#L1093-L1153)) to enable training from scratch.","__index_level_0__":261}
+{"text":"#### (Prototype) CTC Beam Search Decoder","__index_level_0__":262}
+{"text":"In recent releases, TorchAudio has added support for ASR models fine-tuned on CTC loss. The addition of an inference time CTC beam search decoder enables running end-to-end ASR evaluation using TorchAudio utils.","__index_level_0__":263}
+{"text":"The CTC decoder in TorchAudio supports customizable beam search decoding with lexicon constraint. It also has optional KenLM language model support.","__index_level_0__":264}
+{"text":"For more details, please check out the [API tutorial](https:\/\/pytorch.org\/audio\/main\/tutorials\/asr_inference_with_ctc_decoder_tutorial.html) and [documentation](https:\/\/pytorch.org\/audio\/main\/prototype.ctc_decoder.html). This prototype feature is available through nightly builds.","__index_level_0__":265}
+{"text":"#### (Prototype) Streaming API","__index_level_0__":266}
+{"text":"TorchAudio started as simple audio I\/O APIs that supplement PyTorch. With the recent addition of ASR models and training recipes, the project has received requests to support high-level application development.","__index_level_0__":267}
+{"text":"Streaming API makes it easy to develop and test the model in online inference. It utilizes ffmpeg under the hood, and enables reading media from online services and hardware devices, decoding media in an incremental manner, and applying filters and preprocessing.","__index_level_0__":268}
+{"text":"Please checkout the [API tutorial](https:\/\/pytorch.org\/audio\/main\/tutorials\/streaming_api_tutorial.html) and [the documentation](https:\/\/pytorch.org\/audio\/main\/prototype.io.html). There are also the [streaming ASR](https:\/\/pytorch.org\/audio\/main\/tutorials\/online_asr_tutorial.html) tutorial and the [device streaming ASR tutorial](https:\/\/pytorch.org\/audio\/main\/tutorials\/device_asr.html). This feature is available from nightly releases. Please refer to [pytorch.org](https:\/\/pytorch.org\/get-started\/locally\/) for how to install nightly builds.","__index_level_0__":269}
+{"text":"## TorchText 0.12","__index_level_0__":270}
+{"text":"#### (Beta) RoBERTa and XLM-R Models","__index_level_0__":271}
+{"text":"TorchText has added support for pre-trained RoBERTa and XLM-R models. It would allow users to train end-2-end Transformer Encoder based models on standard NLP tasks using TorchText.","__index_level_0__":272}
+{"text":"More specifically:","__index_level_0__":273}
+{"text":"- The models are torchscriptable and hence can be employed for production use-cases.\n- The model APIs let users to easily attach custom task-specific heads with pre-trained encoders.\n- The API also comes equipped with data pre-processing transforms to match the pre-trained weights and model configuration.","__index_level_0__":274}
+{"text":"We have added a [tutorial](https:\/\/pytorch.org\/text\/main\/tutorials\/sst2_classification_non_distributed.html) to demonstrate SST-2 binary text classification task with pre-trained XLM-R base architecture.","__index_level_0__":275}
+{"text":"For additional details on model APIs and usage examples, please refer to the [documentation](https:\/\/pytorch.org\/text\/main\/models.html).","__index_level_0__":276}
+{"text":"#### (Beta) byte-level BPE tokenizer","__index_level_0__":277}
+{"text":"TorchText has added support for a Byte-Level BPE tokenizer, as used in GPT-2. This tokenizer is also used for tokenizing inputs to the pre-trained RoBERTa models described previously. In addition to the RoBERTa vocab, users can also load their own custom BPE vocab to use the tokenizer. Furthermore, the tokenizer is fully torchscriptable and hence can be employed for production use-cases. For additional details on model APIs and usage examples, please refer to the [documentation](https:\/\/pytorch.org\/text\/main\/transforms.html#gpt2bpetokenizer).","__index_level_0__":278}
+{"text":"#### (Beta) Text datasets backed by TorchData","__index_level_0__":279}
+{"text":"TorchText has modernized its datasets by migrating from older-style Iterable Datasets to [TorchData\u2019s](https:\/\/github.com\/pytorch\/data#readme) DataPipes. TorchData is a library that provides modular\/composable primitives, allowing users to load and transform data in performant data pipelines.","__index_level_0__":280}
+{"text":"These DataPipes work out-of-the-box with PyTorch DataLoader and would enable new functionalities like auto-sharding. Users can now easily do data manipulation and pre-processing using user-defined functions and transformations in a functional style programming. Datasets backed by DataPipes also enable standard flow-control like batching, collation, shuffling and bucketizing.","__index_level_0__":281}
+{"text":"Collectively, DataPipes provides a comprehensive experience for data preprocessing and tensorization needs in a pythonic and flexible way for model training. We have added a [tutorial](https:\/\/pytorch.org\/text\/main\/tutorials\/sst2_classification_non_distributed.html) to demonstrate data-processing pipelining using the modernized dataset for binary text-classification.","__index_level_0__":282}
+{"text":"You can learn more about TorchData DataPipe APIs in its [official documentation](https:\/\/pytorch.org\/data).","__index_level_0__":283}
+{"text":"## TorchVision 0.12","__index_level_0__":284}
+{"text":"### New Models","__index_level_0__":285}
+{"text":"Four new model families have been released in the latest version along with pre-trained weights for their variants.","__index_level_0__":286}
+{"text":"#### #1 Object Detection","__index_level_0__":287}
+{"text":"[FCOS](https:\/\/arxiv.org\/pdf\/1904.01355.pdf) is a popular, fully convolutional, anchor-free model for object detection. In this release we include a community-contributed model implementation as well as pre-trained weights. The model was trained on COCO train2017 and can be used as follows:","__index_level_0__":288}
+{"text":"```python\nimport torch\nfrom torchvision import models","__index_level_0__":289}
+{"text":"x = [torch.rand(3, 224, 224)]\nfcos = models.detection.fcos_resnet50_fpn(pretrained=True).eval()\npredictions = fcos(x)\n```","__index_level_0__":290}
+{"text":"The box AP of the pre-trained model on COCO val2017 is 39.2 (see [#4961](https:\/\/github.com\/pytorch\/vision\/pull\/4961) for more details).","__index_level_0__":291}
+{"text":"We would like to thank [Hu Ye](https:\/\/github.com\/xiaohu2015) and [Zhiqiang Wang](https:\/\/github.com\/zhiqwang) for contributing to the model implementation and initial training. This was the first community-contributed model in a long while, and given its success, we decided to use the learnings from this process and create a new [model contribution guidelines](https:\/\/github.com\/pytorch\/vision\/blob\/main\/CONTRIBUTING_MODELS.md).","__index_level_0__":292}
+{"text":"#### #2 Optical Flow support and RAFT model","__index_level_0__":293}
+{"text":"TorchVision now supports optical flow! Optical Flow models try to predict movement in a video: given two consecutive frames, the model predicts where each pixel of the first frame ends up in the second frame. Check out our [new tutorial on Optical Flow](https:\/\/pytorch.org\/vision\/0.12\/auto_examples\/plot_optical_flow.html#sphx-glr-auto-examples-plot-optical-flow-py)!","__index_level_0__":294}
+{"text":"We implemented a torchscript-compatible [RAFT](https:\/\/arxiv.org\/abs\/2003.12039) model with pre-trained weights (both normal and \u201csmall\u201d versions), and added support for [training and evaluating](https:\/\/github.com\/pytorch\/vision\/tree\/main\/references\/optical_flow) optical flow models. Our training scripts support distributed training across processes and nodes, leading to much faster training time than the original implementation. We also added 5 new [optical flow datasets](https:\/\/pytorch.org\/vision\/0.12\/datasets.html#optical-flow): Flying Chairs, Flying Things, Sintel, Kitti, and HD1K.","__index_level_0__":295}
+{"text":"
\n \n<\/p>","__index_level_0__":296}
+{"text":"#### #3. Image Classification","__index_level_0__":297}
+{"text":"[Vision Transformer](https:\/\/arxiv.org\/abs\/2010.11929) (ViT) and [ConvNeXt](https:\/\/arxiv.org\/abs\/2201.03545) are two popular architectures which can be used as image classifiers or as backbones for downstream vision tasks. In this release we include 8 pre-trained weights for their classification variants. The models were trained on ImageNet and can be used as follows:","__index_level_0__":298}
+{"text":"```python\nimport torch\nfrom torchvision import models","__index_level_0__":299}
+{"text":"x = torch.rand(1, 3, 224, 224)\nvit = models.vit_b_16(pretrained=True).eval()\nconvnext = models.convnext_tiny(pretrained=True).eval()\npredictions1 = vit(x)\npredictions2 = convnext(x)\n```","__index_level_0__":300}
+{"text":"The accuracies of the pre-trained models obtained on ImageNet val are seen below:","__index_level_0__":301}
+{"text":"| **Model** | **Acc@1** | **Acc@5** |\n| -------------- | --------: | --------: |\n| vit_b_16 | 81.072 | 95.318 |\n| vit_b_32 | 75.912 | 92.466 |\n| vit_l_16 | 79.662 | 94.638 |\n| vit_l_32 | 76.972 | 93.07 |\n| convnext_tiny | 82.52 | 96.146 |\n| convnext_small | 83.616 | 96.65 |\n| convnext_base | 84.062 | 96.87 |\n| convnext_large | 84.414 | 96.976 |","__index_level_0__":302}
+{"text":"The above models have been trained using an adjusted version of our new [training recipe](https:\/\/pytorch.org\/blog\/how-to-train-state-of-the-art-models-using-torchvision-latest-primitives\/) and this allows us to offer models with accuracies significantly higher than the ones on the original papers.","__index_level_0__":303}
+{"text":"#### #4. GPU Video Decoding","__index_level_0__":304}
+{"text":"In this release, we add support for GPU video decoding in the video reading API. To use hardware-accelerated decoding, we just need to pass a cuda device to the video reading API as shown below:","__index_level_0__":305}
+{"text":"```python\nimport torchvision","__index_level_0__":306}
+{"text":"reader = torchvision.io.VideoReader(file_name, device=\"cuda:0\")\nfor frame in reader:\n print(frame)\n```","__index_level_0__":307}
+{"text":"We also support seeking to anyframe or a keyframe in the video before reading, as shown below:","__index_level_0__":308}
+{"text":"```python\nreader.seek(seek_time)\n```","__index_level_0__":309}
+{"text":"### New Datasets","__index_level_0__":310}
+{"text":"We have implemented 14 new [classification datasets](https:\/\/pytorch.org\/vision\/0.12\/datasets.html#image-classification): CLEVR, GTSRB, FER2013, SUN397, Country211, Flowers102, fvgc_aircraft, OxfordIIITPet, DTD, Food 101, Rendered SST2, Stanford cars, PCAM, and EuroSAT.","__index_level_0__":311}
+{"text":"As part of our work on Optical Flow support (see above for more details), we also added 5 new [optical flow datasets](https:\/\/pytorch.org\/vision\/0.12\/datasets.html#optical-flow): Flying Chairs, Flying Things, Sintel, Kitti, and HD1K.","__index_level_0__":312}
+{"text":"### Other Updates","__index_level_0__":313}
+{"text":"- **New documentation layout**: Each function \/ class is now documented in a separate page, clearing up some space in the per-module pages, and easing the discovery of the proposed APIs. Compare e.g. our [previous docs](https:\/\/pytorch.org\/vision\/0.11\/transforms.html) vs the [new ones](https:\/\/pytorch.org\/vision\/0.12\/transforms.html). Please let us know if you have any [feedback](https:\/\/github.com\/pytorch\/vision\/issues\/5511)!\n- **New [model contribution guidelines](https:\/\/github.com\/pytorch\/vision\/blob\/main\/CONTRIBUTING_MODELS.md)** have been published following the success of the [FCOS](https:\/\/github.com\/pytorch\/vision\/pull\/4961) model which was contributed by the community. These guidelines aim to be an overview of the model contribution process for anyone who would like to suggest, implement and train a new model.\n- **Upcoming Prototype API** - We are currently working on a prototype API which adds Multi-weight support on all of our model builder methods. This will enable us to offer multiple pre-trained weights, associated with their meta-data and inference transforms. The API is still under review and thus was not included in the release but you can read more about it on our [blogpost](https:\/\/pytorch.org\/blog\/introducing-torchvision-new-multi-weight-support-api\/) and provide your feedback on the dedicated [Github issue](https:\/\/github.com\/pytorch\/vision\/issues\/5088).\n- **Changes in our deprecation policy** - Up until now, torchvision would almost never remove deprecated APIs. In order to be more aligned and consistent with pytorch core, we are updating our deprecation policy. We are now following a 2-release deprecation cycle: deprecated APIs will raise a warning for 2 versions, and will be removed after that. To reflect these changes and to smooth the transition, we have decided to:\n - Remove all APIs that had been deprecated before or on v0.8, released 1.5 years ago.\n - Update the removal timeline of all other deprecated APIs to v0.14, to reflect the new 2-cycle policy starting now in v0.12.","__index_level_0__":314}
+{"text":"### Captum 0.5","__index_level_0__":315}
+{"text":"[Captum](https:\/\/captum.ai\/) is a PyTorch library for model interpretability. For this release, we expanded Captum with influential instances and added support for both similarity based influences and novel algorithms, [TracIn](https:\/\/arxiv.org\/abs\/2002.08484) and its variants. TracIn variants offer faster approximation of influence scores based on random projections for fully connected layers.","__index_level_0__":316}
+{"text":"More specifically the new, influence, subsection of Captum includes:","__index_level_0__":317}
+{"text":"- **[SimilarityInfluence](https:\/\/captum.ai\/api\/influence.html#similarityinfluence)** computes similarity scores between test and training examples using default (cosine or euclidean) or custom user definite metrics w.r.t. given input model layers.\n- **[TracInCP](https:\/\/captum.ai\/api\/influence.html#tracincp)** approximates the influential score of each training example on a given test example based on the dot-product similarity between loss gradients w.r.t. model parameters for test and training examples. Note that if we use training examples as test examples then we compute self influence. This method and its variants described below also return top-k proponents and opponents which are the top-k largest positive and negative influential examples respectively.\n- **[TracInCPFast](https:\/\/captum.ai\/api\/influence.html#tracincpfast)** is an approximation of TracInCP that avoids computing the gradients w.r.t. large parameter matrices. It approximates influence score based on the dot products between last fully connected layer activations and loss gradients w.r.t. that layer for training and test examples.\n- **[TracInCPFastRandProj](https:\/\/captum.ai\/api\/influence.html#tracincpfastrandproj)** uses a nearest neighbor approximation library such as annoy to compute the dot product between the training and test quantities. In order to reduce the dimensionality of layer activations and corresponding gradients this method, in addition, allows to project those vectors into a lower dimensional space using random projection matrices.","__index_level_0__":318}
+{"text":"More about the implementation of influential instances can be found on our [GitHub](https:\/\/github.com\/pytorch\/captum\/tree\/master\/captum\/influence) page and [tutorials](https:\/\/captum.ai\/tutorials\/TracInCP_Tutorial).","__index_level_0__":319}
+{"text":"Thanks for reading, If you\u2019re interested in these updates and want to join the PyTorch community, we encourage you to join the [discussion forums](https:\/\/discuss.pytorch.org\/) and [open GitHub issues](https:\/\/github.com\/pytorch\/pytorch\/issues). To get the latest news from PyTorch, follow us on [Twitter](https:\/\/twitter.com\/PyTorch), [Medium](https:\/\/medium.com\/pytorch), [YouTube](https:\/\/www.youtube.com\/pytorch), and [LinkedIn](https:\/\/www.linkedin.com\/company\/pytorch).","__index_level_0__":320}
+{"text":"Team PyTorch","__index_level_0__":322}
+{"text":"