diff --git a/.ci/docker/requirements.txt b/.ci/docker/requirements.txt index 01e6a82926..6babb63e78 100644 --- a/.ci/docker/requirements.txt +++ b/.ci/docker/requirements.txt @@ -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 @@ -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" diff --git a/.github/workflows/StalePRs.yml b/.github/workflows/StalePRs.yml index 4a8ddd6865..4fbfc78550 100644 --- a/.github/workflows/StalePRs.yml +++ b/.github/workflows/StalePRs.yml @@ -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`.
" + - "Feel free to remove the `Stale` label if you feel this was a mistake.
" + - "If you are unable to remove the `Stale` label please contact a maintainer in order to do so.
" + + "Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as `stale`.
" + + "Feel free to remove the `stale` label if you feel this was a mistake.
" + + "If you are unable to remove the `stale` label please contact a maintainer in order to do so.
" + "If you want the bot to never mark this PR stale again, add the `no-stale` label.
" + - "`Stale` pull requests will automatically be closed after 30 days of inactivity.
"; + "`stale` pull requests will automatically be closed after 30 days of inactivity.
"; let numAPIRequests = 0; let numProcessed = 0; @@ -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 { @@ -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({ @@ -123,7 +123,7 @@ jobs: owner: "pytorch", repo: "tutorials", issue_number: pull.number, - labels: ["Stale"], + labels: ["stale"], }); } } diff --git a/.github/workflows/link_checkPR.yml b/.github/workflows/link_checkPR.yml new file mode 100644 index 0000000000..1fde237159 --- /dev/null +++ b/.github/workflows/link_checkPR.yml @@ -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 diff --git a/.jenkins/build.sh b/.jenkins/build.sh index 60867ce1d3..e6ecaf6712 100755 --- a/.jenkins/build.sh +++ b/.jenkins/build.sh @@ -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 diff --git a/.jenkins/validate_tutorials_built.py b/.jenkins/validate_tutorials_built.py index b11f5fdd94..2aaa5d6ef7 100644 --- a/.jenkins/validate_tutorials_built.py +++ b/.jenkins/validate_tutorials_built.py @@ -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", @@ -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 diff --git a/.lycheeignore b/.lycheeignore new file mode 100644 index 0000000000..4894b6d72f --- /dev/null +++ b/.lycheeignore @@ -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 diff --git a/Makefile b/Makefile index 0a36670dd6..19c6d59768 100644 --- a/Makefile +++ b/Makefile @@ -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/ diff --git a/_static/css/custom2.css b/_static/css/custom2.css index 4e263b6775..a4ec9396ee 100644 --- a/_static/css/custom2.css +++ b/_static/css/custom2.css @@ -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: ""; +} diff --git a/_static/img/compiled_autograd/call_hook_node.png b/_static/img/compiled_autograd/call_hook_node.png new file mode 100644 index 0000000000..3e094cf6f7 Binary files /dev/null and b/_static/img/compiled_autograd/call_hook_node.png differ diff --git a/_static/img/compiled_autograd/entire_verbose_log.png b/_static/img/compiled_autograd/entire_verbose_log.png new file mode 100644 index 0000000000..4ce2b8538e Binary files /dev/null and b/_static/img/compiled_autograd/entire_verbose_log.png differ diff --git a/_static/img/compiled_autograd/recompile_due_to_dynamic.png b/_static/img/compiled_autograd/recompile_due_to_dynamic.png new file mode 100644 index 0000000000..41ae56acf2 Binary files /dev/null and b/_static/img/compiled_autograd/recompile_due_to_dynamic.png differ diff --git a/_static/img/compiled_autograd/recompile_due_to_node.png b/_static/img/compiled_autograd/recompile_due_to_node.png new file mode 100644 index 0000000000..800a178458 Binary files /dev/null and b/_static/img/compiled_autograd/recompile_due_to_node.png differ diff --git a/_static/img/itt_tutorial/vtune_xpu_config.png b/_static/img/itt_tutorial/vtune_xpu_config.png new file mode 100644 index 0000000000..80dd1812d2 Binary files /dev/null and b/_static/img/itt_tutorial/vtune_xpu_config.png differ diff --git a/_static/img/itt_tutorial/vtune_xpu_timeline.png b/_static/img/itt_tutorial/vtune_xpu_timeline.png new file mode 100644 index 0000000000..43818cf105 Binary files /dev/null and b/_static/img/itt_tutorial/vtune_xpu_timeline.png differ diff --git a/_static/img/trace_xpu_img.png b/_static/img/trace_xpu_img.png new file mode 100644 index 0000000000..2eca0a78cb Binary files /dev/null and b/_static/img/trace_xpu_img.png differ diff --git a/_static/js/custom.js b/_static/js/custom.js new file mode 100644 index 0000000000..3e6c7fb831 --- /dev/null +++ b/_static/js/custom.js @@ -0,0 +1,52 @@ +document.addEventListener("DOMContentLoaded", function() { + // Select all
  • 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); + } + }); +}); diff --git a/_templates/layout.html b/_templates/layout.html index 1c632de63f..fc120ef502 100644 --- a/_templates/layout.html +++ b/_templates/layout.html @@ -1,5 +1,23 @@ {% extends "!layout.html" %} + + +{% 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 %} + +
    {{ toc }}
    + {% endif %} +{% endblock %} + + + {%- block content %} {{ super() }}