Fix import error in newer version of lighting.

Newer lighting versions move `rank_zero_only` from the distributed
subpackage back to utilities. This commit adds a try-except to catch
that import error, and retry with the alternative.
This commit is contained in:
Ali Hassani 2023-06-15 16:34:44 -07:00
parent cf1d67a6fd
commit eeeb184071

View file

@ -17,6 +17,9 @@ from functools import partial
import itertools
from tqdm import tqdm
from torchvision.utils import make_grid
try:
from pytorch_lightning.utilities import rank_zero_only
except:
from pytorch_lightning.utilities.distributed import rank_zero_only
from omegaconf import ListConfig