Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into wwen/nightly-torch-ex…
Browse files Browse the repository at this point in the history
…port-redirect
  • Loading branch information
williamwen42 committed Nov 6, 2024
2 parents bebf340 + ea9a5fc commit 2034add
Show file tree
Hide file tree
Showing 100 changed files with 985 additions and 6,753 deletions.
7 changes: 3 additions & 4 deletions .ci/docker/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ tqdm==4.66.1
numpy==1.24.4
matplotlib
librosa
torch==2.4
torch==2.5
torchvision
torchtext
torchdata
networkx
PyHamcrest
Expand Down Expand Up @@ -70,5 +69,5 @@ pycocotools
semilearn==0.3.2
torchao==0.5.0
segment_anything==1.0
torchrec==0.8.0
fbgemm-gpu==0.8.0
torchrec==1.0.0; platform_system == "Linux"
fbgemm-gpu==1.0.0; platform_system == "Linux"
14 changes: 7 additions & 7 deletions .github/workflows/StalePRs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ jobs:
const STALE_CLOSE_THRESHOLD_MS = 1000 * 60 * 60 * 24 * 30;
const STALE_MESSAGE =
"Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as `Stale`. <br>" +
"Feel free to remove the `Stale` label if you feel this was a mistake. <br>" +
"If you are unable to remove the `Stale` label please contact a maintainer in order to do so. <br>" +
"Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as `stale`. <br>" +
"Feel free to remove the `stale` label if you feel this was a mistake. <br>" +
"If you are unable to remove the `stale` label please contact a maintainer in order to do so. <br>" +
"If you want the bot to never mark this PR stale again, add the `no-stale` label.<br>" +
"`Stale` pull requests will automatically be closed after 30 days of inactivity.<br>";
"`stale` pull requests will automatically be closed after 30 days of inactivity.<br>";
let numAPIRequests = 0;
let numProcessed = 0;
Expand All @@ -79,7 +79,7 @@ jobs:
// Check if the PR is stale, according to our configured thresholds.
let staleThresholdMillis;
if (labels.includes("Stale")) {
if (labels.includes("stale")) {
core.info(`[${pull.number}] PR is labeled stale, checking whether we should close it.`);
staleThresholdMillis = STALE_CLOSE_THRESHOLD_MS;
} else {
Expand All @@ -97,7 +97,7 @@ jobs:
// At this point, we know we should do something.
// For PRs already labeled stale, close them.
if (labels.includes("Stale")) {
if (labels.includes("stale")) {
core.info(`[${pull.number}] Closing PR.`);
numAPIRequests += 1;
await github.rest.issues.update({
Expand All @@ -123,7 +123,7 @@ jobs:
owner: "pytorch",
repo: "tutorials",
issue_number: pull.number,
labels: ["Stale"],
labels: ["stale"],
});
}
}
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/link_checkPR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#Checks links in a PR to ensure they are valid. If link is valid but failing, it can be added to the .lycheeignore file
#Use the skip-link-check label on a PR to skip checking links on a PR

name: link check on PR

on:
pull_request:
branches: [main]

jobs:
linkChecker:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Get Changed Files
id: changed-files
uses: tj-actions/changed-files@v41

- name: Check for Skip Label
id: skip-label
uses: actions/github-script@v6
with:
script: |
const labels = await github.rest.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number
});
return labels.data.some(label => label.name === 'skip-link-check');
- name: Check Links
if: steps.skip-label.outputs.result == 'false'
uses: lycheeverse/lychee-action@v1
with:
args: --accept=200,403,429 --base . --verbose --no-progress ${{ steps.changed-files.outputs.all_changed_files }}
token: ${{ secrets.CUSTOM_TOKEN }}
fail: true

- name: Skip Message
if: steps.skip-label.outputs.result == 'true'
run: echo "Link check was skipped due to the presence of the 'skip-link-check' label."

- name: Suggestions
if: failure()
run: |
echo -e "\nPlease review the links reported in the Check links step above."
echo -e "If a link is valid but fails due to a CAPTCHA challenge, IP blocking, login requirements, etc., consider adding such links to .lycheeignore file to bypass future checks.\n"
exit 1
5 changes: 2 additions & 3 deletions .jenkins/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ sudo apt-get install -y pandoc
#Install PyTorch Nightly for test.
# Nightly - pip install --pre torch torchvision torchaudio -f https://download.pytorch.org/whl/nightly/cu102/torch_nightly.html
# Install 2.5 to merge all 2.4 PRs - uncomment to install nightly binaries (update the version as needed).
pip uninstall -y torch torchvision torchaudio torchtext torchdata
pip3 install torch==2.5.0 torchvision torchaudio --no-cache-dir --index-url https://download.pytorch.org/whl/test/cu124
pip3 install fbgemm-gpu==1.0.0 torchrec==1.0.0 --no-cache-dir --index-url https://download.pytorch.org/whl/test/cu124
# pip uninstall -y torch torchvision torchaudio torchtext torchdata
# pip3 install torch==2.5.0 torchvision torchaudio --no-cache-dir --index-url https://download.pytorch.org/whl/test/cu124

# Install two language tokenizers for Translation with TorchText tutorial
python -m spacy download en_core_web_sm
Expand Down
5 changes: 1 addition & 4 deletions .jenkins/validate_tutorials_built.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

NOT_RUN = [
"beginner_source/basics/intro", # no code
"beginner_source/introyt/introyt_index", # no code
"beginner_source/onnx/intro_onnx",
"beginner_source/translation_transformer",
"beginner_source/profiler",
"beginner_source/saving_loading_models",
"beginner_source/introyt/captumyt",
Expand All @@ -22,9 +22,6 @@
"beginner_source/former_torchies/tensor_tutorial_old",
"beginner_source/examples_autograd/polynomial_autograd",
"beginner_source/examples_autograd/polynomial_custom_function",
"beginner_source/torchtext_custom_dataset_tutorial", # not building with 2.3 RC, might be able to turn on with GA
"beginner_source/text_sentiment_ngrams_tutorial", # not building with 2.3 RC, might be able to turn on with GA
"beginner_source/t5_tutorial", # re-enable after this is fixed: https://github.com/pytorch/text/issues/1756
"intermediate_source/mnist_train_nas", # used by ax_multiobjective_nas_tutorial.py
"intermediate_source/fx_conv_bn_fuser",
"intermediate_source/_torch_export_nightly_tutorial", # does not work on release
Expand Down
11 changes: 11 additions & 0 deletions .lycheeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Used for links to be ignored during the link check.
# Add link to file along with comment as to why it should be ignored

#Example link in some of the tutorials that should be ignored
file:///f:/libtmp/some_file

#Ignore links with "file:///" to catch any other example links
file:\/\/\/.*

# Ignore colab link in the setting of conf.py
https://pytorch.org/tutorials/beginner/colab/n
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ download:
wget -nv -N http://dl.fbaipublicfiles.com/pythia/data/vocab.tar.gz -P $(DATADIR)
tar $(TAROPTS) -xzf $(DATADIR)/vocab.tar.gz -C ./beginner_source/data/

# Download dataset for beginner_source/torchtext_custom_dataset_tutorial.py
wget -nv -N https://www.manythings.org/anki/deu-eng.zip -P $(DATADIR)
unzip -o $(DATADIR)/deu-eng.zip -d beginner_source/data/

# Download PennFudanPed dataset for intermediate_source/torchvision_tutorial.py
wget https://www.cis.upenn.edu/~jshi/ped_html/PennFudanPed.zip -P $(DATADIR)
unzip -o $(DATADIR)/PennFudanPed.zip -d intermediate_source/data/
Expand Down
18 changes: 18 additions & 0 deletions _static/css/custom2.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,21 @@
margin-bottom: 5px;
}
}

/* Left nav for 2nd level nav */

.pytorch-left-menu li.toctree-l2 {
padding-left: 10px;
}

.pytorch-left-menu li.toctree-l2.current > a, {
color: #ee4c2c;
}

.pytorch-left-menu li.toctree-l2.current a:link.reference.internal {
color: #ee4c2c;
}

.pytorch-left-menu li.toctree-l1.current > a:before {
content: "";
}
Binary file added _static/img/compiled_autograd/call_hook_node.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _static/img/itt_tutorial/vtune_xpu_config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _static/img/itt_tutorial/vtune_xpu_timeline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _static/img/trace_xpu_img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 52 additions & 0 deletions _static/js/custom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
document.addEventListener("DOMContentLoaded", function() {
// Select all <li> elements with the class "toctree-l1"
var toctreeItems = document.querySelectorAll('li.toctree-l1');

toctreeItems.forEach(function(item) {
// Find the link within the item
var link = item.querySelector('a');
var nestedList = item.querySelector('ul');

if (link && nestedList) {
// Create a span element for the "[+]" or "[-]" sign
var expandSign = document.createElement('span');
expandSign.style.cursor = 'pointer'; // Make it look clickable

// Use the link text as a unique key for localStorage
var sectionKey = 'section_' + link.textContent.trim().replace(/\s+/g, '_');

// Retrieve the saved state from localStorage
var isExpanded = localStorage.getItem(sectionKey);

// If no state is saved, default to expanded for "Learn the Basics" and collapsed for others
if (isExpanded === null) {
isExpanded = (link.textContent.trim() === 'Learn the Basics') ? 'true' : 'false';
localStorage.setItem(sectionKey, isExpanded);
}

if (isExpanded === 'true') {
nestedList.style.display = 'block'; // Expand the section
expandSign.textContent = '[-] '; // Show "[-]" since it's expanded
} else {
nestedList.style.display = 'none'; // Collapse the section
expandSign.textContent = '[+] '; // Show "[+]" since it's collapsed
}

// Add a click event to toggle the nested list
expandSign.addEventListener('click', function() {
if (nestedList.style.display === 'none') {
nestedList.style.display = 'block';
expandSign.textContent = '[-] '; // Change to "[-]" when expanded
localStorage.setItem(sectionKey, 'true'); // Save state
} else {
nestedList.style.display = 'none';
expandSign.textContent = '[+] '; // Change back to "[+]" when collapsed
localStorage.setItem(sectionKey, 'false'); // Save state
}
});

// Insert the sign before the link
link.parentNode.insertBefore(expandSign, link);
}
});
});
19 changes: 19 additions & 0 deletions _templates/layout.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
{% extends "!layout.html" %}


<!-- Overrides needed for the multilevel nav -->
{% block menu %}
{% if 'singlehtml' not in builder %}
{% set global_toc = toctree(collapse=theme_collapse_navigation|tobool,
includehidden=theme_includehidden|tobool,
titles_only=True) %}
{% endif %}
{% if global_toc %}
{{ global_toc }}
{% else %}
<!-- Local TOC -->
<div class="local-toc">{{ toc }}</div>
{% endif %}
{% endblock %}
<!-- End of overrides needed for the multilevel nav -->


{%- block content %}
{{ super() }}
<script>
Expand Down Expand Up @@ -29,6 +47,7 @@
</div>
{% endblock %}


{% block footer %}
{{ super() }}
<script>
Expand Down
2 changes: 2 additions & 0 deletions advanced_source/cpp_export.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Loading a TorchScript Model in C++
=====================================

.. note:: TorchScript is no longer in active development.

As its name suggests, the primary interface to PyTorch is the Python
programming language. While Python is a suitable and preferred language for
many scenarios requiring dynamism and ease of iteration, there are equally many
Expand Down
10 changes: 10 additions & 0 deletions advanced_source/ddp_pipeline.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Training Transformer models using Distributed Data Parallel and Pipeline Parallelism
====================================================================================

This tutorial has been deprecated.

Redirecting to the latest parallelism APIs in 3 seconds...

.. raw:: html

<meta http-equiv="Refresh" content="3; url='https://pytorch.org/tutorials/beginner/dist_overview.html#parallelism-apis'" />
2 changes: 2 additions & 0 deletions advanced_source/torch-script-parallelism.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Dynamic Parallelism in TorchScript
==================================

.. note:: TorchScript is no longer in active development.

In this tutorial, we introduce the syntax for doing *dynamic inter-op parallelism*
in TorchScript. This parallelism has the following properties:

Expand Down
2 changes: 2 additions & 0 deletions advanced_source/torch_script_custom_classes.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Extending TorchScript with Custom C++ Classes
===============================================

.. note:: TorchScript is no longer in active development.

This tutorial is a follow-on to the
:doc:`custom operator <torch_script_custom_ops>`
tutorial, and introduces the API we've built for binding C++ classes into TorchScript
Expand Down
2 changes: 2 additions & 0 deletions beginner_source/Intro_to_TorchScript_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
**Authors:** James Reed ([email protected]), Michael Suo ([email protected]), rev2
.. note:: TorchScript is no longer in active development.
This tutorial is an introduction to TorchScript, an intermediate
representation of a PyTorch model (subclass of ``nn.Module``) that
can then be run in a high-performance environment such as C++.
Expand Down
4 changes: 0 additions & 4 deletions beginner_source/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,3 @@ Beginner Tutorials
5. nlp/* and deep_learning_nlp_tutorial.rst
Deep Learning for NLP with Pytorch
https://pytorch.org/tutorials/beginner/deep_learning_nlp_tutorial.html

6. transformer_translation.py
Language Translation with Transformers
https://pytorch.org/tutorials/beginner/translation_transformer.html
14 changes: 12 additions & 2 deletions beginner_source/basics/intro.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
===================
Authors:
`Suraj Subramanian <https://github.com/suraj813>`_,
`Suraj Subramanian <https://github.com/subramen>`_,
`Seth Juarez <https://github.com/sethjuarez/>`_,
`Cassie Breviu <https://github.com/cassieview/>`_,
`Cassie Breviu <https://github.com/cassiebreviu/>`_,
`Dmitry Soshnikov <https://soshnikov.com/>`_,
`Ari Bornstein <https://github.com/aribornstein/>`_
Expand Down Expand Up @@ -49,6 +49,16 @@
.. include:: /beginner_source/basics/qs_toc.txt
.. toctree::
:maxdepth: 2
:hidden:
quickstart_tutorial
tensorqs_tutorial
data_tutorial
transforms_tutorial
buildmodel_tutorial
autogradqs_tutorial
optimization_tutorial
saveloadrun_tutorial
"""
Loading

0 comments on commit 2034add

Please sign in to comment.