From bc10cdf22c9e4c9912bb397b030b13ed35735abb Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Thu, 16 Mar 2023 09:51:50 -0700 Subject: [PATCH 1/6] Update what's new with 2.0 tutorials --- index.rst | 13 +++++++++---- .../scaled_dot_product_attention_tutorial.py | 9 +++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/index.rst b/index.rst index 71fcb717403..4fbc574b2f9 100644 --- a/index.rst +++ b/index.rst @@ -3,10 +3,15 @@ Welcome to PyTorch Tutorials What's new in PyTorch tutorials? -* `PyTorch Distributed Series `__ -* `Fast Transformer Inference with Better Transformer `__ -* `Advanced model training with Fully Sharded Data Parallel (FSDP) `__ -* `Grokking PyTorch Intel CPU Performance from First Principles `__ +* `Implementing High Performance Transformers with Scaled Dot Product Attention `__ +* `torch.compile Tutorial `__ +* `Per Sample Gradients `__ +* `Jacobians, Hessians, hvp, vhp, and more: composing function transforms `__ +* `Model Ensembling `__ +* `Neural Tangent Kernels `__ +* `Reinforcement Learning (PPO) with TorchRL Tutorial `__ +* `Changing Default Device `__ + .. raw:: html diff --git a/intermediate_source/scaled_dot_product_attention_tutorial.py b/intermediate_source/scaled_dot_product_attention_tutorial.py index c5f84308f42..80a7bcd2f04 100644 --- a/intermediate_source/scaled_dot_product_attention_tutorial.py +++ b/intermediate_source/scaled_dot_product_attention_tutorial.py @@ -1,9 +1,10 @@ """ -Implementing High-Performance Transformers with SCALED DOT PRODUCT ATTENTION -================================================================================ +(Beta) Implementing High-Performance Transformers with Scaled Dot Production Attention (SDPA) +============================================================================================= -""" +**Author:** `Driss Guessous `_ +""" ###################################################################### # Summary @@ -334,4 +335,4 @@ def generate_rand_batch( # compilable. In the process we have shown how to the profiling tools can # be used to explore the performance characteristics of a user defined # module. -# \ No newline at end of file +# From 98d5ce1c97a40ee47608fff8942d86045ca4a676 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Thu, 16 Mar 2023 11:33:09 -0700 Subject: [PATCH 2/6] Add notes on running in colab to the SDPA tutorial --- intermediate_source/scaled_dot_product_attention_tutorial.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/intermediate_source/scaled_dot_product_attention_tutorial.py b/intermediate_source/scaled_dot_product_attention_tutorial.py index 80a7bcd2f04..0c8b4b2518f 100644 --- a/intermediate_source/scaled_dot_product_attention_tutorial.py +++ b/intermediate_source/scaled_dot_product_attention_tutorial.py @@ -1,6 +1,6 @@ """ -(Beta) Implementing High-Performance Transformers with Scaled Dot Production Attention (SDPA) -============================================================================================= +(Beta) Implementing High-Performance Transformers with Scaled Dot Product Attention (SDPA) +========================================================================================== **Author:** `Driss Guessous `_ @@ -35,6 +35,7 @@ # * `Memory-Efficient Attention `__ # * A PyTorch implementation defined in C++ # +# .. include:: ../beginner_source/new-release-colab.rst import torch import torch.nn as nn From bdb8b78fbeacc06c1014cc4c5507019954fdd775 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Thu, 16 Mar 2023 12:43:08 -0700 Subject: [PATCH 3/6] Change to literalinclude --- intermediate_source/scaled_dot_product_attention_tutorial.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intermediate_source/scaled_dot_product_attention_tutorial.py b/intermediate_source/scaled_dot_product_attention_tutorial.py index 0c8b4b2518f..61ee1c94b25 100644 --- a/intermediate_source/scaled_dot_product_attention_tutorial.py +++ b/intermediate_source/scaled_dot_product_attention_tutorial.py @@ -35,7 +35,7 @@ # * `Memory-Efficient Attention `__ # * A PyTorch implementation defined in C++ # -# .. include:: ../beginner_source/new-release-colab.rst +# .. literalinclude:: ../beginner_source/new-release-colab.rst import torch import torch.nn as nn From a3746b99dc731d5188c2bcd3469e5ba11c35f265 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Thu, 16 Mar 2023 12:57:33 -0700 Subject: [PATCH 4/6] Fix --- intermediate_source/scaled_dot_product_attention_tutorial.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/intermediate_source/scaled_dot_product_attention_tutorial.py b/intermediate_source/scaled_dot_product_attention_tutorial.py index 61ee1c94b25..260ff6d9dee 100644 --- a/intermediate_source/scaled_dot_product_attention_tutorial.py +++ b/intermediate_source/scaled_dot_product_attention_tutorial.py @@ -35,7 +35,10 @@ # * `Memory-Efficient Attention `__ # * A PyTorch implementation defined in C++ # -# .. literalinclude:: ../beginner_source/new-release-colab.rst +""" +.. literalinclude:: ../beginner_source/new-release-colab.rst + :language: rst +""" import torch import torch.nn as nn From 25a360ecf61842600253bab130084e88d6e6c8c9 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Thu, 16 Mar 2023 13:39:13 -0700 Subject: [PATCH 5/6] Fix --- .../scaled_dot_product_attention_tutorial.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/intermediate_source/scaled_dot_product_attention_tutorial.py b/intermediate_source/scaled_dot_product_attention_tutorial.py index 260ff6d9dee..ed2186fdc67 100644 --- a/intermediate_source/scaled_dot_product_attention_tutorial.py +++ b/intermediate_source/scaled_dot_product_attention_tutorial.py @@ -35,10 +35,8 @@ # * `Memory-Efficient Attention `__ # * A PyTorch implementation defined in C++ # -""" -.. literalinclude:: ../beginner_source/new-release-colab.rst - :language: rst -""" +#.. literalinclude:: ../beginner_source/new-release-colab.rst +# :language: rst import torch import torch.nn as nn From 5136c7afdb94feb3bd0ece8d8bd3f26cf8f14d68 Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Thu, 16 Mar 2023 14:11:39 -0700 Subject: [PATCH 6/6] Fix --- intermediate_source/scaled_dot_product_attention_tutorial.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/intermediate_source/scaled_dot_product_attention_tutorial.py b/intermediate_source/scaled_dot_product_attention_tutorial.py index ed2186fdc67..8161f318ec5 100644 --- a/intermediate_source/scaled_dot_product_attention_tutorial.py +++ b/intermediate_source/scaled_dot_product_attention_tutorial.py @@ -35,8 +35,8 @@ # * `Memory-Efficient Attention `__ # * A PyTorch implementation defined in C++ # -#.. literalinclude:: ../beginner_source/new-release-colab.rst -# :language: rst +# .. literalinclude:: ../beginner_source/new-release-colab.rst +# :language: rst import torch import torch.nn as nn