작심삼일

[Pytorch-lightning 에러] ImportError: cannot import name 'rank_zero_only' from 'pytorch_lightning.utilities.distributed' (/opt/conda/lib/python3.8/site-packages/pytorch_lightning/utilities/distributed.py) 본문

정리/잡 에러들

[Pytorch-lightning 에러] ImportError: cannot import name 'rank_zero_only' from 'pytorch_lightning.utilities.distributed' (/opt/conda/lib/python3.8/site-packages/pytorch_lightning/utilities/distributed.py)

yun_s 2023. 3. 22. 19:46
728x90
반응형

에러

ImportError: cannot import name 'rank_zero_only' from 'pytorch_lightning.utilities.distributed' (/opt/conda/lib/python3.8/site-packages/pytorch_lightning/utilities/distributed.py)

해결 방법

rank_zero 함수의 위치가 바껴서 그렇다.

rank_zero를 import하는 위치를 바꿔주면 된다.

from pytorch_lightning.utilities.distributed import rank_zero_only
# 위 코드를 아래로 수정
from pytorch_lightning.utilities.rank_zero import rank_zero_only
728x90
반응형
Comments