You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -75,9 +75,9 @@ Move your optimizers to the :meth:`~pytorch_lightning.core.lightning.LightningMo
75
75
--------
76
76
77
77
***************************************
78
-
4. Organize Validation Logic (optional)
78
+
4. (선택사항) 검증 로직 구성하기
79
79
***************************************
80
-
If you need a validation loop, configure how your validation routine behaves with a batch of validation data:
80
+
검증(validation) 루프가 필요하면, 검증 데이터를 묶음(batch)으로 가져와 검증하는 과정을 구성합니다:
81
81
82
82
.. testcode::
83
83
@@ -88,14 +88,14 @@ If you need a validation loop, configure how your validation routine behaves wit
88
88
val_loss = F.cross_entropy(y_hat, y)
89
89
self.log("val_loss", val_loss)
90
90
91
-
.. tip:: ``trainer.validate()`` loads the best checkpoint automatically by default if checkpointing was enabled during fitting.
91
+
.. tip:: 학습(fit) 중 체크포인트 기능이 켜진 경우 ``trainer.validate()`` 가 자동으로 최적의 체크포인트를 불러옵니다.
92
92
93
93
--------
94
94
95
95
************************************
96
-
5. Organize Testing Logic (optional)
96
+
5. (선택사항) 테스트 로직 구성하기
97
97
************************************
98
-
If you need a test loop, configure how your testing routine behaves with a batch of test data:
98
+
테스트(test) 루프가 필요하면, 테스트 데이터를 묶음(batch)으로 가져와 테스트하는 과정을 구성합니다:
99
99
100
100
.. testcode::
101
101
@@ -109,9 +109,9 @@ If you need a test loop, configure how your testing routine behaves with a batch
109
109
--------
110
110
111
111
****************************************
112
-
6. Configure Prediction Logic (optional)
112
+
6. (선택사항) 예측 로직 구성하기
113
113
****************************************
114
-
If you need a prediction loop, configure how your prediction routine behaves with a batch of test data:
114
+
예측(prediction) 루프가 필요하면, 테스트 데이터를 묶음(batch)으로 가져와 예측하는 과정을 구성합니다:
115
115
116
116
.. testcode::
117
117
@@ -124,14 +124,16 @@ If you need a prediction loop, configure how your prediction routine behaves wit
124
124
--------
125
125
126
126
******************************************
127
-
7. Remove any .cuda() or .to(device) Calls
127
+
7. .cuda() 또는 .to(device) 호출 제거하기
128
128
******************************************
129
129
130
-
Your :doc:`LightningModule <../common/lightning_module>` can automatically run on any hardware!
130
+
:doc:`LightningModule <../common/lightning_module>` 은 어떠한 하드웨어에서도 자동으로 실행됩니다!
131
131
132
-
If you have any explicit calls to ``.cuda()`` or ``.to(device)``, you can remove them since Lightning makes sure that the data coming from :class:`~torch.utils.data.DataLoader`
133
-
and all the :class:`~torch.nn.Module` instances initialized inside ``LightningModule.__init__`` are moved to the respective devices automatically.
134
-
If you still need to access the current device, you can use ``self.device`` anywhere in your ``LightningModule`` except in the ``__init__`` and ``setup`` methods.
132
+
``LightningModule.__init__`` 내에서 초기화된 :class:`~torch.nn.Module` 인스턴스들과 :class:`~torch.utils.data.DataLoader` 에서 가져온 데이터는
133
+
Lightning이 자동으로 해당 장치로 이동해서 실행하므로, 기존에 명시적으로 ``.cuda()`` 또는 ``.to(device)`` 을 호출하는 부분은 제거해도 됩니다.
134
+
135
+
그럼에도 장치(device)에 직접 접근해야 할 필요가 있다면, ``LightningModule`` 내부에서 (``__init__`` 과 ``setup`` 메소드를 제외하고) 아무데서나
136
+
``self.device`` 를 사용하면 됩니다.
135
137
136
138
.. testcode::
137
139
@@ -140,8 +142,8 @@ If you still need to access the current device, you can use ``self.device`` anyw
140
142
z = torch.randn(4, 5, device=self.device)
141
143
...
142
144
143
-
Hint: If you are initializing a :class:`~torch.Tensor` within the ``LightningModule.__init__`` method and want it to be moved to the device automatically you should call
144
-
:meth:`~torch.nn.Module.register_buffer` to register it as a parameter.
145
+
Hint: ``LightningModule.__init__`` 메소드 내에서 :class:`~torch.Tensor` 를 초기화하면서 자동으로 장치(device)로 이동하려면
146
+
:meth:`~torch.nn.Module.register_buffer` 를 호출하여 매개변수로 등록하면 됩니다.
145
147
146
148
.. testcode::
147
149
@@ -152,46 +154,48 @@ Hint: If you are initializing a :class:`~torch.Tensor` within the ``LightningMod
152
154
153
155
--------
154
156
155
-
********************
156
-
8. Use your own data
157
-
********************
158
-
Regular PyTorch DataLoaders work with Lightning. For more modular and scalable datasets, check out :doc:`LightningDataModule <../data/datamodule>`.
157
+
*************************
158
+
8. 기존 데이터 사용하기
159
+
*************************
160
+
일반적인 PyTorch DataLoader는 Lightning에서 동작합니다. 더 모듈화되고 확장 가능한 데이터셋들은 :doc:`LightningDataModule <../data/datamodule>` 를
161
+
참고하세요.
159
162
160
163
----
161
164
162
165
************
163
-
Good to know
166
+
더 알아두기
164
167
************
165
168
166
-
Additionally, you can run only the validation loop using :meth:`~pytorch_lightning.trainer.trainer.Trainer.validate` method.
169
+
추가로, :meth:`~pytorch_lightning.trainer.trainer.Trainer.validate` 메소드를 사용하면 검증(validation) 루프만 실행할 수 있습니다.
167
170
168
171
.. code-block:: python
169
172
170
173
model = LitModel()
171
174
trainer.validate(model)
172
175
173
-
.. note:: ``model.eval()`` and ``torch.no_grad()`` are called automatically for validation.
176
+
.. note:: ``model.eval()`` 와 ``torch.no_grad()`` 는 검증 시에 자동으로 호출됩니다.
174
177
175
178
176
-
The test loop isn't used within :meth:`~pytorch_lightning.trainer.trainer.Trainer.fit`, therefore, you would need to explicitly call :meth:`~pytorch_lightning.trainer.trainer.Trainer.test`.
179
+
테스트 루프(test loop)는 :meth:`~pytorch_lightning.trainer.trainer.Trainer.fit` 에서 사용되지 않으므로, 필요 시 명시적으로
180
+
:meth:`~pytorch_lightning.trainer.trainer.Trainer.test` 을 호출해야 합니다.
177
181
178
182
.. code-block:: python
179
183
180
184
model = LitModel()
181
185
trainer.test(model)
182
186
183
-
.. note:: ``model.eval()`` and ``torch.no_grad()`` are called automatically for testing.
187
+
.. note:: ``model.eval()`` 와 ``torch.no_grad()`` 는 테스트 시에 자동으로 호출됩니다.
184
188
185
-
.. tip:: ``trainer.test()`` loads the best checkpoint automatically by default if checkpointing is enabled.
189
+
.. tip:: 체크포인트 기능이 켜진 경우, ``trainer.test()`` 는 자동으로 최적의 체크포인트(best checkpoint)를 불러옵니다.
186
190
187
191
188
-
The predict loop will not be used until you call :meth:`~pytorch_lightning.trainer.trainer.Trainer.predict`.
192
+
예측 루프(prediction look)는 :meth:`~pytorch_lightning.trainer.trainer.Trainer.predict` 을 호출하기 전에는 사용되지 않습니다.
189
193
190
194
.. code-block:: python
191
195
192
196
model = LitModel()
193
197
trainer.predict(model)
194
198
195
-
.. note:: ``model.eval()`` and ``torch.no_grad()`` are called automatically for testing.
199
+
.. note:: ``model.eval()`` 과 ``torch.no_grad()`` 는 예측 시에 자동으로 호출됩니다.
196
200
197
-
.. tip:: ``trainer.predict()`` loads the best checkpoint automatically by default if checkpointing is enabled.
201
+
.. tip:: 체크포인트 기능이 켜진 경우, ``trainer.predict()`` 는 자동으로 최적의 체크포인트를 불러옵니다.
0 commit comments