Skip to content

Commit acb4f2c

Browse files
authored
Merge branch 'main' into transformer
2 parents 5195537 + 3d5b75a commit acb4f2c

File tree

67 files changed

+537
-5508
lines changed

Some content is hidden

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

67 files changed

+537
-5508
lines changed

.ci/docker/Dockerfile

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,11 @@ RUN bash ./install_user.sh && rm install_user.sh
1515
COPY ./common/install_docs_reqs.sh install_docs_reqs.sh
1616
RUN bash ./install_docs_reqs.sh && rm install_docs_reqs.sh
1717

18-
# Install conda and other packages
19-
ENV ANACONDA_PYTHON_VERSION=3.10
20-
ENV CONDA_CMAKE yes
21-
ENV DOCS yes
22-
ENV PATH /opt/conda/envs/py_$ANACONDA_PYTHON_VERSION/bin:/opt/conda/bin:$PATH
23-
COPY ./requirements.txt /opt/conda/
24-
COPY ./common/install_conda.sh install_conda.sh
25-
COPY ./common/common_utils.sh common_utils.sh
26-
RUN bash ./install_conda.sh && rm install_conda.sh common_utils.sh /opt/conda/requirements.txt
18+
COPY ./common/install_pip_requirements.sh install_pip_requirements.sh
19+
COPY ./requirements.txt requirements.txt
20+
RUN bash ./install_pip_requirements.sh && rm install_pip_requirements.sh
21+
22+
RUN ln -s /usr/bin/python3 /usr/bin/python
2723

2824
USER ci-user
2925
CMD ["bash"]

.ci/docker/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set -exu
1010
IMAGE_NAME="$1"
1111
shift
1212

13-
export UBUNTU_VERSION="20.04"
13+
export UBUNTU_VERSION="22.04"
1414
export CUDA_VERSION="12.4.1"
1515

1616
export BASE_IMAGE="nvidia/cuda:${CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION}"

.ci/docker/common/common_utils.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

.ci/docker/common/install_base.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ install_ubuntu() {
1010
apt-get install -y --no-install-recommends \
1111
build-essential \
1212
ca-certificates \
13-
cmake=3.16* \
13+
cmake=3.22* \
1414
curl \
1515
git \
1616
wget \
@@ -27,7 +27,9 @@ install_ubuntu() {
2727
libglfw3-dev \
2828
sox \
2929
libsox-dev \
30-
libsox-fmt-all
30+
libsox-fmt-all \
31+
python3-pip \
32+
python3-dev
3133

3234
# Cleanup package manager
3335
apt-get autoclean && apt-get clean

.ci/docker/common/install_conda.sh

Lines changed: 0 additions & 55 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
5+
# Install pip packages
6+
pip install --upgrade pip
7+
pip install -r ./requirements.txt

.jenkins/validate_tutorials_built.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
NOT_RUN = [
1212
"beginner_source/basics/intro", # no code
13+
"beginner_source/introyt/introyt_index", # no code
1314
"beginner_source/onnx/intro_onnx",
1415
"beginner_source/profiler",
1516
"beginner_source/saving_loading_models",

.lycheeignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ file:///f:/libtmp/some_file
66

77
#Ignore links with "file:///" to catch any other example links
88
file:\/\/\/.*
9+
10+
# Ignore colab link in the setting of conf.py
11+
https://pytorch.org/tutorials/beginner/colab/n

_static/css/custom2.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,21 @@
1717
margin-bottom: 5px;
1818
}
1919
}
20+
21+
/* Left nav for 2nd level nav */
22+
23+
.pytorch-left-menu li.toctree-l2 {
24+
padding-left: 10px;
25+
}
26+
27+
.pytorch-left-menu li.toctree-l2.current > a, {
28+
color: #ee4c2c;
29+
}
30+
31+
.pytorch-left-menu li.toctree-l2.current a:link.reference.internal {
32+
color: #ee4c2c;
33+
}
34+
35+
.pytorch-left-menu li.toctree-l1.current > a:before {
36+
content: "";
37+
}

_static/js/custom.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
document.addEventListener("DOMContentLoaded", function() {
2+
// Select all <li> elements with the class "toctree-l1"
3+
var toctreeItems = document.querySelectorAll('li.toctree-l1');
4+
5+
toctreeItems.forEach(function(item) {
6+
// Find the link within the item
7+
var link = item.querySelector('a');
8+
var nestedList = item.querySelector('ul');
9+
10+
if (link && nestedList) {
11+
// Create a span element for the "[+]" or "[-]" sign
12+
var expandSign = document.createElement('span');
13+
expandSign.style.cursor = 'pointer'; // Make it look clickable
14+
15+
// Use the link text as a unique key for localStorage
16+
var sectionKey = 'section_' + link.textContent.trim().replace(/\s+/g, '_');
17+
18+
// Retrieve the saved state from localStorage
19+
var isExpanded = localStorage.getItem(sectionKey);
20+
21+
// If no state is saved, default to expanded for "Learn the Basics" and collapsed for others
22+
if (isExpanded === null) {
23+
isExpanded = (link.textContent.trim() === 'Learn the Basics') ? 'true' : 'false';
24+
localStorage.setItem(sectionKey, isExpanded);
25+
}
26+
27+
if (isExpanded === 'true') {
28+
nestedList.style.display = 'block'; // Expand the section
29+
expandSign.textContent = '[-] '; // Show "[-]" since it's expanded
30+
} else {
31+
nestedList.style.display = 'none'; // Collapse the section
32+
expandSign.textContent = '[+] '; // Show "[+]" since it's collapsed
33+
}
34+
35+
// Add a click event to toggle the nested list
36+
expandSign.addEventListener('click', function() {
37+
if (nestedList.style.display === 'none') {
38+
nestedList.style.display = 'block';
39+
expandSign.textContent = '[-] '; // Change to "[-]" when expanded
40+
localStorage.setItem(sectionKey, 'true'); // Save state
41+
} else {
42+
nestedList.style.display = 'none';
43+
expandSign.textContent = '[+] '; // Change back to "[+]" when collapsed
44+
localStorage.setItem(sectionKey, 'false'); // Save state
45+
}
46+
});
47+
48+
// Insert the sign before the link
49+
link.parentNode.insertBefore(expandSign, link);
50+
}
51+
});
52+
});

_templates/layout.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
{% extends "!layout.html" %}
22

3+
4+
<!-- Overrides needed for the multilevel nav -->
5+
{% block menu %}
6+
{% if 'singlehtml' not in builder %}
7+
{% set global_toc = toctree(collapse=theme_collapse_navigation|tobool,
8+
includehidden=theme_includehidden|tobool,
9+
titles_only=True) %}
10+
{% endif %}
11+
{% if global_toc %}
12+
{{ global_toc }}
13+
{% else %}
14+
<!-- Local TOC -->
15+
<div class="local-toc">{{ toc }}</div>
16+
{% endif %}
17+
{% endblock %}
18+
<!-- End of overrides needed for the multilevel nav -->
19+
20+
321
{%- block content %}
422
{{ super() }}
523
<script>
@@ -29,6 +47,7 @@
2947
</div>
3048
{% endblock %}
3149

50+
3251
{% block footer %}
3352
{{ super() }}
3453
<script>

0 commit comments

Comments
 (0)