pytorch: multi-gpu 사용 시 attribute 접근 방법

djlee·2023년 3월 14일
0

DDP를 이용하여 custom model을 학습할 때 model의 attribute에 접근하려면 아래와 같이 하면 돼요.

from torch.nn.parallel import DistributedDataParallel as DDP

model = DDP(model, device_ids=[device])
model.module.fit()

0개의 댓글