-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PyTorch v1.13 λ°μ, pytorch/tutorials@db34a77 (#615)
- Loading branch information
Showing
122 changed files
with
6,802 additions
and
1,540 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
from pathlib import Path | ||
from typing import List | ||
|
||
from bs4 import BeautifulSoup | ||
|
||
REPO_ROOT = Path(__file__).parent.parent | ||
|
||
# For every tutorial on this list, we should determine if it is ok to not run the tutorial (add a comment after | ||
# the file name to explain why, like intro.html), or fix the tutorial and remove it from this list). | ||
|
||
NOT_RUN = [ | ||
"basics/intro", # no code | ||
"translation_transformer", | ||
"profiler", | ||
"saving_loading_models", | ||
"introyt/captumyt", | ||
"introyt/trainingyt", | ||
"examples_nn/polynomial_module", | ||
"examples_nn/dynamic_net", | ||
"examples_nn/polynomial_optim", | ||
"former_torchies/autograd_tutorial_old", | ||
"former_torchies/tensor_tutorial_old", | ||
"examples_autograd/polynomial_autograd", | ||
"examples_autograd/polynomial_custom_function", | ||
"parametrizations", | ||
"mnist_train_nas", # used by ax_multiobjective_nas_tutorial.py | ||
"fx_conv_bn_fuser", | ||
"super_resolution_with_onnxruntime", | ||
"ddp_pipeline", # requires 4 gpus | ||
"fx_graph_mode_ptq_dynamic", | ||
"vmap_recipe", | ||
"torchscript_freezing", | ||
"nestedtensor", | ||
"recipes/saving_and_loading_models_for_inference", | ||
"recipes/saving_multiple_models_in_one_file", | ||
"recipes/loading_data_recipe", | ||
"recipes/tensorboard_with_pytorch", | ||
"recipes/what_is_state_dict", | ||
"recipes/profiler_recipe", | ||
"recipes/save_load_across_devices", | ||
"recipes/warmstarting_model_using_parameters_from_a_different_model", | ||
"recipes/dynamic_quantization", | ||
"recipes/saving_and_loading_a_general_checkpoint", | ||
"recipes/benchmark", | ||
"recipes/tuning_guide", | ||
"recipes/zeroing_out_gradients", | ||
"recipes/defining_a_neural_network", | ||
"recipes/timer_quick_start", | ||
"recipes/amp_recipe", | ||
"recipes/Captum_Recipe", | ||
"hyperparameter_tuning_tutorial", | ||
"flask_rest_api_tutorial", | ||
"text_to_speech_with_torchaudio", | ||
] | ||
|
||
|
||
def tutorial_source_dirs() -> List[Path]: | ||
return [ | ||
p.relative_to(REPO_ROOT).with_name(p.stem[:-7]) | ||
for p in REPO_ROOT.glob("*_source") | ||
] | ||
|
||
|
||
def main() -> None: | ||
docs_dir = REPO_ROOT / "docs" | ||
html_file_paths = [] | ||
for tutorial_source_dir in tutorial_source_dirs(): | ||
glob_path = f"{tutorial_source_dir}/**/*.html" | ||
html_file_paths += docs_dir.glob(glob_path) | ||
|
||
did_not_run = [] | ||
for html_file_path in html_file_paths: | ||
with open(html_file_path, "r", encoding="utf-8") as html_file: | ||
html = html_file.read() | ||
html_soup = BeautifulSoup(html, "html.parser") | ||
elems = html_soup.find_all("p", {"class": "sphx-glr-timing"}) | ||
for elem in elems: | ||
if ( | ||
"Total running time of the script: ( 0 minutes 0.000 seconds)" | ||
in elem.text | ||
and not any( | ||
html_file_path.match(file) for file in NOT_RUN | ||
) | ||
): | ||
did_not_run.append(html_file_path.as_posix()) | ||
|
||
if len(did_not_run) != 0: | ||
raise RuntimeError( | ||
"The following file(s) are not known bad but ran in 0.000 sec, meaning that any " | ||
+ "python code in this tutorial probably didn't run:\n{}".format( | ||
"\n".join(did_not_run) | ||
) | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* sphinx-design styles for cards/tabs | ||
*/ | ||
|
||
:root { | ||
--sd-color-info: #ee4c2c; | ||
--sd-color-primary: #6c6c6d; | ||
--sd-color-primary-highlight: #f3f4f7; | ||
--sd-color-card-border-hover: #ee4c2c; | ||
--sd-color-card-border: #f3f4f7; | ||
--sd-color-card-background: #fff; | ||
--sd-color-card-text: inherit; | ||
--sd-color-card-header: transparent; | ||
--sd-color-card-footer: transparent; | ||
--sd-color-tabs-label-active: hsla(231, 99%, 66%, 1); | ||
--sd-color-tabs-label-hover: hsla(231, 99%, 66%, 1); | ||
--sd-color-tabs-label-inactive: hsl(0, 0%, 66%); | ||
--sd-color-tabs-underline-active: hsla(231, 99%, 66%, 1); | ||
--sd-color-tabs-underline-hover: rgba(178, 206, 245, 0.62); | ||
--sd-color-tabs-underline-inactive: transparent; | ||
--sd-color-tabs-overline: rgb(222, 222, 222); | ||
--sd-color-tabs-underline: rgb(222, 222, 222); | ||
} | ||
|
||
.sd-text-info { | ||
color: #ee4c2c; | ||
} | ||
|
||
|
||
.sd-card { | ||
position: relative; | ||
background-color: #fff; | ||
opacity: 1.0; | ||
border-radius: 0px; | ||
width: 30%; | ||
border: none; | ||
padding-bottom: 0px; | ||
} | ||
|
||
|
||
.sd-card-img { | ||
opacity: 0.5; | ||
width: 200px; | ||
padding: 0px; | ||
} | ||
|
||
.sd-card-img:hover { | ||
opacity: 1.0; | ||
background-color: #f3f4f7; | ||
} | ||
|
||
|
||
.sd-card:after { | ||
display: block; | ||
opacity: 1; | ||
content: ''; | ||
border-bottom: solid 1px #ee4c2c; | ||
background-color: #fff; | ||
transform: scaleX(0); | ||
transition: transform .250s ease-in-out; | ||
transform-origin: 0% 50%; | ||
} | ||
|
||
.sd-card:hover { | ||
background-color: #fff; | ||
opacity: 1; | ||
border-top: 1px solid #f3f4f7; | ||
border-left: 1px solid #f3f4f7; | ||
border-right: 1px solid #f3f4f7; | ||
} | ||
|
||
.sd-card:hover:after { | ||
transform: scaleX(1); | ||
} |
Oops, something went wrong.