* update to Hydra 1.1 * add bash folder with scripts for conda setup and run scheduling * add saving seed in `log_hyperparameters()` method * redesign Dockerfile to make it weight less * add `test_after_training` parameter to config * add inheritance to trainer configs * remove forcing ddp-friendly configuration * refactor tests * remove conda_env_gpu.yaml * remove default langage version from pre-commit config * add mnist datamodule unit test * rename test folder from 'smoke' to 'shell' * remove wandb import from utils.py * change 'use_artifact' to 'log_artifact' in wandb callbacks * add rank zero decorator to wandb callbacks * add dumping rich tree config to file * get rid of `=` character in ckpt names * update requirements.txt * update LICENSE * update README.md
31 lines
851 B
Python
31 lines
851 B
Python
import platform
|
|
from importlib.util import find_spec
|
|
|
|
"""
|
|
Adapted from:
|
|
https://github.com/PyTorchLightning/pytorch-lightning/blob/master/pytorch_lightning/utilities/imports.py
|
|
"""
|
|
|
|
|
|
def _module_available(module_path: str) -> bool:
|
|
"""Check if a path is available in your environment.
|
|
|
|
>>> _module_available('os')
|
|
True
|
|
>>> _module_available('bla.bla')
|
|
False
|
|
|
|
"""
|
|
try:
|
|
return find_spec(module_path) is not None
|
|
except ModuleNotFoundError:
|
|
# Python 3.7+
|
|
return False
|
|
|
|
|
|
_IS_WINDOWS = platform.system() == "Windows"
|
|
_APEX_AVAILABLE = _module_available("apex.amp")
|
|
_DEEPSPEED_AVAILABLE = not _IS_WINDOWS and _module_available("deepspeed")
|
|
_FAIRSCALE_AVAILABLE = not _IS_WINDOWS and _module_available("fairscale.nn")
|
|
_RPC_AVAILABLE = not _IS_WINDOWS and _module_available("torch.distributed.rpc")
|