Skip to content

Commit c1a1cca

Browse files
authored
Merge branch 'main' into update_seq2seq_tutorial
2 parents 9c4fc15 + 222f291 commit c1a1cca

17 files changed

+616
-53
lines changed

.ci/docker/requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ tqdm==4.66.1
1414
numpy==1.24.4
1515
matplotlib
1616
librosa
17-
torch==2.6
17+
torch==2.7
1818
torchvision
1919
torchdata
2020
networkx
@@ -67,7 +67,7 @@ iopath
6767
pygame==2.6.0
6868
pycocotools
6969
semilearn==0.3.2
70-
torchao==0.5.0
70+
torchao==0.10.0
7171
segment_anything==1.0
7272
torchrec==1.1.0; platform_system == "Linux"
73-
fbgemm-gpu==1.1.0; platform_system == "Linux"
73+
fbgemm-gpu==1.2.0; platform_system == "Linux"

.jenkins/build.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,10 @@ sudo apt-get install -y pandoc
2222
#Install PyTorch Nightly for test.
2323
# Nightly - pip install --pre torch torchvision torchaudio -f https://download.pytorch.org/whl/nightly/cu102/torch_nightly.html
2424
# Install 2.5 to merge all 2.4 PRs - uncomment to install nightly binaries (update the version as needed).
25-
# sudo pip uninstall -y torch torchvision torchaudio torchtext torchdata
26-
# sudo pip3 install torch==2.6.0 torchvision --no-cache-dir --index-url https://download.pytorch.org/whl/test/cu124
2725
# sudo pip uninstall -y fbgemm-gpu torchrec
26+
# sudo pip uninstall -y torch torchvision torchaudio torchtext torchdata torchrl tensordict
2827
# sudo pip3 install fbgemm-gpu==1.1.0 torchrec==1.0.0 --no-cache-dir --index-url https://download.pytorch.org/whl/test/cu124
29-
sudo pip uninstall -y torch torchvision torchaudio torchtext torchdata torchrl tensordict
30-
pip3 install torch==2.7.0 torchvision torchaudio --no-cache-dir --index-url https://download.pytorch.org/whl/test/cu126
31-
#sudo pip uninstall -y fbgemm-gpu
28+
# pip3 install torch==2.7.0 torchvision torchaudio --no-cache-dir --index-url https://download.pytorch.org/whl/test/cu126
3229
# Install two language tokenizers for Translation with TorchText tutorial
3330
python -m spacy download en_core_web_sm
3431
python -m spacy download de_core_news_sm

.jenkins/validate_tutorials_built.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,8 @@
5151
"intermediate_source/text_to_speech_with_torchaudio",
5252
"intermediate_source/tensorboard_profiler_tutorial", # reenable after 2.0 release.
5353
"advanced_source/semi_structured_sparse", # reenable after 3303 is fixed.
54-
"intermediate_source/mario_rl_tutorial", # reenable after 3302 is fixed
55-
"intermediate_source/reinforcement_ppo", # reenable after 3302 is fixed
56-
"intermediate_source/pinmem_nonblock", # reenable after 3302 is fixed
57-
"intermediate_source/dqn_with_rnn_tutorial", # reenable after 3302 is fixed
58-
"advanced_source/pendulum", # reenable after 3302 is fixed
59-
"advanced_source/coding_ddpg", # reenable after 3302 is fixed
60-
"intermediate_source/torchrec_intro_tutorial", # reenable after 3302 is fixed
61-
"recipes_source/recipes/reasoning_about_shapes" # reenable after 3326 is fixed
54+
"intermediate_source/torchrec_intro_tutorial", # reenable after 3302 is fixe
55+
"intermediate_source/memory_format_tutorial", # causes other tutorials like torch_logs fail. "state" issue, reseting dynamo didn't help
6256
]
6357

6458
def tutorial_source_dirs() -> List[Path]:

_templates/layout.html

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,5 @@
211211

212212
<img height="1" width="1" style="border-style:none;" alt="" src="https://www.googleadservices.com/pagead/conversion/795629140/?label=txkmCPmdtosBENSssfsC&amp;guid=ON&amp;script=0"/>
213213

214-
<script>
215-
//temporarily add a link to survey
216-
var survey = '<div class="survey-banner"><p><i class="fas fa-poll" aria-hidden="true">&nbsp </i> Take the <a href="https://forms.gle/KZ4xGL65VRMYNbbG6">PyTorch Docs/Tutorials survey</a>.</p></div>'
217-
if ($(".pytorch-call-to-action-links").length) {
218-
$(".pytorch-call-to-action-links").before(survey);
219-
} else {
220-
$("#pytorch-article").prepend(survey);
221-
}
222-
</script>
223214

224215
{% endblock %}

beginner_source/basics/optimization_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def forward(self, x):
7676
# (`read more <https://pytorch.org/tutorials/beginner/hyperparameter_tuning_tutorial.html>`__ about hyperparameter tuning)
7777
#
7878
# We define the following hyperparameters for training:
79-
# - **Number of Epochs** - the number times to iterate over the dataset
79+
# - **Number of Epochs** - the number of times to iterate over the dataset
8080
# - **Batch Size** - the number of data samples propagated through the network before the parameters are updated
8181
# - **Learning Rate** - how much to update models parameters at each batch/epoch. Smaller values yield slow learning speed, while large values may result in unpredictable behavior during training.
8282
#

beginner_source/colab.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ PyTorch Version in Google Colab
1111
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1212

1313
Wen you are running a tutorial that requires a version of PyTorch that has
14-
jst been released, that version might not be yet available in Google Colab.
14+
just been released, that version might not be yet available in Google Colab.
1515
To check that you have the required ``torch`` and compatible domain libraries
1616
installed, run ``!pip list``.
1717

@@ -27,7 +27,7 @@ Using Tutorial Data from Google Drive in Colab
2727
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2828

2929
We've added a new feature to tutorials that allows users to open the
30-
ntebook associated with a tutorial in Google Colab. You may need to
30+
notebook associated with a tutorial in Google Colab. You may need to
3131
copy data to your Google drive account to get the more complex tutorials
3232
to work.
3333

conf.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,16 @@
9999

100100
def reset_seeds(gallery_conf, fname):
101101
torch.cuda.empty_cache()
102+
torch.backends.cudnn.deterministic = True
103+
torch.backends.cudnn.benchmark = False
104+
torch._dynamo.reset()
105+
torch._inductor.config.force_disable_caches = True
102106
torch.manual_seed(42)
103107
torch.set_default_device(None)
104108
random.seed(10)
105109
numpy.random.seed(10)
110+
torch.set_grad_enabled(True)
111+
106112
gc.collect()
107113

108114
sphinx_gallery_conf = {

en-wordlist.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,3 +698,14 @@ TorchServe
698698
Inductor’s
699699
onwards
700700
recompilations
701+
BiasCorrection
702+
ELU
703+
GELU
704+
NNCF
705+
OpenVINO
706+
OpenVINOQuantizer
707+
PReLU
708+
Quantizer
709+
SmoothQuant
710+
quantizer
711+
quantizers

index.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ Welcome to PyTorch Tutorials
33

44
**What's new in PyTorch tutorials?**
55

6-
* `Dynamic Compilation Control with torch.compiler.set_stance <https://pytorch.org/tutorials/recipes/torch_compiler_set_stance_tutorial.html>`__
7-
* `Accelerating PyTorch Transformers by replacing nn.Transformer with Nested Tensors and torch.compile() <https://pytorch.org/tutorials/intermediate/transformer_building_blocks.html>`__
8-
* `Understanding the torch.export Flow and Solutions to Common Challenges <https://pytorch.org/tutorials/recipes/torch_export_challenges_solutions.html>`__
9-
* Updated `torch.export Tutorial <https://pytorch.org/tutorials/intermediate/torch_export_tutorial.html#constraints-dynamic-shapes>`__ with automatic dynamic shapes ``Dim.AUTO``
10-
* Updated `torch.export AOTInductor Tutorial for Python runtime <https://pytorch.org/tutorials/recipes/torch_export_aoti_python.html>`__
11-
* Updated `Using User-Defined Triton Kernels with torch.compile <https://pytorch.org/tutorials/recipes/torch_compile_user_defined_triton_kernel_tutorial.html#composability>`__ with new ``torch.library.triton_op``
12-
* Updated `Compile Time Caching in torch.compile <https://pytorch.org/tutorials/recipes/torch_compile_caching_tutorial.html>`__ with new ``Mega-Cache``
6+
* `Utilizing Torch Function modes with torch.compile <https://pytorch.org/tutorials/recipes/torch_compile_torch_function_modes.html>`__
7+
* `Context Parallel Tutorial <https://pytorch.org/tutorials/prototype/context_parallel.html>`__
8+
* `PyTorch 2 Export Quantization with Intel GPU Backend through Inductor <https://pytorch.org/tutorials/prototype/pt2e_quant_xpu_inductor.html>`__
9+
* `(beta) Explicit horizontal fusion with foreach_map and torch.compile <https://pytorch.org/tutorials/recipes/foreach_map.html>`__
10+
* Updated `Inductor Windows CPU Tutorial <https://pytorch.org/tutorials/prototype/inductor_windows.html>`__
1311

1412
.. raw:: html
1513

intermediate_source/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

0 commit comments

Comments
 (0)