Skip to content

Commit

Permalink
circular import
Browse files Browse the repository at this point in the history
  • Loading branch information
otaj committed Oct 5, 2022
1 parent abd8a3d commit 53c3c34
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Expand Up @@ -4,7 +4,7 @@
import torch

from lightning_lite.plugins.collectives.collective import Collective
from lightning_lite.strategies.deepspeed import _DEEPSPEED_AVAILABLE
from lightning_lite.utilities.imports import _DEEPSPEED_AVAILABLE
from lightning_lite.utilities.types import CollectibleGroup

if _DEEPSPEED_AVAILABLE:
Expand Down
3 changes: 1 addition & 2 deletions src/lightning_lite/strategies/deepspeed.py
Expand Up @@ -21,7 +21,6 @@
from typing import Any, Dict, Generator, Iterable, List, Mapping, Optional, Tuple, Union

import torch
from lightning_utilities.core.imports import RequirementCache
from lightning_utilities.core.rank_zero import rank_zero_only
from torch.nn import Module
from torch.optim import Optimizer
Expand All @@ -32,11 +31,11 @@
from lightning_lite.strategies.ddp import DDPStrategy
from lightning_lite.utilities.distributed import log
from lightning_lite.utilities.enums import AMPType, PrecisionType
from lightning_lite.utilities.imports import _DEEPSPEED_AVAILABLE
from lightning_lite.utilities.rank_zero import rank_zero_info
from lightning_lite.utilities.seed import reset_seed
from lightning_lite.utilities.types import _LRScheduler, _PATH, ReduceLROnPlateau

_DEEPSPEED_AVAILABLE = RequirementCache("deepspeed")
if _DEEPSPEED_AVAILABLE:
import deepspeed

Expand Down
4 changes: 3 additions & 1 deletion src/lightning_lite/utilities/imports.py
Expand Up @@ -16,7 +16,7 @@
import platform
import sys

from lightning_utilities.core.imports import compare_version, module_available, package_available
from lightning_utilities.core.imports import compare_version, module_available, package_available, RequirementCache

_IS_WINDOWS = platform.system() == "Windows"
_IS_INTERACTIVE = hasattr(sys, "ps1") # https://stackoverflow.com/a/64523765
Expand All @@ -35,6 +35,8 @@
_HOROVOD_AVAILABLE = module_available("horovod.torch")
_OMEGACONF_AVAILABLE = package_available("omegaconf")
_POPTORCH_AVAILABLE = package_available("poptorch")
_DEEPSPEED_AVAILABLE = RequirementCache("deepspeed")


if _POPTORCH_AVAILABLE:
import poptorch
Expand Down

0 comments on commit 53c3c34

Please sign in to comment.