Skip to content

Commit a885873

Browse files
authored
Move better transformer tutorial, update index (#1982)
* Adding better transformer tutorial * remove bt from prod toc
1 parent c39df02 commit a885873

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

intermediate_source/bettertransformer_tutorial.rst renamed to beginner_source/bettertransformer_tutorial.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,14 @@ We run the model on CPU, and collect profile information:
127127
* The first run uses traditional ("slow path") execution.
128128
* The second run enables BT fastpath execution by putting the model in inference mode using `model.eval()` and disables gradient collection with `torch.no_grad()`.
129129

130-
You can see a small improvement when the model is executing on CPU. Notice that the fastpath profile shows most of the execution time
130+
You can see an improvement (whose magnitude will depend on the CPU model) when the model is executing on CPU. Notice that the fastpath profile shows most of the execution time
131131
in the native `TransformerEncoderLayer` implementation `aten::_transformer_encoder_layer_fwd`.
132132

133133
.. code-block:: python
134134
135135
print("slow path:")
136136
print("==========")
137-
with torch.autograd.profiler.profile(use_cuda=True) as prof:
137+
with torch.autograd.profiler.profile(use_cuda=False) as prof:
138138
for i in range(ITERATIONS):
139139
output = model(model_input)
140140
print(prof)
@@ -143,7 +143,7 @@ in the native `TransformerEncoderLayer` implementation `aten::_transformer_encod
143143
144144
print("fast path:")
145145
print("==========")
146-
with torch.autograd.profiler.profile(use_cuda=True) as prof:
146+
with torch.autograd.profiler.profile(use_cuda=False) as prof:
147147
with torch.no_grad():
148148
for i in range(ITERATIONS):
149149
output = model(model_input)

index.rst

+9-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Welcome to PyTorch Tutorials
33

44
What's new in PyTorch tutorials?
55

6-
* `Fast Transformer Inference with Better Transformer <https://pytorch.org/tutorials/intermediate/bettertransformer_tutorial.html?utm_source=whats_new_tutorials&utm_medium=bettertransformer>`__
6+
* `Fast Transformer Inference with Better Transformer <https://pytorch.org/tutorials/beginner/bettertransformer_tutorial.html?utm_source=whats_new_tutorials&utm_medium=bettertransformer>`__
77
* `Introduction to TorchRec <https://pytorch.org/tutorials/intermediate/torchrec_tutorial.html?utm_source=whats_new_tutorials&utm_medium=torchrec>`__
88
* `Getting Started with Fully Sharded Data Parallel (FSDP) <https://pytorch.org/tutorials/intermediate/FSDP_tutorial.html?utm_source=whats_new_tutorials&utm_medium=FSDP>`__
99
* `Advanced model training with Fully Sharded Data Parallel (FSDP) <https://pytorch.org/tutorials/intermediate/FSDP_adavnced_tutorial.html?utm_source=whats_new_tutorials&utm_medium=FSDP_advanced>`__
@@ -214,6 +214,13 @@ What's new in PyTorch tutorials?
214214

215215
.. Text
216216
217+
.. customcarditem::
218+
:header: Fast Transformer Inference with Better Transformer
219+
:card_description: Deploy a PyTorch Transformer model using Better Transformer with high performance for inference
220+
:image: _static/img/thumbnails/cropped/pytorch-logo.png
221+
:link: beginner/bettertransformer_tutorial.html
222+
:tags: Production,Text
223+
217224
.. customcarditem::
218225
:header: Sequence-to-Sequence Modeling with nn.Transformer and torchtext
219226
:card_description: Learn how to train a sequence-to-sequence model that uses the nn.Transformer module.
@@ -276,13 +283,6 @@ What's new in PyTorch tutorials?
276283

277284
.. Deploying PyTorch Models in Production
278285
279-
.. customcarditem::
280-
:header: Fast Transformer Inference with Better Transformer
281-
:card_description: Deploy a PyTorch Transformer model using Better Transformer with high performance for inference
282-
:image: _static/img/thumbnails/cropped/pytorch-logo.png
283-
:link: intermediate/bettertransformer_tutorial.html
284-
:tags: Production,Text
285-
286286
287287
.. customcarditem::
288288
:header: Deploying PyTorch in Python via a REST API with Flask
@@ -782,6 +782,7 @@ Additional Resources
782782
:caption: Text
783783

784784
beginner/transformer_tutorial
785+
beginner/bettertransformer_tutorial
785786
intermediate/char_rnn_classification_tutorial
786787
intermediate/char_rnn_generation_tutorial
787788
intermediate/seq2seq_translation_tutorial
@@ -804,7 +805,6 @@ Additional Resources
804805
:hidden:
805806
:caption: Deploying PyTorch Models in Production
806807

807-
intermediate/bettertransformer_tutorial
808808
intermediate/flask_rest_api_tutorial
809809
beginner/Intro_to_TorchScript_tutorial
810810
advanced/cpp_export

0 commit comments

Comments
 (0)