Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

levels/basic 번역 #10

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions source/common/evaluation_basic.rst
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
:orphan:

#################################
Validate and test a model (basic)
모델 검증하고 테스트하기 (기본)
#################################
**Audience**: Users who want to add a validation loop to avoid overfitting
**예상 독자**: 과적합(overfit)을 방지하기 위해 검증 단계를 추가하려는 사용자

----

***************
Add a test loop
***************
To make sure a model can generalize to an unseen dataset (ie: to publish a paper or in a production environment) a dataset is normally split into two parts, the *train* split and the *test* split.
*********************
테스트 단계 추가하기
*********************
모델이 학습하지 않은(unseen) 데이터셋에서도 일반화(generalize)되는지(예: 논문을 게재하거나 프로덕션 환경에서) 확인하기 위해, 일반적으로 데이터셋을 *학습용* 과 *테스트용* 의 두 부분으로 분할합니다.

The test set is **NOT** used during training, it is **ONLY** used once the model has been trained to see how the model will do in the real-world.
테스트셋은 학습에 사용하지 **않으며**, 학습된 모델이 실세계에서 얼마나 잘 동작하는지를 **평가하는데만** 사용합니다.

----

Find the train and test splits
==============================
Datasets come with two splits. Refer to the dataset documentation to find the *train* and *test* splits.
학습용과 테스트용 찾아보기
=================================
데이터셋은 두 부분으로 나뉘어 있습니다. 데이터셋 문서를 참고하여 *학습용* 과 *테스트용* 분할(split)을 찾아보세요.

.. code-block:: python

import torch.utils.data as data
from torchvision import datasets

# Load data sets
# 데이터셋
train_set = datasets.MNIST(root="MNIST", download=True, train=True)
test_set = datasets.MNIST(root="MNIST", download=True, train=False)

----

Define the test loop
====================
To add a test loop, implement the **test_step** method of the LightningModule
테스트 단계(loop) 정의하기
============================
LightningModule의 **test_step** 메소드를 구현하여 테스트 단계(loop)를 추가합니다.

.. code:: python

Expand All @@ -42,7 +42,7 @@ To add a test loop, implement the **test_step** method of the LightningModule
...

def test_step(self, batch, batch_idx):
# this is the test loop
# 여기가 테스트하는 부분입니다.
x, y = batch
x = x.view(x.size(0), -1)
z = self.encoder(x)
Expand All @@ -52,48 +52,48 @@ To add a test loop, implement the **test_step** method of the LightningModule

----

Train with the test loop
========================
Once the model has finished training, call **.test**
테스트 단계를 포함하여 학습하기
==================================
모델이 학습을 끝내고 난 뒤에, **.test** 를 호출합니다.

.. code-block:: python

from torch.utils.data import DataLoader

# initialize the Trainer
# Trainer 초기화하기
trainer = Trainer()

# test the model
# 모델 테스트하기
trainer.test(model, dataloaders=DataLoader(test_set))

----

*********************
Add a validation loop
검증 단계 추가하기
*********************
During training, it's common practice to use a small portion of the train split to determine when the model has finished training.
학습 중, 모델이 학습을 완료하는 시점을 판단하기 위해 학습 데이터의 작은 부분을 사용하는 것이 일반적입니다.

----

Split the training data
학습용 데이터 분할하기
=======================
As a rule of thumb, we use 20% of the training set as the **validation set**. This number varies from dataset to dataset.
일반적으로 학습 데이터셋의 20% 가량을 **검증용셋** 으로 사용합니다. 이 숫자는 데이터셋에 따라 달라집니다.

.. code-block:: python

# use 20% of training data for validation
# 학습용 데이터의 20%를 검증용으로 사용합니다.
train_set_size = int(len(train_set) * 0.8)
valid_set_size = len(train_set) - train_set_size

# split the train set into two
# 학습용 세트를 2개로 나눕니다.
seed = torch.Generator().manual_seed(42)
train_set, valid_set = data.random_split(train_set, [train_set_size, valid_set_size], generator=seed)

----

Define the validation loop
검증 단계 정의하기
==========================
To add a validation loop, implement the **validation_step** method of the LightningModule
LightningModule의 **validation_step** 메소드를 구현하여 검증 단계(loop)를 추가합니다.

.. code:: python

Expand All @@ -102,7 +102,7 @@ To add a validation loop, implement the **validation_step** method of the Lightn
...

def validation_step(self, batch, batch_idx):
# this is the validation loop
# 여기가 검증하는 부분입니다
x, y = batch
x = x.view(x.size(0), -1)
z = self.encoder(x)
Expand All @@ -112,9 +112,9 @@ To add a validation loop, implement the **validation_step** method of the Lightn

----

Train with the validation loop
검증 단계를 포함하여 학습하기
==============================
To run the validation loop, pass in the validation set to **.fit**
검증 단계를 실행하기 위해, **.fit** 호출 시에 검증용 데이터를 함께 전달합니다.

.. code-block:: python

Expand All @@ -123,6 +123,6 @@ To run the validation loop, pass in the validation set to **.fit**
train_set = DataLoader(train_set)
val_set = DataLoader(val_set)

# train with both splits
# 학습 데이터와 검증 데이터 모두를 사용하여 학습합니다.
trainer = Trainer()
trainer.fit(model, train_set, val_set)
6 changes: 3 additions & 3 deletions source/levels/basic_level_2.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
:orphan:

######################################
Level 2: Add a validation and test set
######################################
###########################################
Level 2: 검증 세트와 테스트 세트 추가하기
###########################################

.. raw:: html

Expand Down
29 changes: 15 additions & 14 deletions source/levels/core_skills.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

############
Basic skills
핵심 기술
############
Learn the basics of model development with Lightning. Researchers and machine learning engineers should start here.

Lightning을 사용하여 모델 개발의 기본을 배워보세요. 연구자와 머신러닝 엔지니어는 여기서부터 시작하시길 권합니다.

.. join_slack::
:align: left
Expand All @@ -17,48 +18,48 @@ Learn the basics of model development with Lightning. Researchers and machine le
.. Add callout items below this line

.. displayitem::
:header: Level 1: Train a model
:description: Learn the basics of training a model.
:header: Level 1: 모델 학습하기
:description: 모델 학습의 기본을 배워보세요.
:button_link: ../model/train_model_basic.html
:col_css: col-md-6
:height: 150
:tag: basic

.. displayitem::
:header: Level 2: Add a validation and test set
:description: Add validation and test sets to avoid over/underfitting.
:header: Level 2: 검증 세트와 테스트 세트 추가하기
:description: 검증 세트와 테스트 세트를 추가하여 과적합/과소적합을 피하세요.
:button_link: /levels/basic_level_2.html
:col_css: col-md-6
:height: 150
:tag: basic

.. displayitem::
:header: Level 3: Use pretrained models
:description: Learn how to use pretrained models with Lightning
:header: Level 3: 사전학습된 모델 사용하기
:description: 라이트닝에서 어떻게 사전학습된 모델을 사용하는지 배워보세요.
:button_link: ../advanced/transfer_learning.html
:col_css: col-md-6
:height: 150
:tag: basic

.. displayitem::
:header: Level 4: Enable script parameters
:description: Add parameters to your script so you can run from the commandline.
:header: Level 4: 스크립트 매개변수 활성화하기
:description: 명령줄에서 스크립트를 실행할 수 있도록 매개변수를 추가하세요.
:button_link: ../common/hyperparameters.html
:col_css: col-md-6
:height: 150
:tag: basic

.. displayitem::
:header: Level 5: Understand and visualize your model
:description: Remove bottlenecks and visualize your model
:header: Level 5: 모델을 이해하고 시각화하기
:description: 병목(bottleneck)을 제거하고 모델을 시각화해보세요.
:button_link: ../levels/basic_level_5.html
:col_css: col-md-6
:height: 150
:tag: basic

.. displayitem::
:description: Use your model for predictions.
:header: Level 6: Predict with your model
:header: Level 6: 모델을 사용하여 예측하기
:description: 모델을 사용하여 예측해보세요.
:button_link: core_level_6.html
:col_css: col-md-6
:height: 150
Expand Down
44 changes: 22 additions & 22 deletions source/model/train_model_basic.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
:orphan:

#####################
Train a model (basic)
모델 학습하기 (기본)
#####################
**Audience**: Users who need to train a model without coding their own training loops.
**예상 독자**: 자체 학습 루프(loop)를 작성하지 않고 모델을 학습할 필요가 있는 사용자.

----

***********
Add imports
불러오기
***********
Add the relevant imports at the top of the file
파일의 가장 윗 부분에 관련 호출(import)을 추가합니다

.. code:: python

Expand All @@ -25,9 +25,9 @@ Add the relevant imports at the top of the file

----

*****************************
Define the PyTorch nn.Modules
*****************************
***************************************
파이토치(PyTorch) nn.Modules 정의하기
***************************************

.. code:: python

Expand All @@ -48,13 +48,13 @@ Define the PyTorch nn.Modules

----

************************
Define a LightningModule
************************
The LightningModule is the full **recipe** that defines how your nn.Modules interact.
**************************
LightningModule 정의하기
**************************
LightningModule은 nn.Module이 어떻게 동작할지 정의할 수 있는 완벽한 **비결(recipe)** 입니다.

- The **training_step** defines how the *nn.Modules* interact together.
- In the **configure_optimizers** define the optimizer(s) for your models.
- **training_step** *nn.Modules* 과 어떻게 상호 작용할 것인지 정의합니다.
- **configure_optimizers** 에서는 모델에서 사용할 옵티마이저(들)을 정의합니다.

.. code:: python

Expand All @@ -65,7 +65,7 @@ The LightningModule is the full **recipe** that defines how your nn.Modules inte
self.decoder = decoder

def training_step(self, batch, batch_idx):
# training_step defines the train loop.
# training_step은 학습 루프를 정의합니다.
x, y = batch
x = x.view(x.size(0), -1)
z = self.encoder(x)
Expand All @@ -80,9 +80,9 @@ The LightningModule is the full **recipe** that defines how your nn.Modules inte
----

***************************
Define the training dataset
학습 데이터셋 정의하기
***************************
Define a PyTorch :class:`~torch.utils.data.DataLoader` which contains your training dataset.
학습 데이터셋을 포함하고 있는 PyTorch :class:`~torch.utils.data.DataLoader` 를 정의합니다.

.. code-block:: python

Expand All @@ -92,9 +92,9 @@ Define a PyTorch :class:`~torch.utils.data.DataLoader` which contains your train
----

***************
Train the model
모델 학습하기
***************
To train the model use the Lightning :doc:`Trainer <../common/trainer>` which handles all the engineering and abstracts away all the complexity needed for scale.
모델 학습을 위해서는 Lightning :doc:`Trainer <../common/trainer>` 를 사용합니다. 이는 규모 확장 시에 필요한 모든 복잡성을 추상화하고 각종 엔지니어링을 담당합니다.

.. code-block:: python

Expand All @@ -108,9 +108,9 @@ To train the model use the Lightning :doc:`Trainer <../common/trainer>` which ha
----

***************************
Eliminate the training loop
학습 루프 제거하기
***************************
Under the hood, the Lightning Trainer runs the following training loop on your behalf
사용자를 대신하여 Lightning Trainer가 내부적으로 아래와 같은 학습 루프를 실행합니다.

.. code:: python

Expand All @@ -124,6 +124,6 @@ Under the hood, the Lightning Trainer runs the following training loop on your b
optimizer.step()
optimizer.zero_grad()

The power of Lightning comes when the training loop gets complicated as you add validation/test splits, schedulers, distributed training and all the latest SOTA techniques.
Lightning의 진가는 검증/테스트 분할(validation/test split), 스케줄러, 분산 학습 및 최신 SOTA 테크닉들을 추가하면서 학습 과정이 복잡해질 때 나타납니다.

With Lightning, you can add mix all these techniques together without needing to rewrite a new loop every time.
Lightning을 사용하면 매번 새로운 학습 루프를 작성할 필요없이 이러한 테크닉들을 모두 사용할 수 있습니다.