Skip to content

Commit

Permalink
PyTorch v1.13 반영, pytorch/tutorials@db34a77 (#615)
Browse files Browse the repository at this point in the history
  • Loading branch information
9bow committed Nov 30, 2022
1 parent bb04c46 commit ff0befc
Show file tree
Hide file tree
Showing 122 changed files with 6,802 additions and 1,540 deletions.
97 changes: 97 additions & 0 deletions .build/validate_tutorials_built.py
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()
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/1_TRANSLATE_REQUEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ _(λ°˜λ“œμ‹œ 지킀셔야 ν•˜λŠ” 일정이 μ•„λ‹™λ‹ˆλ‹€ - 일정이 λ„ˆλ¬΄ λŠ¦μ–΄
## κ΄€λ ¨ 이슈
_ν˜„μž¬ λ²ˆμ—­ μš”μ²­ / 진행 내역을 보기 μœ„ν•΄ 각 λ²„μ „μ˜ 메인 이슈λ₯Ό μ°Έμ‘°ν•©λ‹ˆλ‹€._ <br />
_(νŠΉλ³„ν•œ 일이 μ—†λ‹€λ©΄ λ³€κ²½ν•˜μ§€ μ•ŠμœΌμ…”λ„ λ©λ‹ˆλ‹€.)_
* κ΄€λ ¨ 이슈: #483 (v1.12)
* κ΄€λ ¨ 이슈: #615 (v1.13)
34 changes: 19 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ download:

# NOTE: Please consider using the Step1 and one of Step2 for new dataset,
# [something] should be replaced with the actual value.
# Step1. DOWNLOAD: wget -N [SOURCE_FILE] -P $(DATADIR)
# Step1. DOWNLOAD: wget -nv -N [SOURCE_FILE] -P $(DATADIR)
# Step2-1. UNZIP: unzip -o $(DATADIR)/[SOURCE_FILE] -d [*_source/data/]
# Step2-2. UNTAR: tar -xzf $(DATADIR)/[SOURCE_FILE] -C [*_source/data/]
# Step2-3. AS-IS: cp $(DATADIR)/[SOURCE_FILE] [*_source/data/]
Expand All @@ -46,18 +46,18 @@ download:
mkdir -p prototype_source/data

# transfer learning tutorial data
wget -N https://download.pytorch.org/tutorial/hymenoptera_data.zip -P $(DATADIR)
wget -nv -N https://download.pytorch.org/tutorial/hymenoptera_data.zip -P $(DATADIR)
unzip $(ZIPOPTS) $(DATADIR)/hymenoptera_data.zip -d beginner_source/data/

# nlp tutorial data
wget -N https://download.pytorch.org/tutorial/data.zip -P $(DATADIR)
wget -nv -N https://download.pytorch.org/tutorial/data.zip -P $(DATADIR)
unzip $(ZIPOPTS) $(DATADIR)/data.zip -d intermediate_source/ # This will unzip all files in data.zip to intermediate_source/data/ folder

# data loader tutorial
wget -N https://download.pytorch.org/tutorial/faces.zip -P $(DATADIR)
wget -nv -N https://download.pytorch.org/tutorial/faces.zip -P $(DATADIR)
unzip $(ZIPOPTS) $(DATADIR)/faces.zip -d beginner_source/data/

wget -N https://download.pytorch.org/models/tutorials/4000_checkpoint.tar -P $(DATADIR)
wget -nv -N https://download.pytorch.org/models/tutorials/4000_checkpoint.tar -P $(DATADIR)
cp $(DATADIR)/4000_checkpoint.tar beginner_source/data/

# neural style images
Expand All @@ -66,41 +66,45 @@ download:
cp -r _static/img/neural-style/ advanced_source/data/images/

# Download dataset for beginner_source/dcgan_faces_tutorial.py
wget -N https://s3.amazonaws.com/pytorch-tutorial-assets/img_align_celeba.zip -P $(DATADIR)
wget -nv -N https://s3.amazonaws.com/pytorch-tutorial-assets/img_align_celeba.zip -P $(DATADIR)
unzip $(ZIPOPTS) $(DATADIR)/img_align_celeba.zip -d beginner_source/data/celeba

# Download dataset for beginner_source/hybrid_frontend/introduction_to_hybrid_frontend_tutorial.py
wget -N https://s3.amazonaws.com/pytorch-tutorial-assets/iris.data -P $(DATADIR)
wget -nv -N https://s3.amazonaws.com/pytorch-tutorial-assets/iris.data -P $(DATADIR)
cp $(DATADIR)/iris.data beginner_source/data/

# Download dataset for beginner_source/chatbot_tutorial.py
wget -N https://s3.amazonaws.com/pytorch-tutorial-assets/cornell_movie_dialogs_corpus.zip -P $(DATADIR)
unzip $(ZIPOPTS) $(DATADIR)/cornell_movie_dialogs_corpus.zip -d beginner_source/data/
wget -nv -N https://s3.amazonaws.com/pytorch-tutorial-assets/cornell_movie_dialogs_corpus_v2.zip -P $(DATADIR)
unzip $(ZIPOPTS) $(DATADIR)/cornell_movie_dialogs_corpus_v2.zip -d beginner_source/data/

# Download dataset for beginner_source/audio_classifier_tutorial.py
wget -N https://s3.amazonaws.com/pytorch-tutorial-assets/UrbanSound8K.tar.gz -P $(DATADIR)
wget -nv -N https://s3.amazonaws.com/pytorch-tutorial-assets/UrbanSound8K.tar.gz -P $(DATADIR)
tar $(TAROPTS) -xzf $(DATADIR)/UrbanSound8K.tar.gz -C ./beginner_source/data/

# Download model for beginner_source/fgsm_tutorial.py
wget -N https://s3.amazonaws.com/pytorch-tutorial-assets/lenet_mnist_model.pth -P $(DATADIR)
wget -nv -N https://s3.amazonaws.com/pytorch-tutorial-assets/lenet_mnist_model.pth -P $(DATADIR)
cp $(DATADIR)/lenet_mnist_model.pth ./beginner_source/data/lenet_mnist_model.pth

# Download model for advanced_source/dynamic_quantization_tutorial.py
wget -N https://s3.amazonaws.com/pytorch-tutorial-assets/word_language_model_quantize.pth -P $(DATADIR)
wget -nv -N https://s3.amazonaws.com/pytorch-tutorial-assets/word_language_model_quantize.pth -P $(DATADIR)
cp $(DATADIR)/word_language_model_quantize.pth advanced_source/data/word_language_model_quantize.pth

# Download data for advanced_source/dynamic_quantization_tutorial.py
wget -N https://s3.amazonaws.com/pytorch-tutorial-assets/wikitext-2.zip -P $(DATADIR)
wget -nv -N https://s3.amazonaws.com/pytorch-tutorial-assets/wikitext-2.zip -P $(DATADIR)
unzip $(ZIPOPTS) $(DATADIR)/wikitext-2.zip -d advanced_source/data/

# Download model for advanced_source/static_quantization_tutorial.py
wget -N https://download.pytorch.org/models/mobilenet_v2-b0353104.pth -P $(DATADIR)
wget -nv -N https://download.pytorch.org/models/mobilenet_v2-b0353104.pth -P $(DATADIR)
cp $(DATADIR)/mobilenet_v2-b0353104.pth advanced_source/data/mobilenet_pretrained_float.pth

# Download model for prototype_source/graph_mode_static_quantization_tutorial.py
wget -N https://download.pytorch.org/models/resnet18-5c106cde.pth -P $(DATADIR)
wget -nv -N https://download.pytorch.org/models/resnet18-5c106cde.pth -P $(DATADIR)
cp $(DATADIR)/resnet18-5c106cde.pth prototype_source/data/resnet18_pretrained_float.pth

# Download vocab for beginner_source/flava_finetuning_tutorial.py
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 some dataset for beginner_source/translation_transformer.py
python -m spacy download en_core_web_sm
python -m spacy download de_core_news_sm
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
## μ†Œκ°œ

PyTorchμ—μ„œ μ œκ³΅ν•˜λŠ” νŠœν† λ¦¬μ–Όμ˜ ν•œκ΅­μ–΄ λ²ˆμ—­μ„ μœ„ν•œ μ €μž₯μ†Œμž…λ‹ˆλ‹€.\
λ²ˆμ—­μ˜ 결과물은 [https://tutorials.pytorch.kr](https://tutorials.pytorch.kr)μ—μ„œ ν™•μΈν•˜μ‹€ 수 μžˆμŠ΅λ‹ˆλ‹€. (λ²ˆμ—­μ„ μ§„ν–‰ν•˜λ©° **λΆˆκ·œμΉ™μ μœΌλ‘œ** μ—…λ°μ΄νŠΈν•©λ‹ˆλ‹€.)\
ν˜„μž¬ λ²„μ „μ˜ λ²ˆμ—­ / λ³€κ²½ κ΄€λ ¨ μ΄μŠˆλŠ” [#483 이슈](https://github.com/PyTorchKorea/tutorials-kr/issues/483)λ₯Ό μ°Έκ³ ν•΄μ£Όμ„Έμš”.
λ²ˆμ—­μ˜ 결과물은 [https://tutorials.pytorch.kr](https://tutorials.pytorch.kr)μ—μ„œ ν™•μΈν•˜μ‹€ 수 μžˆμŠ΅λ‹ˆλ‹€. (λ²ˆμ—­μ„ μ§„ν–‰ν•˜λ©° **λΉ„μ •κΈ°μ μœΌλ‘œ** λ°˜μ˜ν•©λ‹ˆλ‹€.)\
ν˜„μž¬ λ²„μ „μ˜ λ²ˆμ—­ / λ³€κ²½ κ΄€λ ¨ μ΄μŠˆλŠ” [#615 이슈](https://github.com/PyTorchKorea/tutorials-kr/issues/615)λ₯Ό μ°Έκ³ ν•΄μ£Όμ„Έμš”.

## κΈ°μ—¬ν•˜κΈ°

Expand All @@ -22,7 +22,7 @@ PyTorchμ—μ„œ μ œκ³΅ν•˜λŠ” νŠœν† λ¦¬μ–Όμ˜ ν•œκ΅­μ–΄ λ²ˆμ—­μ„ μœ„ν•œ μ €μž₯μ†Œ

## 원문

ν˜„μž¬ PyTorch v1.12 νŠœν† λ¦¬μ–Ό([pytorch/tutorials@0918023](https://github.com/pytorch/tutorials/commit/091802395ed6cc5563643b6b6ef54ba99d412e66) κΈ°μ€€) λ²ˆμ—­μ΄ 진행 μ€‘μž…λ‹ˆλ‹€.
ν˜„μž¬ PyTorch v1.13 νŠœν† λ¦¬μ–Ό([pytorch/tutorials@db34a77](https://github.com/pytorch/tutorials/commit/db34a779242f1a71346db4a9e5d6ac962a8d9b77) κΈ°μ€€) λ²ˆμ—­μ΄ 진행 μ€‘μž…λ‹ˆλ‹€.

μ΅œμ‹  λ²„μ „μ˜ νŠœν† λ¦¬μ–Ό(곡식, μ˜μ–΄)은 [PyTorch tutorials μ‚¬μ΄νŠΈ](https://pytorch.org/tutorials) 및 [PyTorch tutorials μ €μž₯μ†Œ](https://github.com/pytorch/tutorials)λ₯Ό μ°Έκ³ ν•΄μ£Όμ„Έμš”.

Expand All @@ -46,5 +46,5 @@ v1.0 이후 λ²ˆμ—­μ€ 별도 μ €μž₯μ†Œλ‘œ κ΄€λ¦¬ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. [이 μ €μž₯
λΉŒλ“œ 방법은 [κΈ°μ—¬ν•˜κΈ° λ¬Έμ„œμ˜ `2-5. (λ‚΄ μ»΄ν“¨ν„°μ—μ„œ) κ²°κ³Ό ν™•μΈν•˜κΈ°`](https://github.com/PyTorchKorea/tutorials-kr/blob/master/CONTRIBUTING.md#2-5-λ‚΄-μ»΄ν“¨ν„°μ—μ„œ-κ²°κ³Ό-ν™•μΈν•˜κΈ°) 뢀뢄을 μ°Έκ³ ν•΄μ£Όμ„Έμš”.

---
This is a project to translate [pytorch/tutorials@0918023](https://github.com/pytorch/tutorials/commit/091802395ed6cc5563643b6b6ef54ba99d412e66) into Korean.
This is a project to translate [pytorch/tutorials@db34a77](https://github.com/pytorch/tutorials/commit/db34a779242f1a71346db4a9e5d6ac962a8d9b77) into Korean.
For the latest version, please visit to the [official PyTorch tutorials repo](https://github.com/pytorch/tutorials).
73 changes: 73 additions & 0 deletions _static/css/custom.css
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);
}
Loading

0 comments on commit ff0befc

Please sign in to comment.