Skip to content

Commit 59262cf

Browse files
committed
Automated tutorials push
1 parent c9c593c commit 59262cf

File tree

179 files changed

+13515
-14618
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+13515
-14618
lines changed

_downloads/3195443a0ced3cabc0ad643537bdb5cd/introyt1_tutorial.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
{
3535
"cell_type": "code",
3636
"execution_count": null,
37-
"id": "b622bb9f",
37+
"id": "4779a3f6",
3838
"metadata": {},
3939
"outputs": [],
4040
"source": [
@@ -50,7 +50,7 @@
5050
},
5151
{
5252
"cell_type": "markdown",
53-
"id": "c95d87b3",
53+
"id": "c5f807f2",
5454
"metadata": {},
5555
"source": [
5656
"\n",

_downloads/4355e2cef7d17548f1e25f97a62828c4/template_tutorial.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
{
3232
"cell_type": "code",
3333
"execution_count": null,
34-
"id": "decaa202",
34+
"id": "26c612f6",
3535
"metadata": {},
3636
"outputs": [],
3737
"source": [
@@ -47,7 +47,7 @@
4747
},
4848
{
4949
"cell_type": "markdown",
50-
"id": "bcd3c6bb",
50+
"id": "9fce16f1",
5151
"metadata": {},
5252
"source": [
5353
"\n",

_downloads/63a0f0fc7b3ffb15d3a5ac8db3d521ee/tensors_deeper_tutorial.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
{
3535
"cell_type": "code",
3636
"execution_count": null,
37-
"id": "7c5b6aea",
37+
"id": "c3439dbe",
3838
"metadata": {},
3939
"outputs": [],
4040
"source": [
@@ -50,7 +50,7 @@
5050
},
5151
{
5252
"cell_type": "markdown",
53-
"id": "7e063424",
53+
"id": "cdc0c835",
5454
"metadata": {},
5555
"source": [
5656
"\n",

_downloads/6b019e0b5f84b568fcca1120bd28e230/torch_compile_tutorial.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,11 @@ def forward(self, x):
101101
return torch.nn.functional.relu(self.lin(x))
102102

103103
mod = MyModule()
104-
opt_mod = torch.compile(mod)
105-
print(opt_mod(t))
104+
mod.compile()
105+
print(mod(t))
106+
## or:
107+
# opt_mod = torch.compile(mod)
108+
# print(opt_mod(t))
106109

107110
######################################################################
108111
# torch.compile and Nested Calls
@@ -135,8 +138,8 @@ def forward(self, x):
135138
return torch.nn.functional.relu(self.outer_lin(x))
136139

137140
outer_mod = OuterModule()
138-
opt_outer_mod = torch.compile(outer_mod)
139-
print(opt_outer_mod(t))
141+
outer_mod.compile()
142+
print(outer_mod(t))
140143

141144
######################################################################
142145
# We can also disable some functions from being compiled by using
@@ -197,6 +200,12 @@ def outer_function():
197200
# 4. **Compile Leaf Functions First:** In complex models with multiple nested
198201
# functions and modules, start by compiling the leaf functions or modules first.
199202
# For more information see `TorchDynamo APIs for fine-grained tracing <https://pytorch.org/docs/stable/torch.compiler_fine_grain_apis.html>`__.
203+
#
204+
# 5. **Prefer ``mod.compile()`` over ``torch.compile(mod)``:** Avoids ``_orig_`` prefix issues in ``state_dict``.
205+
#
206+
# 6. **Use ``fullgraph=True`` to catch graph breaks:** Helps ensure end-to-end compilation, maximizing speedup
207+
# and compatibility with ``torch.export``.
208+
200209

201210
######################################################################
202211
# Demonstrating Speedups

_downloads/770632dd3941d2a51b831c52ded57aa2/trainingyt.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
{
3636
"cell_type": "code",
3737
"execution_count": null,
38-
"id": "9a5bf02f",
38+
"id": "14152759",
3939
"metadata": {},
4040
"outputs": [],
4141
"source": [
@@ -51,7 +51,7 @@
5151
},
5252
{
5353
"cell_type": "markdown",
54-
"id": "cb12d848",
54+
"id": "55289e43",
5555
"metadata": {},
5656
"source": [
5757
"\n",

_downloads/96ad88eb476f41a5403dcdade086afb8/torch_compile_tutorial.ipynb

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,11 @@
173173
" return torch.nn.functional.relu(self.lin(x))\n",
174174
"\n",
175175
"mod = MyModule()\n",
176-
"opt_mod = torch.compile(mod)\n",
177-
"print(opt_mod(t))"
176+
"mod.compile()\n",
177+
"print(mod(t))\n",
178+
"## or:\n",
179+
"# opt_mod = torch.compile(mod)\n",
180+
"# print(opt_mod(t))"
178181
]
179182
},
180183
{
@@ -235,8 +238,8 @@
235238
" return torch.nn.functional.relu(self.outer_lin(x))\n",
236239
"\n",
237240
"outer_mod = OuterModule()\n",
238-
"opt_outer_mod = torch.compile(outer_mod)\n",
239-
"print(opt_outer_mod(t))"
241+
"outer_mod.compile()\n",
242+
"print(outer_mod(t))"
240243
]
241244
},
242245
{
@@ -317,7 +320,14 @@
317320
"nested functions and modules, start by compiling the leaf functions or\n",
318321
"modules first. For more information see [TorchDynamo APIs for\n",
319322
"fine-grained\n",
320-
"tracing](https://pytorch.org/docs/stable/torch.compiler_fine_grain_apis.html).\n"
323+
"tracing](https://pytorch.org/docs/stable/torch.compiler_fine_grain_apis.html).\n",
324+
"\n",
325+
"5. **Prefer \\`\\`mod.compile()\\`\\` over \\`\\`torch.compile(mod)\\`\\`:**\n",
326+
" Avoids `_orig_` prefix issues in `state_dict`.\n",
327+
"\n",
328+
"6\\. **Use \\`\\`fullgraph=True\\`\\` to catch graph breaks:** Helps ensure\n",
329+
"end-to-end compilation, maximizing speedup and compatibility with\n",
330+
"`torch.export`.\n"
321331
]
322332
},
323333
{

_downloads/c28f42852d456daf9af72da6c6909556/captumyt.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
{
3838
"cell_type": "code",
3939
"execution_count": null,
40-
"id": "1ae6a4ec",
40+
"id": "78ac4491",
4141
"metadata": {},
4242
"outputs": [],
4343
"source": [
@@ -53,7 +53,7 @@
5353
},
5454
{
5555
"cell_type": "markdown",
56-
"id": "daa092f9",
56+
"id": "9aa1599c",
5757
"metadata": {},
5858
"source": [
5959
"\n",

_downloads/e2e556f6b4693c2cef716dd7f40caaf6/tensorboardyt_tutorial.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
{
3636
"cell_type": "code",
3737
"execution_count": null,
38-
"id": "bf84aab6",
38+
"id": "744039b5",
3939
"metadata": {},
4040
"outputs": [],
4141
"source": [
@@ -51,7 +51,7 @@
5151
},
5252
{
5353
"cell_type": "markdown",
54-
"id": "8a310319",
54+
"id": "5974d4a8",
5555
"metadata": {},
5656
"source": [
5757
"\n",

_downloads/ed9d4f94afb79f7dada6742a06c486a5/autogradyt_tutorial.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
{
3535
"cell_type": "code",
3636
"execution_count": null,
37-
"id": "33368c0f",
37+
"id": "7d278b80",
3838
"metadata": {},
3939
"outputs": [],
4040
"source": [
@@ -50,7 +50,7 @@
5050
},
5151
{
5252
"cell_type": "markdown",
53-
"id": "413ad8be",
53+
"id": "93f682a5",
5454
"metadata": {},
5555
"source": [
5656
"\n",

_downloads/fe726e041160526cf828806536922cf6/modelsyt_tutorial.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
{
3535
"cell_type": "code",
3636
"execution_count": null,
37-
"id": "d2c5b942",
37+
"id": "58c85a0a",
3838
"metadata": {},
3939
"outputs": [],
4040
"source": [
@@ -50,7 +50,7 @@
5050
},
5151
{
5252
"cell_type": "markdown",
53-
"id": "b2a87aa5",
53+
"id": "e275cb61",
5454
"metadata": {},
5555
"source": [
5656
"\n",
Loading
Loading
-53 Bytes
Loading
-111 Bytes
Loading
Loading
403 Bytes
Loading

_sources/advanced/dynamic_quantization_tutorial.rst.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,9 +517,9 @@ models run single threaded.
517517
.. code-block:: none
518518
519519
loss: 5.167
520-
elapsed time (seconds): 201.7
520+
elapsed time (seconds): 197.8
521521
loss: 5.168
522-
elapsed time (seconds): 118.0
522+
elapsed time (seconds): 118.4
523523
524524
525525
@@ -541,7 +541,7 @@ Thanks for reading! As always, we welcome any feedback, so please create an issu
541541

542542
.. rst-class:: sphx-glr-timing
543543

544-
**Total running time of the script:** ( 5 minutes 28.935 seconds)
544+
**Total running time of the script:** ( 5 minutes 25.477 seconds)
545545

546546

547547
.. _sphx_glr_download_advanced_dynamic_quantization_tutorial.py:

_sources/advanced/neural_style_tutorial.rst.txt

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -410,20 +410,22 @@ network to evaluation mode using ``.eval()``.
410410
Downloading: "https://download.pytorch.org/models/vgg19-dcbb9e9d.pth" to /var/lib/ci-user/.cache/torch/hub/checkpoints/vgg19-dcbb9e9d.pth
411411
412412
0%| | 0.00/548M [00:00<?, ?B/s]
413-
8%|7 | 42.1M/548M [00:00<00:01, 442MB/s]
414-
16%|#5 | 86.5M/548M [00:00<00:01, 455MB/s]
415-
24%|##3 | 130M/548M [00:00<00:01, 417MB/s]
416-
32%|###1 | 174M/548M [00:00<00:00, 433MB/s]
417-
39%|###9 | 216M/548M [00:00<00:00, 423MB/s]
418-
47%|####6 | 257M/548M [00:00<00:00, 403MB/s]
419-
54%|#####4 | 298M/548M [00:00<00:00, 414MB/s]
420-
63%|######2 | 343M/548M [00:00<00:00, 429MB/s]
421-
71%|####### | 387M/548M [00:00<00:00, 440MB/s]
422-
78%|#######8 | 430M/548M [00:01<00:00, 396MB/s]
423-
85%|########5 | 468M/548M [00:01<00:00, 391MB/s]
424-
93%|#########2| 508M/548M [00:01<00:00, 398MB/s]
425-
100%|#########9| 548M/548M [00:01<00:00, 403MB/s]
426-
100%|##########| 548M/548M [00:01<00:00, 413MB/s]
413+
5%|5 | 28.8M/548M [00:00<00:01, 301MB/s]
414+
12%|#1 | 65.5M/548M [00:00<00:01, 350MB/s]
415+
18%|#8 | 99.9M/548M [00:00<00:01, 354MB/s]
416+
24%|##4 | 134M/548M [00:00<00:01, 305MB/s]
417+
30%|##9 | 164M/548M [00:00<00:01, 261MB/s]
418+
36%|###5 | 195M/548M [00:00<00:01, 281MB/s]
419+
43%|####2 | 233M/548M [00:00<00:01, 314MB/s]
420+
50%|####9 | 273M/548M [00:00<00:00, 343MB/s]
421+
56%|#####6 | 308M/548M [00:00<00:00, 351MB/s]
422+
63%|######3 | 348M/548M [00:01<00:00, 370MB/s]
423+
71%|####### | 388M/548M [00:01<00:00, 384MB/s]
424+
78%|#######7 | 427M/548M [00:01<00:00, 394MB/s]
425+
85%|########5 | 467M/548M [00:01<00:00, 401MB/s]
426+
92%|#########2| 506M/548M [00:01<00:00, 396MB/s]
427+
100%|#########9| 546M/548M [00:01<00:00, 402MB/s]
428+
100%|##########| 548M/548M [00:01<00:00, 357MB/s]
427429
428430
429431
@@ -744,22 +746,22 @@ Finally, we can run the algorithm.
744746
745747
Optimizing..
746748
run [50]:
747-
Style Loss : 4.186186 Content Loss: 4.187174
749+
Style Loss : 4.286120 Content Loss: 4.196964
748750
749751
run [100]:
750-
Style Loss : 1.130905 Content Loss: 3.028577
752+
Style Loss : 1.156173 Content Loss: 3.044555
751753
752754
run [150]:
753-
Style Loss : 0.713207 Content Loss: 2.648742
755+
Style Loss : 0.709581 Content Loss: 2.651251
754756
755757
run [200]:
756-
Style Loss : 0.486411 Content Loss: 2.495289
758+
Style Loss : 0.473631 Content Loss: 2.488267
757759
758760
run [250]:
759-
Style Loss : 0.346993 Content Loss: 2.406199
761+
Style Loss : 0.346411 Content Loss: 2.402201
760762
761763
run [300]:
762-
Style Loss : 0.267672 Content Loss: 2.350107
764+
Style Loss : 0.264236 Content Loss: 2.346521
763765
764766
765767
@@ -768,7 +770,7 @@ Finally, we can run the algorithm.
768770
769771
.. rst-class:: sphx-glr-timing
770772

771-
**Total running time of the script:** ( 0 minutes 11.353 seconds)
773+
**Total running time of the script:** ( 0 minutes 12.000 seconds)
772774

773775

774776
.. _sphx_glr_download_advanced_neural_style_tutorial.py:

_sources/advanced/numpy_extensions_tutorial.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ The backward pass computes the gradient ``wrt`` the input and the gradient ``wrt
303303
304304
.. rst-class:: sphx-glr-timing
305305

306-
**Total running time of the script:** ( 0 minutes 0.366 seconds)
306+
**Total running time of the script:** ( 0 minutes 0.371 seconds)
307307

308308

309309
.. _sphx_glr_download_advanced_numpy_extensions_tutorial.py:

_sources/advanced/python_custom_ops.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ For more detailed information, see:
487487

488488
.. rst-class:: sphx-glr-timing
489489

490-
**Total running time of the script:** ( 0 minutes 2.402 seconds)
490+
**Total running time of the script:** ( 0 minutes 2.370 seconds)
491491

492492

493493
.. _sphx_glr_download_advanced_python_custom_ops.py:

_sources/beginner/Intro_to_TorchScript_tutorial.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ model from C++.
7070
7171
2.7.0+cu126
7272
73-
<torch._C.Generator object at 0x7f5ee6596470>
73+
<torch._C.Generator object at 0x7f3bbbd9a470>
7474
7575
7676
@@ -808,7 +808,7 @@ https://colab.research.google.com/drive/1HiICg6jRkBnr5hvK2-VnMi88Vi9pUzEJ
808808

809809
.. rst-class:: sphx-glr-timing
810810

811-
**Total running time of the script:** ( 0 minutes 0.150 seconds)
811+
**Total running time of the script:** ( 0 minutes 0.147 seconds)
812812

813813

814814
.. _sphx_glr_download_beginner_Intro_to_TorchScript_tutorial.py:

_sources/beginner/basics/autogradqs_tutorial.rst.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ documentation <https://pytorch.org/docs/stable/autograd.html#function>`__.
113113

114114
.. code-block:: none
115115
116-
Gradient function for z = <AddBackward0 object at 0x7f5842ad19c0>
117-
Gradient function for loss = <BinaryCrossEntropyWithLogitsBackward0 object at 0x7f5842ad0610>
116+
Gradient function for z = <AddBackward0 object at 0x7f4c13fa22c0>
117+
Gradient function for loss = <BinaryCrossEntropyWithLogitsBackward0 object at 0x7f4c13fa2f80>
118118
119119
120120
@@ -395,7 +395,7 @@ Further Reading
395395

396396
.. rst-class:: sphx-glr-timing
397397

398-
**Total running time of the script:** ( 0 minutes 0.009 seconds)
398+
**Total running time of the script:** ( 0 minutes 0.008 seconds)
399399

400400

401401
.. _sphx_glr_download_beginner_basics_autogradqs_tutorial.py:

_sources/beginner/basics/buildmodel_tutorial.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ Further Reading
475475

476476
.. rst-class:: sphx-glr-timing
477477

478-
**Total running time of the script:** ( 0 minutes 0.493 seconds)
478+
**Total running time of the script:** ( 0 minutes 0.514 seconds)
479479

480480

481481
.. _sphx_glr_download_beginner_basics_buildmodel_tutorial.py:

0 commit comments

Comments
 (0)