Problem
LightningDataModule을 만들어서 Trainer에 직접 넣는 것은 해봤지만, predict할 때도 이용을 해보고 싶어서 이거저거 찾던 와중에 대부분의 코드는 다음처럼 batch를 불러오는 것을 확인했다.
dl = AutoEncoderDataLoader(root = data_path, batchsize=128)
dl.setup()
next(iter(dl))
근데 난 for loop으로 돌리고 싶어졌다. 단순히 그 이유였다.
Solution
for batch in dl.train_dataloader():
#do something
간단하다.
'인공지능 > Python' 카테고리의 다른 글
gray scale image to RGB image (using opencv) (0) | 2022.05.16 |
---|---|
AttributeError: 'YourDataModule' object has no attribute '_has_prepared_data' 해결방법 (0) | 2022.05.13 |
Warning: find_unused_parameters=True 해결방법 (DDP programming) (0) | 2022.05.13 |
Data Parallel(DP), Distributed Data Parallel(DDP)의 차이 (0) | 2022.05.04 |
Tensorflow/Keras Out of memory 해결 (0) | 2021.07.14 |