From f2c5287ff635ecff9b18f39c6029791c56032cdc Mon Sep 17 00:00:00 2001 From: Jirka Date: Wed, 1 Jun 2022 14:44:33 +0200 Subject: [PATCH 01/20] move: pytorch_lightning >> src/ --- {pytorch_lightning => src/pytorch_lightning}/__about__.py | 0 {pytorch_lightning => src/pytorch_lightning}/__init__.py | 0 .../pytorch_lightning}/accelerators/__init__.py | 0 .../pytorch_lightning}/accelerators/accelerator.py | 0 {pytorch_lightning => src/pytorch_lightning}/accelerators/cpu.py | 0 {pytorch_lightning => src/pytorch_lightning}/accelerators/gpu.py | 0 {pytorch_lightning => src/pytorch_lightning}/accelerators/hpu.py | 0 {pytorch_lightning => src/pytorch_lightning}/accelerators/ipu.py | 0 .../pytorch_lightning}/accelerators/registry.py | 0 {pytorch_lightning => src/pytorch_lightning}/accelerators/tpu.py | 0 .../pytorch_lightning}/callbacks/__init__.py | 0 {pytorch_lightning => src/pytorch_lightning}/callbacks/base.py | 0 .../pytorch_lightning}/callbacks/callback.py | 0 .../pytorch_lightning}/callbacks/device_stats_monitor.py | 0 .../pytorch_lightning}/callbacks/early_stopping.py | 0 .../pytorch_lightning}/callbacks/fault_tolerance.py | 0 .../pytorch_lightning}/callbacks/finetuning.py | 0 .../callbacks/gradient_accumulation_scheduler.py | 0 .../pytorch_lightning}/callbacks/lambda_function.py | 0 .../pytorch_lightning}/callbacks/lr_monitor.py | 0 .../pytorch_lightning}/callbacks/model_checkpoint.py | 0 .../pytorch_lightning}/callbacks/model_summary.py | 0 .../pytorch_lightning}/callbacks/prediction_writer.py | 0 .../pytorch_lightning}/callbacks/progress/__init__.py | 0 .../pytorch_lightning}/callbacks/progress/base.py | 0 .../pytorch_lightning}/callbacks/progress/rich_progress.py | 0 .../pytorch_lightning}/callbacks/progress/tqdm_progress.py | 0 {pytorch_lightning => src/pytorch_lightning}/callbacks/pruning.py | 0 .../pytorch_lightning}/callbacks/quantization.py | 0 .../pytorch_lightning}/callbacks/rich_model_summary.py | 0 .../pytorch_lightning}/callbacks/stochastic_weight_avg.py | 0 {pytorch_lightning => src/pytorch_lightning}/callbacks/timer.py | 0 {pytorch_lightning => src/pytorch_lightning}/core/__init__.py | 0 {pytorch_lightning => src/pytorch_lightning}/core/datamodule.py | 0 {pytorch_lightning => src/pytorch_lightning}/core/decorators.py | 0 {pytorch_lightning => src/pytorch_lightning}/core/hooks.py | 0 {pytorch_lightning => src/pytorch_lightning}/core/lightning.py | 0 .../pytorch_lightning}/core/mixins/__init__.py | 0 .../pytorch_lightning}/core/mixins/device_dtype_mixin.py | 0 .../pytorch_lightning}/core/mixins/hparams_mixin.py | 0 {pytorch_lightning => src/pytorch_lightning}/core/module.py | 0 {pytorch_lightning => src/pytorch_lightning}/core/optimizer.py | 0 {pytorch_lightning => src/pytorch_lightning}/core/saving.py | 0 {pytorch_lightning => src/pytorch_lightning}/demos/__init__.py | 0 .../pytorch_lightning}/demos/boring_classes.py | 0 .../pytorch_lightning}/distributed/__init__.py | 0 {pytorch_lightning => src/pytorch_lightning}/distributed/dist.py | 0 {pytorch_lightning => src/pytorch_lightning}/lite/__init__.py | 0 {pytorch_lightning => src/pytorch_lightning}/lite/lite.py | 0 {pytorch_lightning => src/pytorch_lightning}/lite/wrappers.py | 0 {pytorch_lightning => src/pytorch_lightning}/loggers/__init__.py | 0 {pytorch_lightning => src/pytorch_lightning}/loggers/base.py | 0 {pytorch_lightning => src/pytorch_lightning}/loggers/comet.py | 0 {pytorch_lightning => src/pytorch_lightning}/loggers/csv_logs.py | 0 {pytorch_lightning => src/pytorch_lightning}/loggers/logger.py | 0 {pytorch_lightning => src/pytorch_lightning}/loggers/mlflow.py | 0 {pytorch_lightning => src/pytorch_lightning}/loggers/neptune.py | 0 .../pytorch_lightning}/loggers/tensorboard.py | 0 {pytorch_lightning => src/pytorch_lightning}/loggers/wandb.py | 0 {pytorch_lightning => src/pytorch_lightning}/loops/__init__.py | 0 {pytorch_lightning => src/pytorch_lightning}/loops/base.py | 0 .../pytorch_lightning}/loops/batch/__init__.py | 0 .../pytorch_lightning}/loops/batch/training_batch_loop.py | 0 .../pytorch_lightning}/loops/dataloader/__init__.py | 0 .../pytorch_lightning}/loops/dataloader/dataloader_loop.py | 0 .../pytorch_lightning}/loops/dataloader/evaluation_loop.py | 0 .../pytorch_lightning}/loops/dataloader/prediction_loop.py | 0 .../pytorch_lightning}/loops/epoch/__init__.py | 0 .../pytorch_lightning}/loops/epoch/evaluation_epoch_loop.py | 0 .../pytorch_lightning}/loops/epoch/prediction_epoch_loop.py | 0 .../pytorch_lightning}/loops/epoch/training_epoch_loop.py | 0 {pytorch_lightning => src/pytorch_lightning}/loops/fit_loop.py | 0 {pytorch_lightning => src/pytorch_lightning}/loops/loop.py | 0 .../pytorch_lightning}/loops/optimization/__init__.py | 0 .../pytorch_lightning}/loops/optimization/closure.py | 0 .../pytorch_lightning}/loops/optimization/manual_loop.py | 0 .../pytorch_lightning}/loops/optimization/optimizer_loop.py | 0 {pytorch_lightning => src/pytorch_lightning}/loops/utilities.py | 0 .../pytorch_lightning}/overrides/__init__.py | 0 {pytorch_lightning => src/pytorch_lightning}/overrides/base.py | 0 .../pytorch_lightning}/overrides/data_parallel.py | 0 .../pytorch_lightning}/overrides/distributed.py | 0 .../pytorch_lightning}/overrides/fairscale.py | 0 .../pytorch_lightning}/overrides/torch_distributed.py | 0 {pytorch_lightning => src/pytorch_lightning}/plugins/__init__.py | 0 .../pytorch_lightning}/plugins/environments/__init__.py | 0 .../pytorch_lightning}/plugins/environments/bagua_environment.py | 0 .../plugins/environments/cluster_environment.py | 0 .../plugins/environments/kubeflow_environment.py | 0 .../plugins/environments/lightning_environment.py | 0 .../pytorch_lightning}/plugins/environments/lsf_environment.py | 0 .../pytorch_lightning}/plugins/environments/slurm_environment.py | 0 .../plugins/environments/torchelastic_environment.py | 0 .../pytorch_lightning}/plugins/io/__init__.py | 0 .../pytorch_lightning}/plugins/io/checkpoint_plugin.py | 0 .../pytorch_lightning}/plugins/io/hpu_plugin.py | 0 .../pytorch_lightning}/plugins/io/torch_plugin.py | 0 .../pytorch_lightning}/plugins/io/xla_plugin.py | 0 .../pytorch_lightning}/plugins/layer_sync.py | 0 .../pytorch_lightning}/plugins/precision/__init__.py | 0 .../pytorch_lightning}/plugins/precision/apex_amp.py | 0 .../pytorch_lightning}/plugins/precision/deepspeed.py | 0 .../pytorch_lightning}/plugins/precision/double.py | 0 .../plugins/precision/fully_sharded_native_amp.py | 0 .../pytorch_lightning}/plugins/precision/hpu.py | 0 .../pytorch_lightning}/plugins/precision/ipu.py | 0 .../pytorch_lightning}/plugins/precision/mixed.py | 0 .../pytorch_lightning}/plugins/precision/native_amp.py | 0 .../pytorch_lightning}/plugins/precision/precision_plugin.py | 0 .../pytorch_lightning}/plugins/precision/sharded_native_amp.py | 0 .../pytorch_lightning}/plugins/precision/tpu.py | 0 .../pytorch_lightning}/plugins/precision/tpu_bf16.py | 0 .../pytorch_lightning}/plugins/training_type/__init__.py | 0 .../pytorch_lightning}/plugins/training_type/ddp.py | 0 .../pytorch_lightning}/plugins/training_type/ddp2.py | 0 .../pytorch_lightning}/plugins/training_type/ddp_spawn.py | 0 .../pytorch_lightning}/plugins/training_type/deepspeed.py | 0 .../pytorch_lightning}/plugins/training_type/dp.py | 0 .../pytorch_lightning}/plugins/training_type/fully_sharded.py | 0 .../pytorch_lightning}/plugins/training_type/horovod.py | 0 .../pytorch_lightning}/plugins/training_type/ipu.py | 0 .../pytorch_lightning}/plugins/training_type/parallel.py | 0 .../pytorch_lightning}/plugins/training_type/sharded.py | 0 .../pytorch_lightning}/plugins/training_type/sharded_spawn.py | 0 .../pytorch_lightning}/plugins/training_type/single_device.py | 0 .../pytorch_lightning}/plugins/training_type/single_tpu.py | 0 .../pytorch_lightning}/plugins/training_type/tpu_spawn.py | 0 .../plugins/training_type/training_type_plugin.py | 0 .../pytorch_lightning}/plugins/training_type/utils.py | 0 {pytorch_lightning => src/pytorch_lightning}/profiler/__init__.py | 0 {pytorch_lightning => src/pytorch_lightning}/profiler/advanced.py | 0 {pytorch_lightning => src/pytorch_lightning}/profiler/base.py | 0 {pytorch_lightning => src/pytorch_lightning}/profiler/profiler.py | 0 {pytorch_lightning => src/pytorch_lightning}/profiler/pytorch.py | 0 {pytorch_lightning => src/pytorch_lightning}/profiler/simple.py | 0 {pytorch_lightning => src/pytorch_lightning}/profiler/xla.py | 0 {pytorch_lightning => src/pytorch_lightning}/py.typed | 0 {pytorch_lightning => src/pytorch_lightning}/setup_tools.py | 0 .../pytorch_lightning}/strategies/__init__.py | 0 {pytorch_lightning => src/pytorch_lightning}/strategies/bagua.py | 0 .../pytorch_lightning}/strategies/collaborative.py | 0 {pytorch_lightning => src/pytorch_lightning}/strategies/ddp.py | 0 {pytorch_lightning => src/pytorch_lightning}/strategies/ddp2.py | 0 .../pytorch_lightning}/strategies/ddp_spawn.py | 0 .../pytorch_lightning}/strategies/deepspeed.py | 0 {pytorch_lightning => src/pytorch_lightning}/strategies/dp.py | 0 .../pytorch_lightning}/strategies/fully_sharded.py | 0 .../pytorch_lightning}/strategies/fully_sharded_native.py | 0 .../pytorch_lightning}/strategies/horovod.py | 0 .../pytorch_lightning}/strategies/hpu_parallel.py | 0 {pytorch_lightning => src/pytorch_lightning}/strategies/ipu.py | 0 .../pytorch_lightning}/strategies/launchers/__init__.py | 0 .../pytorch_lightning}/strategies/launchers/base.py | 0 .../pytorch_lightning}/strategies/launchers/spawn.py | 0 .../pytorch_lightning}/strategies/launchers/subprocess_script.py | 0 .../pytorch_lightning}/strategies/launchers/xla_spawn.py | 0 .../pytorch_lightning}/strategies/parallel.py | 0 .../pytorch_lightning}/strategies/sharded.py | 0 .../pytorch_lightning}/strategies/sharded_spawn.py | 0 .../pytorch_lightning}/strategies/single_device.py | 0 .../pytorch_lightning}/strategies/single_hpu.py | 0 .../pytorch_lightning}/strategies/single_tpu.py | 0 .../pytorch_lightning}/strategies/strategy.py | 0 .../pytorch_lightning}/strategies/strategy_registry.py | 0 .../pytorch_lightning}/strategies/tpu_spawn.py | 0 {pytorch_lightning => src/pytorch_lightning}/strategies/utils.py | 0 {pytorch_lightning => src/pytorch_lightning}/trainer/__init__.py | 0 .../pytorch_lightning}/trainer/callback_hook.py | 0 .../pytorch_lightning}/trainer/configuration_validator.py | 0 .../pytorch_lightning}/trainer/connectors/__init__.py | 0 .../trainer/connectors/accelerator_connector.py | 0 .../pytorch_lightning}/trainer/connectors/callback_connector.py | 0 .../pytorch_lightning}/trainer/connectors/checkpoint_connector.py | 0 .../pytorch_lightning}/trainer/connectors/data_connector.py | 0 .../trainer/connectors/logger_connector/__init__.py | 0 .../trainer/connectors/logger_connector/fx_validator.py | 0 .../trainer/connectors/logger_connector/logger_connector.py | 0 .../trainer/connectors/logger_connector/result.py | 0 .../pytorch_lightning}/trainer/connectors/signal_connector.py | 0 .../pytorch_lightning}/trainer/data_loading.py | 0 .../pytorch_lightning}/trainer/optimizers.py | 0 {pytorch_lightning => src/pytorch_lightning}/trainer/progress.py | 0 {pytorch_lightning => src/pytorch_lightning}/trainer/states.py | 0 .../pytorch_lightning}/trainer/supporters.py | 0 {pytorch_lightning => src/pytorch_lightning}/trainer/trainer.py | 0 {pytorch_lightning => src/pytorch_lightning}/tuner/__init__.py | 0 .../pytorch_lightning}/tuner/auto_gpu_select.py | 0 .../pytorch_lightning}/tuner/batch_size_scaling.py | 0 {pytorch_lightning => src/pytorch_lightning}/tuner/lr_finder.py | 0 {pytorch_lightning => src/pytorch_lightning}/tuner/tuning.py | 0 .../pytorch_lightning}/utilities/__init__.py | 0 .../pytorch_lightning}/utilities/apply_func.py | 0 .../pytorch_lightning}/utilities/argparse.py | 0 .../pytorch_lightning}/utilities/auto_restart.py | 0 {pytorch_lightning => src/pytorch_lightning}/utilities/cli.py | 0 .../pytorch_lightning}/utilities/cloud_io.py | 0 {pytorch_lightning => src/pytorch_lightning}/utilities/data.py | 0 .../pytorch_lightning}/utilities/deepspeed.py | 0 .../pytorch_lightning}/utilities/device_parser.py | 0 .../pytorch_lightning}/utilities/distributed.py | 0 {pytorch_lightning => src/pytorch_lightning}/utilities/enums.py | 0 .../pytorch_lightning}/utilities/exceptions.py | 0 .../pytorch_lightning}/utilities/fetching.py | 0 .../pytorch_lightning}/utilities/finite_checks.py | 0 {pytorch_lightning => src/pytorch_lightning}/utilities/grads.py | 0 {pytorch_lightning => src/pytorch_lightning}/utilities/imports.py | 0 {pytorch_lightning => src/pytorch_lightning}/utilities/logger.py | 0 {pytorch_lightning => src/pytorch_lightning}/utilities/memory.py | 0 {pytorch_lightning => src/pytorch_lightning}/utilities/meta.py | 0 {pytorch_lightning => src/pytorch_lightning}/utilities/metrics.py | 0 .../pytorch_lightning}/utilities/migration.py | 0 .../pytorch_lightning}/utilities/model_helpers.py | 0 .../pytorch_lightning}/utilities/model_summary.py | 0 .../pytorch_lightning}/utilities/optimizer.py | 0 .../pytorch_lightning}/utilities/parameter_tying.py | 0 {pytorch_lightning => src/pytorch_lightning}/utilities/parsing.py | 0 .../pytorch_lightning}/utilities/rank_zero.py | 0 .../pytorch_lightning}/utilities/registry.py | 0 {pytorch_lightning => src/pytorch_lightning}/utilities/seed.py | 0 .../pytorch_lightning}/utilities/signature_utils.py | 0 {pytorch_lightning => src/pytorch_lightning}/utilities/types.py | 0 .../pytorch_lightning}/utilities/upgrade_checkpoint.py | 0 .../pytorch_lightning}/utilities/warnings.py | 0 .../pytorch_lightning}/utilities/xla_device.py | 0 224 files changed, 0 insertions(+), 0 deletions(-) rename {pytorch_lightning => src/pytorch_lightning}/__about__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/accelerators/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/accelerators/accelerator.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/accelerators/cpu.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/accelerators/gpu.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/accelerators/hpu.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/accelerators/ipu.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/accelerators/registry.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/accelerators/tpu.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/callbacks/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/callbacks/base.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/callbacks/callback.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/callbacks/device_stats_monitor.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/callbacks/early_stopping.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/callbacks/fault_tolerance.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/callbacks/finetuning.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/callbacks/gradient_accumulation_scheduler.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/callbacks/lambda_function.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/callbacks/lr_monitor.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/callbacks/model_checkpoint.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/callbacks/model_summary.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/callbacks/prediction_writer.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/callbacks/progress/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/callbacks/progress/base.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/callbacks/progress/rich_progress.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/callbacks/progress/tqdm_progress.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/callbacks/pruning.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/callbacks/quantization.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/callbacks/rich_model_summary.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/callbacks/stochastic_weight_avg.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/callbacks/timer.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/core/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/core/datamodule.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/core/decorators.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/core/hooks.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/core/lightning.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/core/mixins/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/core/mixins/device_dtype_mixin.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/core/mixins/hparams_mixin.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/core/module.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/core/optimizer.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/core/saving.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/demos/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/demos/boring_classes.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/distributed/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/distributed/dist.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/lite/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/lite/lite.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/lite/wrappers.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loggers/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loggers/base.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loggers/comet.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loggers/csv_logs.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loggers/logger.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loggers/mlflow.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loggers/neptune.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loggers/tensorboard.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loggers/wandb.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loops/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loops/base.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loops/batch/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loops/batch/training_batch_loop.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loops/dataloader/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loops/dataloader/dataloader_loop.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loops/dataloader/evaluation_loop.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loops/dataloader/prediction_loop.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loops/epoch/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loops/epoch/evaluation_epoch_loop.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loops/epoch/prediction_epoch_loop.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loops/epoch/training_epoch_loop.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loops/fit_loop.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loops/loop.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loops/optimization/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loops/optimization/closure.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loops/optimization/manual_loop.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loops/optimization/optimizer_loop.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/loops/utilities.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/overrides/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/overrides/base.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/overrides/data_parallel.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/overrides/distributed.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/overrides/fairscale.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/overrides/torch_distributed.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/environments/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/environments/bagua_environment.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/environments/cluster_environment.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/environments/kubeflow_environment.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/environments/lightning_environment.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/environments/lsf_environment.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/environments/slurm_environment.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/environments/torchelastic_environment.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/io/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/io/checkpoint_plugin.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/io/hpu_plugin.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/io/torch_plugin.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/io/xla_plugin.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/layer_sync.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/precision/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/precision/apex_amp.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/precision/deepspeed.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/precision/double.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/precision/fully_sharded_native_amp.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/precision/hpu.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/precision/ipu.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/precision/mixed.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/precision/native_amp.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/precision/precision_plugin.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/precision/sharded_native_amp.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/precision/tpu.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/precision/tpu_bf16.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/training_type/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/training_type/ddp.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/training_type/ddp2.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/training_type/ddp_spawn.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/training_type/deepspeed.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/training_type/dp.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/training_type/fully_sharded.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/training_type/horovod.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/training_type/ipu.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/training_type/parallel.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/training_type/sharded.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/training_type/sharded_spawn.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/training_type/single_device.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/training_type/single_tpu.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/training_type/tpu_spawn.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/training_type/training_type_plugin.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/plugins/training_type/utils.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/profiler/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/profiler/advanced.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/profiler/base.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/profiler/profiler.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/profiler/pytorch.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/profiler/simple.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/profiler/xla.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/py.typed (100%) rename {pytorch_lightning => src/pytorch_lightning}/setup_tools.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/bagua.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/collaborative.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/ddp.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/ddp2.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/ddp_spawn.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/deepspeed.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/dp.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/fully_sharded.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/fully_sharded_native.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/horovod.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/hpu_parallel.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/ipu.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/launchers/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/launchers/base.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/launchers/spawn.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/launchers/subprocess_script.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/launchers/xla_spawn.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/parallel.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/sharded.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/sharded_spawn.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/single_device.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/single_hpu.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/single_tpu.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/strategy.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/strategy_registry.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/tpu_spawn.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/strategies/utils.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/trainer/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/trainer/callback_hook.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/trainer/configuration_validator.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/trainer/connectors/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/trainer/connectors/accelerator_connector.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/trainer/connectors/callback_connector.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/trainer/connectors/checkpoint_connector.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/trainer/connectors/data_connector.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/trainer/connectors/logger_connector/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/trainer/connectors/logger_connector/fx_validator.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/trainer/connectors/logger_connector/logger_connector.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/trainer/connectors/logger_connector/result.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/trainer/connectors/signal_connector.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/trainer/data_loading.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/trainer/optimizers.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/trainer/progress.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/trainer/states.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/trainer/supporters.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/trainer/trainer.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/tuner/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/tuner/auto_gpu_select.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/tuner/batch_size_scaling.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/tuner/lr_finder.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/tuner/tuning.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/__init__.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/apply_func.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/argparse.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/auto_restart.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/cli.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/cloud_io.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/data.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/deepspeed.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/device_parser.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/distributed.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/enums.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/exceptions.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/fetching.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/finite_checks.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/grads.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/imports.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/logger.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/memory.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/meta.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/metrics.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/migration.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/model_helpers.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/model_summary.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/optimizer.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/parameter_tying.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/parsing.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/rank_zero.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/registry.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/seed.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/signature_utils.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/types.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/upgrade_checkpoint.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/warnings.py (100%) rename {pytorch_lightning => src/pytorch_lightning}/utilities/xla_device.py (100%) diff --git a/pytorch_lightning/__about__.py b/src/pytorch_lightning/__about__.py similarity index 100% rename from pytorch_lightning/__about__.py rename to src/pytorch_lightning/__about__.py diff --git a/pytorch_lightning/__init__.py b/src/pytorch_lightning/__init__.py similarity index 100% rename from pytorch_lightning/__init__.py rename to src/pytorch_lightning/__init__.py diff --git a/pytorch_lightning/accelerators/__init__.py b/src/pytorch_lightning/accelerators/__init__.py similarity index 100% rename from pytorch_lightning/accelerators/__init__.py rename to src/pytorch_lightning/accelerators/__init__.py diff --git a/pytorch_lightning/accelerators/accelerator.py b/src/pytorch_lightning/accelerators/accelerator.py similarity index 100% rename from pytorch_lightning/accelerators/accelerator.py rename to src/pytorch_lightning/accelerators/accelerator.py diff --git a/pytorch_lightning/accelerators/cpu.py b/src/pytorch_lightning/accelerators/cpu.py similarity index 100% rename from pytorch_lightning/accelerators/cpu.py rename to src/pytorch_lightning/accelerators/cpu.py diff --git a/pytorch_lightning/accelerators/gpu.py b/src/pytorch_lightning/accelerators/gpu.py similarity index 100% rename from pytorch_lightning/accelerators/gpu.py rename to src/pytorch_lightning/accelerators/gpu.py diff --git a/pytorch_lightning/accelerators/hpu.py b/src/pytorch_lightning/accelerators/hpu.py similarity index 100% rename from pytorch_lightning/accelerators/hpu.py rename to src/pytorch_lightning/accelerators/hpu.py diff --git a/pytorch_lightning/accelerators/ipu.py b/src/pytorch_lightning/accelerators/ipu.py similarity index 100% rename from pytorch_lightning/accelerators/ipu.py rename to src/pytorch_lightning/accelerators/ipu.py diff --git a/pytorch_lightning/accelerators/registry.py b/src/pytorch_lightning/accelerators/registry.py similarity index 100% rename from pytorch_lightning/accelerators/registry.py rename to src/pytorch_lightning/accelerators/registry.py diff --git a/pytorch_lightning/accelerators/tpu.py b/src/pytorch_lightning/accelerators/tpu.py similarity index 100% rename from pytorch_lightning/accelerators/tpu.py rename to src/pytorch_lightning/accelerators/tpu.py diff --git a/pytorch_lightning/callbacks/__init__.py b/src/pytorch_lightning/callbacks/__init__.py similarity index 100% rename from pytorch_lightning/callbacks/__init__.py rename to src/pytorch_lightning/callbacks/__init__.py diff --git a/pytorch_lightning/callbacks/base.py b/src/pytorch_lightning/callbacks/base.py similarity index 100% rename from pytorch_lightning/callbacks/base.py rename to src/pytorch_lightning/callbacks/base.py diff --git a/pytorch_lightning/callbacks/callback.py b/src/pytorch_lightning/callbacks/callback.py similarity index 100% rename from pytorch_lightning/callbacks/callback.py rename to src/pytorch_lightning/callbacks/callback.py diff --git a/pytorch_lightning/callbacks/device_stats_monitor.py b/src/pytorch_lightning/callbacks/device_stats_monitor.py similarity index 100% rename from pytorch_lightning/callbacks/device_stats_monitor.py rename to src/pytorch_lightning/callbacks/device_stats_monitor.py diff --git a/pytorch_lightning/callbacks/early_stopping.py b/src/pytorch_lightning/callbacks/early_stopping.py similarity index 100% rename from pytorch_lightning/callbacks/early_stopping.py rename to src/pytorch_lightning/callbacks/early_stopping.py diff --git a/pytorch_lightning/callbacks/fault_tolerance.py b/src/pytorch_lightning/callbacks/fault_tolerance.py similarity index 100% rename from pytorch_lightning/callbacks/fault_tolerance.py rename to src/pytorch_lightning/callbacks/fault_tolerance.py diff --git a/pytorch_lightning/callbacks/finetuning.py b/src/pytorch_lightning/callbacks/finetuning.py similarity index 100% rename from pytorch_lightning/callbacks/finetuning.py rename to src/pytorch_lightning/callbacks/finetuning.py diff --git a/pytorch_lightning/callbacks/gradient_accumulation_scheduler.py b/src/pytorch_lightning/callbacks/gradient_accumulation_scheduler.py similarity index 100% rename from pytorch_lightning/callbacks/gradient_accumulation_scheduler.py rename to src/pytorch_lightning/callbacks/gradient_accumulation_scheduler.py diff --git a/pytorch_lightning/callbacks/lambda_function.py b/src/pytorch_lightning/callbacks/lambda_function.py similarity index 100% rename from pytorch_lightning/callbacks/lambda_function.py rename to src/pytorch_lightning/callbacks/lambda_function.py diff --git a/pytorch_lightning/callbacks/lr_monitor.py b/src/pytorch_lightning/callbacks/lr_monitor.py similarity index 100% rename from pytorch_lightning/callbacks/lr_monitor.py rename to src/pytorch_lightning/callbacks/lr_monitor.py diff --git a/pytorch_lightning/callbacks/model_checkpoint.py b/src/pytorch_lightning/callbacks/model_checkpoint.py similarity index 100% rename from pytorch_lightning/callbacks/model_checkpoint.py rename to src/pytorch_lightning/callbacks/model_checkpoint.py diff --git a/pytorch_lightning/callbacks/model_summary.py b/src/pytorch_lightning/callbacks/model_summary.py similarity index 100% rename from pytorch_lightning/callbacks/model_summary.py rename to src/pytorch_lightning/callbacks/model_summary.py diff --git a/pytorch_lightning/callbacks/prediction_writer.py b/src/pytorch_lightning/callbacks/prediction_writer.py similarity index 100% rename from pytorch_lightning/callbacks/prediction_writer.py rename to src/pytorch_lightning/callbacks/prediction_writer.py diff --git a/pytorch_lightning/callbacks/progress/__init__.py b/src/pytorch_lightning/callbacks/progress/__init__.py similarity index 100% rename from pytorch_lightning/callbacks/progress/__init__.py rename to src/pytorch_lightning/callbacks/progress/__init__.py diff --git a/pytorch_lightning/callbacks/progress/base.py b/src/pytorch_lightning/callbacks/progress/base.py similarity index 100% rename from pytorch_lightning/callbacks/progress/base.py rename to src/pytorch_lightning/callbacks/progress/base.py diff --git a/pytorch_lightning/callbacks/progress/rich_progress.py b/src/pytorch_lightning/callbacks/progress/rich_progress.py similarity index 100% rename from pytorch_lightning/callbacks/progress/rich_progress.py rename to src/pytorch_lightning/callbacks/progress/rich_progress.py diff --git a/pytorch_lightning/callbacks/progress/tqdm_progress.py b/src/pytorch_lightning/callbacks/progress/tqdm_progress.py similarity index 100% rename from pytorch_lightning/callbacks/progress/tqdm_progress.py rename to src/pytorch_lightning/callbacks/progress/tqdm_progress.py diff --git a/pytorch_lightning/callbacks/pruning.py b/src/pytorch_lightning/callbacks/pruning.py similarity index 100% rename from pytorch_lightning/callbacks/pruning.py rename to src/pytorch_lightning/callbacks/pruning.py diff --git a/pytorch_lightning/callbacks/quantization.py b/src/pytorch_lightning/callbacks/quantization.py similarity index 100% rename from pytorch_lightning/callbacks/quantization.py rename to src/pytorch_lightning/callbacks/quantization.py diff --git a/pytorch_lightning/callbacks/rich_model_summary.py b/src/pytorch_lightning/callbacks/rich_model_summary.py similarity index 100% rename from pytorch_lightning/callbacks/rich_model_summary.py rename to src/pytorch_lightning/callbacks/rich_model_summary.py diff --git a/pytorch_lightning/callbacks/stochastic_weight_avg.py b/src/pytorch_lightning/callbacks/stochastic_weight_avg.py similarity index 100% rename from pytorch_lightning/callbacks/stochastic_weight_avg.py rename to src/pytorch_lightning/callbacks/stochastic_weight_avg.py diff --git a/pytorch_lightning/callbacks/timer.py b/src/pytorch_lightning/callbacks/timer.py similarity index 100% rename from pytorch_lightning/callbacks/timer.py rename to src/pytorch_lightning/callbacks/timer.py diff --git a/pytorch_lightning/core/__init__.py b/src/pytorch_lightning/core/__init__.py similarity index 100% rename from pytorch_lightning/core/__init__.py rename to src/pytorch_lightning/core/__init__.py diff --git a/pytorch_lightning/core/datamodule.py b/src/pytorch_lightning/core/datamodule.py similarity index 100% rename from pytorch_lightning/core/datamodule.py rename to src/pytorch_lightning/core/datamodule.py diff --git a/pytorch_lightning/core/decorators.py b/src/pytorch_lightning/core/decorators.py similarity index 100% rename from pytorch_lightning/core/decorators.py rename to src/pytorch_lightning/core/decorators.py diff --git a/pytorch_lightning/core/hooks.py b/src/pytorch_lightning/core/hooks.py similarity index 100% rename from pytorch_lightning/core/hooks.py rename to src/pytorch_lightning/core/hooks.py diff --git a/pytorch_lightning/core/lightning.py b/src/pytorch_lightning/core/lightning.py similarity index 100% rename from pytorch_lightning/core/lightning.py rename to src/pytorch_lightning/core/lightning.py diff --git a/pytorch_lightning/core/mixins/__init__.py b/src/pytorch_lightning/core/mixins/__init__.py similarity index 100% rename from pytorch_lightning/core/mixins/__init__.py rename to src/pytorch_lightning/core/mixins/__init__.py diff --git a/pytorch_lightning/core/mixins/device_dtype_mixin.py b/src/pytorch_lightning/core/mixins/device_dtype_mixin.py similarity index 100% rename from pytorch_lightning/core/mixins/device_dtype_mixin.py rename to src/pytorch_lightning/core/mixins/device_dtype_mixin.py diff --git a/pytorch_lightning/core/mixins/hparams_mixin.py b/src/pytorch_lightning/core/mixins/hparams_mixin.py similarity index 100% rename from pytorch_lightning/core/mixins/hparams_mixin.py rename to src/pytorch_lightning/core/mixins/hparams_mixin.py diff --git a/pytorch_lightning/core/module.py b/src/pytorch_lightning/core/module.py similarity index 100% rename from pytorch_lightning/core/module.py rename to src/pytorch_lightning/core/module.py diff --git a/pytorch_lightning/core/optimizer.py b/src/pytorch_lightning/core/optimizer.py similarity index 100% rename from pytorch_lightning/core/optimizer.py rename to src/pytorch_lightning/core/optimizer.py diff --git a/pytorch_lightning/core/saving.py b/src/pytorch_lightning/core/saving.py similarity index 100% rename from pytorch_lightning/core/saving.py rename to src/pytorch_lightning/core/saving.py diff --git a/pytorch_lightning/demos/__init__.py b/src/pytorch_lightning/demos/__init__.py similarity index 100% rename from pytorch_lightning/demos/__init__.py rename to src/pytorch_lightning/demos/__init__.py diff --git a/pytorch_lightning/demos/boring_classes.py b/src/pytorch_lightning/demos/boring_classes.py similarity index 100% rename from pytorch_lightning/demos/boring_classes.py rename to src/pytorch_lightning/demos/boring_classes.py diff --git a/pytorch_lightning/distributed/__init__.py b/src/pytorch_lightning/distributed/__init__.py similarity index 100% rename from pytorch_lightning/distributed/__init__.py rename to src/pytorch_lightning/distributed/__init__.py diff --git a/pytorch_lightning/distributed/dist.py b/src/pytorch_lightning/distributed/dist.py similarity index 100% rename from pytorch_lightning/distributed/dist.py rename to src/pytorch_lightning/distributed/dist.py diff --git a/pytorch_lightning/lite/__init__.py b/src/pytorch_lightning/lite/__init__.py similarity index 100% rename from pytorch_lightning/lite/__init__.py rename to src/pytorch_lightning/lite/__init__.py diff --git a/pytorch_lightning/lite/lite.py b/src/pytorch_lightning/lite/lite.py similarity index 100% rename from pytorch_lightning/lite/lite.py rename to src/pytorch_lightning/lite/lite.py diff --git a/pytorch_lightning/lite/wrappers.py b/src/pytorch_lightning/lite/wrappers.py similarity index 100% rename from pytorch_lightning/lite/wrappers.py rename to src/pytorch_lightning/lite/wrappers.py diff --git a/pytorch_lightning/loggers/__init__.py b/src/pytorch_lightning/loggers/__init__.py similarity index 100% rename from pytorch_lightning/loggers/__init__.py rename to src/pytorch_lightning/loggers/__init__.py diff --git a/pytorch_lightning/loggers/base.py b/src/pytorch_lightning/loggers/base.py similarity index 100% rename from pytorch_lightning/loggers/base.py rename to src/pytorch_lightning/loggers/base.py diff --git a/pytorch_lightning/loggers/comet.py b/src/pytorch_lightning/loggers/comet.py similarity index 100% rename from pytorch_lightning/loggers/comet.py rename to src/pytorch_lightning/loggers/comet.py diff --git a/pytorch_lightning/loggers/csv_logs.py b/src/pytorch_lightning/loggers/csv_logs.py similarity index 100% rename from pytorch_lightning/loggers/csv_logs.py rename to src/pytorch_lightning/loggers/csv_logs.py diff --git a/pytorch_lightning/loggers/logger.py b/src/pytorch_lightning/loggers/logger.py similarity index 100% rename from pytorch_lightning/loggers/logger.py rename to src/pytorch_lightning/loggers/logger.py diff --git a/pytorch_lightning/loggers/mlflow.py b/src/pytorch_lightning/loggers/mlflow.py similarity index 100% rename from pytorch_lightning/loggers/mlflow.py rename to src/pytorch_lightning/loggers/mlflow.py diff --git a/pytorch_lightning/loggers/neptune.py b/src/pytorch_lightning/loggers/neptune.py similarity index 100% rename from pytorch_lightning/loggers/neptune.py rename to src/pytorch_lightning/loggers/neptune.py diff --git a/pytorch_lightning/loggers/tensorboard.py b/src/pytorch_lightning/loggers/tensorboard.py similarity index 100% rename from pytorch_lightning/loggers/tensorboard.py rename to src/pytorch_lightning/loggers/tensorboard.py diff --git a/pytorch_lightning/loggers/wandb.py b/src/pytorch_lightning/loggers/wandb.py similarity index 100% rename from pytorch_lightning/loggers/wandb.py rename to src/pytorch_lightning/loggers/wandb.py diff --git a/pytorch_lightning/loops/__init__.py b/src/pytorch_lightning/loops/__init__.py similarity index 100% rename from pytorch_lightning/loops/__init__.py rename to src/pytorch_lightning/loops/__init__.py diff --git a/pytorch_lightning/loops/base.py b/src/pytorch_lightning/loops/base.py similarity index 100% rename from pytorch_lightning/loops/base.py rename to src/pytorch_lightning/loops/base.py diff --git a/pytorch_lightning/loops/batch/__init__.py b/src/pytorch_lightning/loops/batch/__init__.py similarity index 100% rename from pytorch_lightning/loops/batch/__init__.py rename to src/pytorch_lightning/loops/batch/__init__.py diff --git a/pytorch_lightning/loops/batch/training_batch_loop.py b/src/pytorch_lightning/loops/batch/training_batch_loop.py similarity index 100% rename from pytorch_lightning/loops/batch/training_batch_loop.py rename to src/pytorch_lightning/loops/batch/training_batch_loop.py diff --git a/pytorch_lightning/loops/dataloader/__init__.py b/src/pytorch_lightning/loops/dataloader/__init__.py similarity index 100% rename from pytorch_lightning/loops/dataloader/__init__.py rename to src/pytorch_lightning/loops/dataloader/__init__.py diff --git a/pytorch_lightning/loops/dataloader/dataloader_loop.py b/src/pytorch_lightning/loops/dataloader/dataloader_loop.py similarity index 100% rename from pytorch_lightning/loops/dataloader/dataloader_loop.py rename to src/pytorch_lightning/loops/dataloader/dataloader_loop.py diff --git a/pytorch_lightning/loops/dataloader/evaluation_loop.py b/src/pytorch_lightning/loops/dataloader/evaluation_loop.py similarity index 100% rename from pytorch_lightning/loops/dataloader/evaluation_loop.py rename to src/pytorch_lightning/loops/dataloader/evaluation_loop.py diff --git a/pytorch_lightning/loops/dataloader/prediction_loop.py b/src/pytorch_lightning/loops/dataloader/prediction_loop.py similarity index 100% rename from pytorch_lightning/loops/dataloader/prediction_loop.py rename to src/pytorch_lightning/loops/dataloader/prediction_loop.py diff --git a/pytorch_lightning/loops/epoch/__init__.py b/src/pytorch_lightning/loops/epoch/__init__.py similarity index 100% rename from pytorch_lightning/loops/epoch/__init__.py rename to src/pytorch_lightning/loops/epoch/__init__.py diff --git a/pytorch_lightning/loops/epoch/evaluation_epoch_loop.py b/src/pytorch_lightning/loops/epoch/evaluation_epoch_loop.py similarity index 100% rename from pytorch_lightning/loops/epoch/evaluation_epoch_loop.py rename to src/pytorch_lightning/loops/epoch/evaluation_epoch_loop.py diff --git a/pytorch_lightning/loops/epoch/prediction_epoch_loop.py b/src/pytorch_lightning/loops/epoch/prediction_epoch_loop.py similarity index 100% rename from pytorch_lightning/loops/epoch/prediction_epoch_loop.py rename to src/pytorch_lightning/loops/epoch/prediction_epoch_loop.py diff --git a/pytorch_lightning/loops/epoch/training_epoch_loop.py b/src/pytorch_lightning/loops/epoch/training_epoch_loop.py similarity index 100% rename from pytorch_lightning/loops/epoch/training_epoch_loop.py rename to src/pytorch_lightning/loops/epoch/training_epoch_loop.py diff --git a/pytorch_lightning/loops/fit_loop.py b/src/pytorch_lightning/loops/fit_loop.py similarity index 100% rename from pytorch_lightning/loops/fit_loop.py rename to src/pytorch_lightning/loops/fit_loop.py diff --git a/pytorch_lightning/loops/loop.py b/src/pytorch_lightning/loops/loop.py similarity index 100% rename from pytorch_lightning/loops/loop.py rename to src/pytorch_lightning/loops/loop.py diff --git a/pytorch_lightning/loops/optimization/__init__.py b/src/pytorch_lightning/loops/optimization/__init__.py similarity index 100% rename from pytorch_lightning/loops/optimization/__init__.py rename to src/pytorch_lightning/loops/optimization/__init__.py diff --git a/pytorch_lightning/loops/optimization/closure.py b/src/pytorch_lightning/loops/optimization/closure.py similarity index 100% rename from pytorch_lightning/loops/optimization/closure.py rename to src/pytorch_lightning/loops/optimization/closure.py diff --git a/pytorch_lightning/loops/optimization/manual_loop.py b/src/pytorch_lightning/loops/optimization/manual_loop.py similarity index 100% rename from pytorch_lightning/loops/optimization/manual_loop.py rename to src/pytorch_lightning/loops/optimization/manual_loop.py diff --git a/pytorch_lightning/loops/optimization/optimizer_loop.py b/src/pytorch_lightning/loops/optimization/optimizer_loop.py similarity index 100% rename from pytorch_lightning/loops/optimization/optimizer_loop.py rename to src/pytorch_lightning/loops/optimization/optimizer_loop.py diff --git a/pytorch_lightning/loops/utilities.py b/src/pytorch_lightning/loops/utilities.py similarity index 100% rename from pytorch_lightning/loops/utilities.py rename to src/pytorch_lightning/loops/utilities.py diff --git a/pytorch_lightning/overrides/__init__.py b/src/pytorch_lightning/overrides/__init__.py similarity index 100% rename from pytorch_lightning/overrides/__init__.py rename to src/pytorch_lightning/overrides/__init__.py diff --git a/pytorch_lightning/overrides/base.py b/src/pytorch_lightning/overrides/base.py similarity index 100% rename from pytorch_lightning/overrides/base.py rename to src/pytorch_lightning/overrides/base.py diff --git a/pytorch_lightning/overrides/data_parallel.py b/src/pytorch_lightning/overrides/data_parallel.py similarity index 100% rename from pytorch_lightning/overrides/data_parallel.py rename to src/pytorch_lightning/overrides/data_parallel.py diff --git a/pytorch_lightning/overrides/distributed.py b/src/pytorch_lightning/overrides/distributed.py similarity index 100% rename from pytorch_lightning/overrides/distributed.py rename to src/pytorch_lightning/overrides/distributed.py diff --git a/pytorch_lightning/overrides/fairscale.py b/src/pytorch_lightning/overrides/fairscale.py similarity index 100% rename from pytorch_lightning/overrides/fairscale.py rename to src/pytorch_lightning/overrides/fairscale.py diff --git a/pytorch_lightning/overrides/torch_distributed.py b/src/pytorch_lightning/overrides/torch_distributed.py similarity index 100% rename from pytorch_lightning/overrides/torch_distributed.py rename to src/pytorch_lightning/overrides/torch_distributed.py diff --git a/pytorch_lightning/plugins/__init__.py b/src/pytorch_lightning/plugins/__init__.py similarity index 100% rename from pytorch_lightning/plugins/__init__.py rename to src/pytorch_lightning/plugins/__init__.py diff --git a/pytorch_lightning/plugins/environments/__init__.py b/src/pytorch_lightning/plugins/environments/__init__.py similarity index 100% rename from pytorch_lightning/plugins/environments/__init__.py rename to src/pytorch_lightning/plugins/environments/__init__.py diff --git a/pytorch_lightning/plugins/environments/bagua_environment.py b/src/pytorch_lightning/plugins/environments/bagua_environment.py similarity index 100% rename from pytorch_lightning/plugins/environments/bagua_environment.py rename to src/pytorch_lightning/plugins/environments/bagua_environment.py diff --git a/pytorch_lightning/plugins/environments/cluster_environment.py b/src/pytorch_lightning/plugins/environments/cluster_environment.py similarity index 100% rename from pytorch_lightning/plugins/environments/cluster_environment.py rename to src/pytorch_lightning/plugins/environments/cluster_environment.py diff --git a/pytorch_lightning/plugins/environments/kubeflow_environment.py b/src/pytorch_lightning/plugins/environments/kubeflow_environment.py similarity index 100% rename from pytorch_lightning/plugins/environments/kubeflow_environment.py rename to src/pytorch_lightning/plugins/environments/kubeflow_environment.py diff --git a/pytorch_lightning/plugins/environments/lightning_environment.py b/src/pytorch_lightning/plugins/environments/lightning_environment.py similarity index 100% rename from pytorch_lightning/plugins/environments/lightning_environment.py rename to src/pytorch_lightning/plugins/environments/lightning_environment.py diff --git a/pytorch_lightning/plugins/environments/lsf_environment.py b/src/pytorch_lightning/plugins/environments/lsf_environment.py similarity index 100% rename from pytorch_lightning/plugins/environments/lsf_environment.py rename to src/pytorch_lightning/plugins/environments/lsf_environment.py diff --git a/pytorch_lightning/plugins/environments/slurm_environment.py b/src/pytorch_lightning/plugins/environments/slurm_environment.py similarity index 100% rename from pytorch_lightning/plugins/environments/slurm_environment.py rename to src/pytorch_lightning/plugins/environments/slurm_environment.py diff --git a/pytorch_lightning/plugins/environments/torchelastic_environment.py b/src/pytorch_lightning/plugins/environments/torchelastic_environment.py similarity index 100% rename from pytorch_lightning/plugins/environments/torchelastic_environment.py rename to src/pytorch_lightning/plugins/environments/torchelastic_environment.py diff --git a/pytorch_lightning/plugins/io/__init__.py b/src/pytorch_lightning/plugins/io/__init__.py similarity index 100% rename from pytorch_lightning/plugins/io/__init__.py rename to src/pytorch_lightning/plugins/io/__init__.py diff --git a/pytorch_lightning/plugins/io/checkpoint_plugin.py b/src/pytorch_lightning/plugins/io/checkpoint_plugin.py similarity index 100% rename from pytorch_lightning/plugins/io/checkpoint_plugin.py rename to src/pytorch_lightning/plugins/io/checkpoint_plugin.py diff --git a/pytorch_lightning/plugins/io/hpu_plugin.py b/src/pytorch_lightning/plugins/io/hpu_plugin.py similarity index 100% rename from pytorch_lightning/plugins/io/hpu_plugin.py rename to src/pytorch_lightning/plugins/io/hpu_plugin.py diff --git a/pytorch_lightning/plugins/io/torch_plugin.py b/src/pytorch_lightning/plugins/io/torch_plugin.py similarity index 100% rename from pytorch_lightning/plugins/io/torch_plugin.py rename to src/pytorch_lightning/plugins/io/torch_plugin.py diff --git a/pytorch_lightning/plugins/io/xla_plugin.py b/src/pytorch_lightning/plugins/io/xla_plugin.py similarity index 100% rename from pytorch_lightning/plugins/io/xla_plugin.py rename to src/pytorch_lightning/plugins/io/xla_plugin.py diff --git a/pytorch_lightning/plugins/layer_sync.py b/src/pytorch_lightning/plugins/layer_sync.py similarity index 100% rename from pytorch_lightning/plugins/layer_sync.py rename to src/pytorch_lightning/plugins/layer_sync.py diff --git a/pytorch_lightning/plugins/precision/__init__.py b/src/pytorch_lightning/plugins/precision/__init__.py similarity index 100% rename from pytorch_lightning/plugins/precision/__init__.py rename to src/pytorch_lightning/plugins/precision/__init__.py diff --git a/pytorch_lightning/plugins/precision/apex_amp.py b/src/pytorch_lightning/plugins/precision/apex_amp.py similarity index 100% rename from pytorch_lightning/plugins/precision/apex_amp.py rename to src/pytorch_lightning/plugins/precision/apex_amp.py diff --git a/pytorch_lightning/plugins/precision/deepspeed.py b/src/pytorch_lightning/plugins/precision/deepspeed.py similarity index 100% rename from pytorch_lightning/plugins/precision/deepspeed.py rename to src/pytorch_lightning/plugins/precision/deepspeed.py diff --git a/pytorch_lightning/plugins/precision/double.py b/src/pytorch_lightning/plugins/precision/double.py similarity index 100% rename from pytorch_lightning/plugins/precision/double.py rename to src/pytorch_lightning/plugins/precision/double.py diff --git a/pytorch_lightning/plugins/precision/fully_sharded_native_amp.py b/src/pytorch_lightning/plugins/precision/fully_sharded_native_amp.py similarity index 100% rename from pytorch_lightning/plugins/precision/fully_sharded_native_amp.py rename to src/pytorch_lightning/plugins/precision/fully_sharded_native_amp.py diff --git a/pytorch_lightning/plugins/precision/hpu.py b/src/pytorch_lightning/plugins/precision/hpu.py similarity index 100% rename from pytorch_lightning/plugins/precision/hpu.py rename to src/pytorch_lightning/plugins/precision/hpu.py diff --git a/pytorch_lightning/plugins/precision/ipu.py b/src/pytorch_lightning/plugins/precision/ipu.py similarity index 100% rename from pytorch_lightning/plugins/precision/ipu.py rename to src/pytorch_lightning/plugins/precision/ipu.py diff --git a/pytorch_lightning/plugins/precision/mixed.py b/src/pytorch_lightning/plugins/precision/mixed.py similarity index 100% rename from pytorch_lightning/plugins/precision/mixed.py rename to src/pytorch_lightning/plugins/precision/mixed.py diff --git a/pytorch_lightning/plugins/precision/native_amp.py b/src/pytorch_lightning/plugins/precision/native_amp.py similarity index 100% rename from pytorch_lightning/plugins/precision/native_amp.py rename to src/pytorch_lightning/plugins/precision/native_amp.py diff --git a/pytorch_lightning/plugins/precision/precision_plugin.py b/src/pytorch_lightning/plugins/precision/precision_plugin.py similarity index 100% rename from pytorch_lightning/plugins/precision/precision_plugin.py rename to src/pytorch_lightning/plugins/precision/precision_plugin.py diff --git a/pytorch_lightning/plugins/precision/sharded_native_amp.py b/src/pytorch_lightning/plugins/precision/sharded_native_amp.py similarity index 100% rename from pytorch_lightning/plugins/precision/sharded_native_amp.py rename to src/pytorch_lightning/plugins/precision/sharded_native_amp.py diff --git a/pytorch_lightning/plugins/precision/tpu.py b/src/pytorch_lightning/plugins/precision/tpu.py similarity index 100% rename from pytorch_lightning/plugins/precision/tpu.py rename to src/pytorch_lightning/plugins/precision/tpu.py diff --git a/pytorch_lightning/plugins/precision/tpu_bf16.py b/src/pytorch_lightning/plugins/precision/tpu_bf16.py similarity index 100% rename from pytorch_lightning/plugins/precision/tpu_bf16.py rename to src/pytorch_lightning/plugins/precision/tpu_bf16.py diff --git a/pytorch_lightning/plugins/training_type/__init__.py b/src/pytorch_lightning/plugins/training_type/__init__.py similarity index 100% rename from pytorch_lightning/plugins/training_type/__init__.py rename to src/pytorch_lightning/plugins/training_type/__init__.py diff --git a/pytorch_lightning/plugins/training_type/ddp.py b/src/pytorch_lightning/plugins/training_type/ddp.py similarity index 100% rename from pytorch_lightning/plugins/training_type/ddp.py rename to src/pytorch_lightning/plugins/training_type/ddp.py diff --git a/pytorch_lightning/plugins/training_type/ddp2.py b/src/pytorch_lightning/plugins/training_type/ddp2.py similarity index 100% rename from pytorch_lightning/plugins/training_type/ddp2.py rename to src/pytorch_lightning/plugins/training_type/ddp2.py diff --git a/pytorch_lightning/plugins/training_type/ddp_spawn.py b/src/pytorch_lightning/plugins/training_type/ddp_spawn.py similarity index 100% rename from pytorch_lightning/plugins/training_type/ddp_spawn.py rename to src/pytorch_lightning/plugins/training_type/ddp_spawn.py diff --git a/pytorch_lightning/plugins/training_type/deepspeed.py b/src/pytorch_lightning/plugins/training_type/deepspeed.py similarity index 100% rename from pytorch_lightning/plugins/training_type/deepspeed.py rename to src/pytorch_lightning/plugins/training_type/deepspeed.py diff --git a/pytorch_lightning/plugins/training_type/dp.py b/src/pytorch_lightning/plugins/training_type/dp.py similarity index 100% rename from pytorch_lightning/plugins/training_type/dp.py rename to src/pytorch_lightning/plugins/training_type/dp.py diff --git a/pytorch_lightning/plugins/training_type/fully_sharded.py b/src/pytorch_lightning/plugins/training_type/fully_sharded.py similarity index 100% rename from pytorch_lightning/plugins/training_type/fully_sharded.py rename to src/pytorch_lightning/plugins/training_type/fully_sharded.py diff --git a/pytorch_lightning/plugins/training_type/horovod.py b/src/pytorch_lightning/plugins/training_type/horovod.py similarity index 100% rename from pytorch_lightning/plugins/training_type/horovod.py rename to src/pytorch_lightning/plugins/training_type/horovod.py diff --git a/pytorch_lightning/plugins/training_type/ipu.py b/src/pytorch_lightning/plugins/training_type/ipu.py similarity index 100% rename from pytorch_lightning/plugins/training_type/ipu.py rename to src/pytorch_lightning/plugins/training_type/ipu.py diff --git a/pytorch_lightning/plugins/training_type/parallel.py b/src/pytorch_lightning/plugins/training_type/parallel.py similarity index 100% rename from pytorch_lightning/plugins/training_type/parallel.py rename to src/pytorch_lightning/plugins/training_type/parallel.py diff --git a/pytorch_lightning/plugins/training_type/sharded.py b/src/pytorch_lightning/plugins/training_type/sharded.py similarity index 100% rename from pytorch_lightning/plugins/training_type/sharded.py rename to src/pytorch_lightning/plugins/training_type/sharded.py diff --git a/pytorch_lightning/plugins/training_type/sharded_spawn.py b/src/pytorch_lightning/plugins/training_type/sharded_spawn.py similarity index 100% rename from pytorch_lightning/plugins/training_type/sharded_spawn.py rename to src/pytorch_lightning/plugins/training_type/sharded_spawn.py diff --git a/pytorch_lightning/plugins/training_type/single_device.py b/src/pytorch_lightning/plugins/training_type/single_device.py similarity index 100% rename from pytorch_lightning/plugins/training_type/single_device.py rename to src/pytorch_lightning/plugins/training_type/single_device.py diff --git a/pytorch_lightning/plugins/training_type/single_tpu.py b/src/pytorch_lightning/plugins/training_type/single_tpu.py similarity index 100% rename from pytorch_lightning/plugins/training_type/single_tpu.py rename to src/pytorch_lightning/plugins/training_type/single_tpu.py diff --git a/pytorch_lightning/plugins/training_type/tpu_spawn.py b/src/pytorch_lightning/plugins/training_type/tpu_spawn.py similarity index 100% rename from pytorch_lightning/plugins/training_type/tpu_spawn.py rename to src/pytorch_lightning/plugins/training_type/tpu_spawn.py diff --git a/pytorch_lightning/plugins/training_type/training_type_plugin.py b/src/pytorch_lightning/plugins/training_type/training_type_plugin.py similarity index 100% rename from pytorch_lightning/plugins/training_type/training_type_plugin.py rename to src/pytorch_lightning/plugins/training_type/training_type_plugin.py diff --git a/pytorch_lightning/plugins/training_type/utils.py b/src/pytorch_lightning/plugins/training_type/utils.py similarity index 100% rename from pytorch_lightning/plugins/training_type/utils.py rename to src/pytorch_lightning/plugins/training_type/utils.py diff --git a/pytorch_lightning/profiler/__init__.py b/src/pytorch_lightning/profiler/__init__.py similarity index 100% rename from pytorch_lightning/profiler/__init__.py rename to src/pytorch_lightning/profiler/__init__.py diff --git a/pytorch_lightning/profiler/advanced.py b/src/pytorch_lightning/profiler/advanced.py similarity index 100% rename from pytorch_lightning/profiler/advanced.py rename to src/pytorch_lightning/profiler/advanced.py diff --git a/pytorch_lightning/profiler/base.py b/src/pytorch_lightning/profiler/base.py similarity index 100% rename from pytorch_lightning/profiler/base.py rename to src/pytorch_lightning/profiler/base.py diff --git a/pytorch_lightning/profiler/profiler.py b/src/pytorch_lightning/profiler/profiler.py similarity index 100% rename from pytorch_lightning/profiler/profiler.py rename to src/pytorch_lightning/profiler/profiler.py diff --git a/pytorch_lightning/profiler/pytorch.py b/src/pytorch_lightning/profiler/pytorch.py similarity index 100% rename from pytorch_lightning/profiler/pytorch.py rename to src/pytorch_lightning/profiler/pytorch.py diff --git a/pytorch_lightning/profiler/simple.py b/src/pytorch_lightning/profiler/simple.py similarity index 100% rename from pytorch_lightning/profiler/simple.py rename to src/pytorch_lightning/profiler/simple.py diff --git a/pytorch_lightning/profiler/xla.py b/src/pytorch_lightning/profiler/xla.py similarity index 100% rename from pytorch_lightning/profiler/xla.py rename to src/pytorch_lightning/profiler/xla.py diff --git a/pytorch_lightning/py.typed b/src/pytorch_lightning/py.typed similarity index 100% rename from pytorch_lightning/py.typed rename to src/pytorch_lightning/py.typed diff --git a/pytorch_lightning/setup_tools.py b/src/pytorch_lightning/setup_tools.py similarity index 100% rename from pytorch_lightning/setup_tools.py rename to src/pytorch_lightning/setup_tools.py diff --git a/pytorch_lightning/strategies/__init__.py b/src/pytorch_lightning/strategies/__init__.py similarity index 100% rename from pytorch_lightning/strategies/__init__.py rename to src/pytorch_lightning/strategies/__init__.py diff --git a/pytorch_lightning/strategies/bagua.py b/src/pytorch_lightning/strategies/bagua.py similarity index 100% rename from pytorch_lightning/strategies/bagua.py rename to src/pytorch_lightning/strategies/bagua.py diff --git a/pytorch_lightning/strategies/collaborative.py b/src/pytorch_lightning/strategies/collaborative.py similarity index 100% rename from pytorch_lightning/strategies/collaborative.py rename to src/pytorch_lightning/strategies/collaborative.py diff --git a/pytorch_lightning/strategies/ddp.py b/src/pytorch_lightning/strategies/ddp.py similarity index 100% rename from pytorch_lightning/strategies/ddp.py rename to src/pytorch_lightning/strategies/ddp.py diff --git a/pytorch_lightning/strategies/ddp2.py b/src/pytorch_lightning/strategies/ddp2.py similarity index 100% rename from pytorch_lightning/strategies/ddp2.py rename to src/pytorch_lightning/strategies/ddp2.py diff --git a/pytorch_lightning/strategies/ddp_spawn.py b/src/pytorch_lightning/strategies/ddp_spawn.py similarity index 100% rename from pytorch_lightning/strategies/ddp_spawn.py rename to src/pytorch_lightning/strategies/ddp_spawn.py diff --git a/pytorch_lightning/strategies/deepspeed.py b/src/pytorch_lightning/strategies/deepspeed.py similarity index 100% rename from pytorch_lightning/strategies/deepspeed.py rename to src/pytorch_lightning/strategies/deepspeed.py diff --git a/pytorch_lightning/strategies/dp.py b/src/pytorch_lightning/strategies/dp.py similarity index 100% rename from pytorch_lightning/strategies/dp.py rename to src/pytorch_lightning/strategies/dp.py diff --git a/pytorch_lightning/strategies/fully_sharded.py b/src/pytorch_lightning/strategies/fully_sharded.py similarity index 100% rename from pytorch_lightning/strategies/fully_sharded.py rename to src/pytorch_lightning/strategies/fully_sharded.py diff --git a/pytorch_lightning/strategies/fully_sharded_native.py b/src/pytorch_lightning/strategies/fully_sharded_native.py similarity index 100% rename from pytorch_lightning/strategies/fully_sharded_native.py rename to src/pytorch_lightning/strategies/fully_sharded_native.py diff --git a/pytorch_lightning/strategies/horovod.py b/src/pytorch_lightning/strategies/horovod.py similarity index 100% rename from pytorch_lightning/strategies/horovod.py rename to src/pytorch_lightning/strategies/horovod.py diff --git a/pytorch_lightning/strategies/hpu_parallel.py b/src/pytorch_lightning/strategies/hpu_parallel.py similarity index 100% rename from pytorch_lightning/strategies/hpu_parallel.py rename to src/pytorch_lightning/strategies/hpu_parallel.py diff --git a/pytorch_lightning/strategies/ipu.py b/src/pytorch_lightning/strategies/ipu.py similarity index 100% rename from pytorch_lightning/strategies/ipu.py rename to src/pytorch_lightning/strategies/ipu.py diff --git a/pytorch_lightning/strategies/launchers/__init__.py b/src/pytorch_lightning/strategies/launchers/__init__.py similarity index 100% rename from pytorch_lightning/strategies/launchers/__init__.py rename to src/pytorch_lightning/strategies/launchers/__init__.py diff --git a/pytorch_lightning/strategies/launchers/base.py b/src/pytorch_lightning/strategies/launchers/base.py similarity index 100% rename from pytorch_lightning/strategies/launchers/base.py rename to src/pytorch_lightning/strategies/launchers/base.py diff --git a/pytorch_lightning/strategies/launchers/spawn.py b/src/pytorch_lightning/strategies/launchers/spawn.py similarity index 100% rename from pytorch_lightning/strategies/launchers/spawn.py rename to src/pytorch_lightning/strategies/launchers/spawn.py diff --git a/pytorch_lightning/strategies/launchers/subprocess_script.py b/src/pytorch_lightning/strategies/launchers/subprocess_script.py similarity index 100% rename from pytorch_lightning/strategies/launchers/subprocess_script.py rename to src/pytorch_lightning/strategies/launchers/subprocess_script.py diff --git a/pytorch_lightning/strategies/launchers/xla_spawn.py b/src/pytorch_lightning/strategies/launchers/xla_spawn.py similarity index 100% rename from pytorch_lightning/strategies/launchers/xla_spawn.py rename to src/pytorch_lightning/strategies/launchers/xla_spawn.py diff --git a/pytorch_lightning/strategies/parallel.py b/src/pytorch_lightning/strategies/parallel.py similarity index 100% rename from pytorch_lightning/strategies/parallel.py rename to src/pytorch_lightning/strategies/parallel.py diff --git a/pytorch_lightning/strategies/sharded.py b/src/pytorch_lightning/strategies/sharded.py similarity index 100% rename from pytorch_lightning/strategies/sharded.py rename to src/pytorch_lightning/strategies/sharded.py diff --git a/pytorch_lightning/strategies/sharded_spawn.py b/src/pytorch_lightning/strategies/sharded_spawn.py similarity index 100% rename from pytorch_lightning/strategies/sharded_spawn.py rename to src/pytorch_lightning/strategies/sharded_spawn.py diff --git a/pytorch_lightning/strategies/single_device.py b/src/pytorch_lightning/strategies/single_device.py similarity index 100% rename from pytorch_lightning/strategies/single_device.py rename to src/pytorch_lightning/strategies/single_device.py diff --git a/pytorch_lightning/strategies/single_hpu.py b/src/pytorch_lightning/strategies/single_hpu.py similarity index 100% rename from pytorch_lightning/strategies/single_hpu.py rename to src/pytorch_lightning/strategies/single_hpu.py diff --git a/pytorch_lightning/strategies/single_tpu.py b/src/pytorch_lightning/strategies/single_tpu.py similarity index 100% rename from pytorch_lightning/strategies/single_tpu.py rename to src/pytorch_lightning/strategies/single_tpu.py diff --git a/pytorch_lightning/strategies/strategy.py b/src/pytorch_lightning/strategies/strategy.py similarity index 100% rename from pytorch_lightning/strategies/strategy.py rename to src/pytorch_lightning/strategies/strategy.py diff --git a/pytorch_lightning/strategies/strategy_registry.py b/src/pytorch_lightning/strategies/strategy_registry.py similarity index 100% rename from pytorch_lightning/strategies/strategy_registry.py rename to src/pytorch_lightning/strategies/strategy_registry.py diff --git a/pytorch_lightning/strategies/tpu_spawn.py b/src/pytorch_lightning/strategies/tpu_spawn.py similarity index 100% rename from pytorch_lightning/strategies/tpu_spawn.py rename to src/pytorch_lightning/strategies/tpu_spawn.py diff --git a/pytorch_lightning/strategies/utils.py b/src/pytorch_lightning/strategies/utils.py similarity index 100% rename from pytorch_lightning/strategies/utils.py rename to src/pytorch_lightning/strategies/utils.py diff --git a/pytorch_lightning/trainer/__init__.py b/src/pytorch_lightning/trainer/__init__.py similarity index 100% rename from pytorch_lightning/trainer/__init__.py rename to src/pytorch_lightning/trainer/__init__.py diff --git a/pytorch_lightning/trainer/callback_hook.py b/src/pytorch_lightning/trainer/callback_hook.py similarity index 100% rename from pytorch_lightning/trainer/callback_hook.py rename to src/pytorch_lightning/trainer/callback_hook.py diff --git a/pytorch_lightning/trainer/configuration_validator.py b/src/pytorch_lightning/trainer/configuration_validator.py similarity index 100% rename from pytorch_lightning/trainer/configuration_validator.py rename to src/pytorch_lightning/trainer/configuration_validator.py diff --git a/pytorch_lightning/trainer/connectors/__init__.py b/src/pytorch_lightning/trainer/connectors/__init__.py similarity index 100% rename from pytorch_lightning/trainer/connectors/__init__.py rename to src/pytorch_lightning/trainer/connectors/__init__.py diff --git a/pytorch_lightning/trainer/connectors/accelerator_connector.py b/src/pytorch_lightning/trainer/connectors/accelerator_connector.py similarity index 100% rename from pytorch_lightning/trainer/connectors/accelerator_connector.py rename to src/pytorch_lightning/trainer/connectors/accelerator_connector.py diff --git a/pytorch_lightning/trainer/connectors/callback_connector.py b/src/pytorch_lightning/trainer/connectors/callback_connector.py similarity index 100% rename from pytorch_lightning/trainer/connectors/callback_connector.py rename to src/pytorch_lightning/trainer/connectors/callback_connector.py diff --git a/pytorch_lightning/trainer/connectors/checkpoint_connector.py b/src/pytorch_lightning/trainer/connectors/checkpoint_connector.py similarity index 100% rename from pytorch_lightning/trainer/connectors/checkpoint_connector.py rename to src/pytorch_lightning/trainer/connectors/checkpoint_connector.py diff --git a/pytorch_lightning/trainer/connectors/data_connector.py b/src/pytorch_lightning/trainer/connectors/data_connector.py similarity index 100% rename from pytorch_lightning/trainer/connectors/data_connector.py rename to src/pytorch_lightning/trainer/connectors/data_connector.py diff --git a/pytorch_lightning/trainer/connectors/logger_connector/__init__.py b/src/pytorch_lightning/trainer/connectors/logger_connector/__init__.py similarity index 100% rename from pytorch_lightning/trainer/connectors/logger_connector/__init__.py rename to src/pytorch_lightning/trainer/connectors/logger_connector/__init__.py diff --git a/pytorch_lightning/trainer/connectors/logger_connector/fx_validator.py b/src/pytorch_lightning/trainer/connectors/logger_connector/fx_validator.py similarity index 100% rename from pytorch_lightning/trainer/connectors/logger_connector/fx_validator.py rename to src/pytorch_lightning/trainer/connectors/logger_connector/fx_validator.py diff --git a/pytorch_lightning/trainer/connectors/logger_connector/logger_connector.py b/src/pytorch_lightning/trainer/connectors/logger_connector/logger_connector.py similarity index 100% rename from pytorch_lightning/trainer/connectors/logger_connector/logger_connector.py rename to src/pytorch_lightning/trainer/connectors/logger_connector/logger_connector.py diff --git a/pytorch_lightning/trainer/connectors/logger_connector/result.py b/src/pytorch_lightning/trainer/connectors/logger_connector/result.py similarity index 100% rename from pytorch_lightning/trainer/connectors/logger_connector/result.py rename to src/pytorch_lightning/trainer/connectors/logger_connector/result.py diff --git a/pytorch_lightning/trainer/connectors/signal_connector.py b/src/pytorch_lightning/trainer/connectors/signal_connector.py similarity index 100% rename from pytorch_lightning/trainer/connectors/signal_connector.py rename to src/pytorch_lightning/trainer/connectors/signal_connector.py diff --git a/pytorch_lightning/trainer/data_loading.py b/src/pytorch_lightning/trainer/data_loading.py similarity index 100% rename from pytorch_lightning/trainer/data_loading.py rename to src/pytorch_lightning/trainer/data_loading.py diff --git a/pytorch_lightning/trainer/optimizers.py b/src/pytorch_lightning/trainer/optimizers.py similarity index 100% rename from pytorch_lightning/trainer/optimizers.py rename to src/pytorch_lightning/trainer/optimizers.py diff --git a/pytorch_lightning/trainer/progress.py b/src/pytorch_lightning/trainer/progress.py similarity index 100% rename from pytorch_lightning/trainer/progress.py rename to src/pytorch_lightning/trainer/progress.py diff --git a/pytorch_lightning/trainer/states.py b/src/pytorch_lightning/trainer/states.py similarity index 100% rename from pytorch_lightning/trainer/states.py rename to src/pytorch_lightning/trainer/states.py diff --git a/pytorch_lightning/trainer/supporters.py b/src/pytorch_lightning/trainer/supporters.py similarity index 100% rename from pytorch_lightning/trainer/supporters.py rename to src/pytorch_lightning/trainer/supporters.py diff --git a/pytorch_lightning/trainer/trainer.py b/src/pytorch_lightning/trainer/trainer.py similarity index 100% rename from pytorch_lightning/trainer/trainer.py rename to src/pytorch_lightning/trainer/trainer.py diff --git a/pytorch_lightning/tuner/__init__.py b/src/pytorch_lightning/tuner/__init__.py similarity index 100% rename from pytorch_lightning/tuner/__init__.py rename to src/pytorch_lightning/tuner/__init__.py diff --git a/pytorch_lightning/tuner/auto_gpu_select.py b/src/pytorch_lightning/tuner/auto_gpu_select.py similarity index 100% rename from pytorch_lightning/tuner/auto_gpu_select.py rename to src/pytorch_lightning/tuner/auto_gpu_select.py diff --git a/pytorch_lightning/tuner/batch_size_scaling.py b/src/pytorch_lightning/tuner/batch_size_scaling.py similarity index 100% rename from pytorch_lightning/tuner/batch_size_scaling.py rename to src/pytorch_lightning/tuner/batch_size_scaling.py diff --git a/pytorch_lightning/tuner/lr_finder.py b/src/pytorch_lightning/tuner/lr_finder.py similarity index 100% rename from pytorch_lightning/tuner/lr_finder.py rename to src/pytorch_lightning/tuner/lr_finder.py diff --git a/pytorch_lightning/tuner/tuning.py b/src/pytorch_lightning/tuner/tuning.py similarity index 100% rename from pytorch_lightning/tuner/tuning.py rename to src/pytorch_lightning/tuner/tuning.py diff --git a/pytorch_lightning/utilities/__init__.py b/src/pytorch_lightning/utilities/__init__.py similarity index 100% rename from pytorch_lightning/utilities/__init__.py rename to src/pytorch_lightning/utilities/__init__.py diff --git a/pytorch_lightning/utilities/apply_func.py b/src/pytorch_lightning/utilities/apply_func.py similarity index 100% rename from pytorch_lightning/utilities/apply_func.py rename to src/pytorch_lightning/utilities/apply_func.py diff --git a/pytorch_lightning/utilities/argparse.py b/src/pytorch_lightning/utilities/argparse.py similarity index 100% rename from pytorch_lightning/utilities/argparse.py rename to src/pytorch_lightning/utilities/argparse.py diff --git a/pytorch_lightning/utilities/auto_restart.py b/src/pytorch_lightning/utilities/auto_restart.py similarity index 100% rename from pytorch_lightning/utilities/auto_restart.py rename to src/pytorch_lightning/utilities/auto_restart.py diff --git a/pytorch_lightning/utilities/cli.py b/src/pytorch_lightning/utilities/cli.py similarity index 100% rename from pytorch_lightning/utilities/cli.py rename to src/pytorch_lightning/utilities/cli.py diff --git a/pytorch_lightning/utilities/cloud_io.py b/src/pytorch_lightning/utilities/cloud_io.py similarity index 100% rename from pytorch_lightning/utilities/cloud_io.py rename to src/pytorch_lightning/utilities/cloud_io.py diff --git a/pytorch_lightning/utilities/data.py b/src/pytorch_lightning/utilities/data.py similarity index 100% rename from pytorch_lightning/utilities/data.py rename to src/pytorch_lightning/utilities/data.py diff --git a/pytorch_lightning/utilities/deepspeed.py b/src/pytorch_lightning/utilities/deepspeed.py similarity index 100% rename from pytorch_lightning/utilities/deepspeed.py rename to src/pytorch_lightning/utilities/deepspeed.py diff --git a/pytorch_lightning/utilities/device_parser.py b/src/pytorch_lightning/utilities/device_parser.py similarity index 100% rename from pytorch_lightning/utilities/device_parser.py rename to src/pytorch_lightning/utilities/device_parser.py diff --git a/pytorch_lightning/utilities/distributed.py b/src/pytorch_lightning/utilities/distributed.py similarity index 100% rename from pytorch_lightning/utilities/distributed.py rename to src/pytorch_lightning/utilities/distributed.py diff --git a/pytorch_lightning/utilities/enums.py b/src/pytorch_lightning/utilities/enums.py similarity index 100% rename from pytorch_lightning/utilities/enums.py rename to src/pytorch_lightning/utilities/enums.py diff --git a/pytorch_lightning/utilities/exceptions.py b/src/pytorch_lightning/utilities/exceptions.py similarity index 100% rename from pytorch_lightning/utilities/exceptions.py rename to src/pytorch_lightning/utilities/exceptions.py diff --git a/pytorch_lightning/utilities/fetching.py b/src/pytorch_lightning/utilities/fetching.py similarity index 100% rename from pytorch_lightning/utilities/fetching.py rename to src/pytorch_lightning/utilities/fetching.py diff --git a/pytorch_lightning/utilities/finite_checks.py b/src/pytorch_lightning/utilities/finite_checks.py similarity index 100% rename from pytorch_lightning/utilities/finite_checks.py rename to src/pytorch_lightning/utilities/finite_checks.py diff --git a/pytorch_lightning/utilities/grads.py b/src/pytorch_lightning/utilities/grads.py similarity index 100% rename from pytorch_lightning/utilities/grads.py rename to src/pytorch_lightning/utilities/grads.py diff --git a/pytorch_lightning/utilities/imports.py b/src/pytorch_lightning/utilities/imports.py similarity index 100% rename from pytorch_lightning/utilities/imports.py rename to src/pytorch_lightning/utilities/imports.py diff --git a/pytorch_lightning/utilities/logger.py b/src/pytorch_lightning/utilities/logger.py similarity index 100% rename from pytorch_lightning/utilities/logger.py rename to src/pytorch_lightning/utilities/logger.py diff --git a/pytorch_lightning/utilities/memory.py b/src/pytorch_lightning/utilities/memory.py similarity index 100% rename from pytorch_lightning/utilities/memory.py rename to src/pytorch_lightning/utilities/memory.py diff --git a/pytorch_lightning/utilities/meta.py b/src/pytorch_lightning/utilities/meta.py similarity index 100% rename from pytorch_lightning/utilities/meta.py rename to src/pytorch_lightning/utilities/meta.py diff --git a/pytorch_lightning/utilities/metrics.py b/src/pytorch_lightning/utilities/metrics.py similarity index 100% rename from pytorch_lightning/utilities/metrics.py rename to src/pytorch_lightning/utilities/metrics.py diff --git a/pytorch_lightning/utilities/migration.py b/src/pytorch_lightning/utilities/migration.py similarity index 100% rename from pytorch_lightning/utilities/migration.py rename to src/pytorch_lightning/utilities/migration.py diff --git a/pytorch_lightning/utilities/model_helpers.py b/src/pytorch_lightning/utilities/model_helpers.py similarity index 100% rename from pytorch_lightning/utilities/model_helpers.py rename to src/pytorch_lightning/utilities/model_helpers.py diff --git a/pytorch_lightning/utilities/model_summary.py b/src/pytorch_lightning/utilities/model_summary.py similarity index 100% rename from pytorch_lightning/utilities/model_summary.py rename to src/pytorch_lightning/utilities/model_summary.py diff --git a/pytorch_lightning/utilities/optimizer.py b/src/pytorch_lightning/utilities/optimizer.py similarity index 100% rename from pytorch_lightning/utilities/optimizer.py rename to src/pytorch_lightning/utilities/optimizer.py diff --git a/pytorch_lightning/utilities/parameter_tying.py b/src/pytorch_lightning/utilities/parameter_tying.py similarity index 100% rename from pytorch_lightning/utilities/parameter_tying.py rename to src/pytorch_lightning/utilities/parameter_tying.py diff --git a/pytorch_lightning/utilities/parsing.py b/src/pytorch_lightning/utilities/parsing.py similarity index 100% rename from pytorch_lightning/utilities/parsing.py rename to src/pytorch_lightning/utilities/parsing.py diff --git a/pytorch_lightning/utilities/rank_zero.py b/src/pytorch_lightning/utilities/rank_zero.py similarity index 100% rename from pytorch_lightning/utilities/rank_zero.py rename to src/pytorch_lightning/utilities/rank_zero.py diff --git a/pytorch_lightning/utilities/registry.py b/src/pytorch_lightning/utilities/registry.py similarity index 100% rename from pytorch_lightning/utilities/registry.py rename to src/pytorch_lightning/utilities/registry.py diff --git a/pytorch_lightning/utilities/seed.py b/src/pytorch_lightning/utilities/seed.py similarity index 100% rename from pytorch_lightning/utilities/seed.py rename to src/pytorch_lightning/utilities/seed.py diff --git a/pytorch_lightning/utilities/signature_utils.py b/src/pytorch_lightning/utilities/signature_utils.py similarity index 100% rename from pytorch_lightning/utilities/signature_utils.py rename to src/pytorch_lightning/utilities/signature_utils.py diff --git a/pytorch_lightning/utilities/types.py b/src/pytorch_lightning/utilities/types.py similarity index 100% rename from pytorch_lightning/utilities/types.py rename to src/pytorch_lightning/utilities/types.py diff --git a/pytorch_lightning/utilities/upgrade_checkpoint.py b/src/pytorch_lightning/utilities/upgrade_checkpoint.py similarity index 100% rename from pytorch_lightning/utilities/upgrade_checkpoint.py rename to src/pytorch_lightning/utilities/upgrade_checkpoint.py diff --git a/pytorch_lightning/utilities/warnings.py b/src/pytorch_lightning/utilities/warnings.py similarity index 100% rename from pytorch_lightning/utilities/warnings.py rename to src/pytorch_lightning/utilities/warnings.py diff --git a/pytorch_lightning/utilities/xla_device.py b/src/pytorch_lightning/utilities/xla_device.py similarity index 100% rename from pytorch_lightning/utilities/xla_device.py rename to src/pytorch_lightning/utilities/xla_device.py From 4a11e7491de3fe2228893053bad5f439871a6b03 Mon Sep 17 00:00:00 2001 From: Jirka Date: Wed, 1 Jun 2022 14:45:13 +0200 Subject: [PATCH 02/20] move: pl_examples >> src/ --- {pl_examples => src/pl_examples}/README.md | 0 {pl_examples => src/pl_examples}/__init__.py | 0 {pl_examples => src/pl_examples}/basic_examples/README.md | 0 {pl_examples => src/pl_examples}/basic_examples/__init__.py | 0 {pl_examples => src/pl_examples}/basic_examples/autoencoder.py | 0 .../pl_examples}/basic_examples/backbone_image_classifier.py | 0 .../pl_examples}/basic_examples/mnist_datamodule.py | 0 .../pl_examples}/basic_examples/mnist_examples/README.md | 0 .../pl_examples}/basic_examples/mnist_examples/__init__.py | 0 .../basic_examples/mnist_examples/image_classifier_1_pytorch.py | 0 .../basic_examples/mnist_examples/image_classifier_2_lite.py | 0 .../mnist_examples/image_classifier_3_lite_to_lightning_module.py | 0 .../mnist_examples/image_classifier_4_lightning_module.py | 0 .../mnist_examples/image_classifier_5_lightning_datamodule.py | 0 .../pl_examples}/basic_examples/profiler_example.py | 0 .../pl_examples}/bug_report/bug_report_model.ipynb | 0 {pl_examples => src/pl_examples}/bug_report/bug_report_model.py | 0 {pl_examples => src/pl_examples}/domain_templates/__init__.py | 0 .../pl_examples}/domain_templates/computer_vision_fine_tuning.py | 0 .../pl_examples}/domain_templates/generative_adversarial_net.py | 0 {pl_examples => src/pl_examples}/domain_templates/imagenet.py | 0 .../pl_examples}/domain_templates/reinforce_learn_Qnet.py | 0 .../pl_examples}/domain_templates/reinforce_learn_ppo.py | 0 .../pl_examples}/domain_templates/semantic_segmentation.py | 0 {pl_examples => src/pl_examples}/domain_templates/unet.py | 0 {pl_examples => src/pl_examples}/fault_tolerant/automatic.py | 0 .../pl_examples}/hpu_examples/simple_mnist/mnist.py | 0 .../pl_examples}/hpu_examples/simple_mnist/ops_bf16_mnist.txt | 0 .../pl_examples}/hpu_examples/simple_mnist/ops_fp32_mnist.txt | 0 {pl_examples => src/pl_examples}/integration_examples/__init__.py | 0 .../pl_examples}/integration_examples/dali_image_classifier.py | 0 {pl_examples => src/pl_examples}/ipu_examples/__init__.py | 0 {pl_examples => src/pl_examples}/ipu_examples/mnist.py | 0 {pl_examples => src/pl_examples}/loop_examples/__init__.py | 0 {pl_examples => src/pl_examples}/loop_examples/kfold.py | 0 {pl_examples => src/pl_examples}/loop_examples/mnist_lite.py | 0 .../pl_examples}/loop_examples/yielding_training_step.py | 0 {pl_examples => src/pl_examples}/run_examples.sh | 0 {pl_examples => src/pl_examples}/test_examples.py | 0 39 files changed, 0 insertions(+), 0 deletions(-) rename {pl_examples => src/pl_examples}/README.md (100%) rename {pl_examples => src/pl_examples}/__init__.py (100%) rename {pl_examples => src/pl_examples}/basic_examples/README.md (100%) rename {pl_examples => src/pl_examples}/basic_examples/__init__.py (100%) rename {pl_examples => src/pl_examples}/basic_examples/autoencoder.py (100%) rename {pl_examples => src/pl_examples}/basic_examples/backbone_image_classifier.py (100%) rename {pl_examples => src/pl_examples}/basic_examples/mnist_datamodule.py (100%) rename {pl_examples => src/pl_examples}/basic_examples/mnist_examples/README.md (100%) rename {pl_examples => src/pl_examples}/basic_examples/mnist_examples/__init__.py (100%) rename {pl_examples => src/pl_examples}/basic_examples/mnist_examples/image_classifier_1_pytorch.py (100%) rename {pl_examples => src/pl_examples}/basic_examples/mnist_examples/image_classifier_2_lite.py (100%) rename {pl_examples => src/pl_examples}/basic_examples/mnist_examples/image_classifier_3_lite_to_lightning_module.py (100%) rename {pl_examples => src/pl_examples}/basic_examples/mnist_examples/image_classifier_4_lightning_module.py (100%) rename {pl_examples => src/pl_examples}/basic_examples/mnist_examples/image_classifier_5_lightning_datamodule.py (100%) rename {pl_examples => src/pl_examples}/basic_examples/profiler_example.py (100%) rename {pl_examples => src/pl_examples}/bug_report/bug_report_model.ipynb (100%) rename {pl_examples => src/pl_examples}/bug_report/bug_report_model.py (100%) rename {pl_examples => src/pl_examples}/domain_templates/__init__.py (100%) rename {pl_examples => src/pl_examples}/domain_templates/computer_vision_fine_tuning.py (100%) rename {pl_examples => src/pl_examples}/domain_templates/generative_adversarial_net.py (100%) rename {pl_examples => src/pl_examples}/domain_templates/imagenet.py (100%) rename {pl_examples => src/pl_examples}/domain_templates/reinforce_learn_Qnet.py (100%) rename {pl_examples => src/pl_examples}/domain_templates/reinforce_learn_ppo.py (100%) rename {pl_examples => src/pl_examples}/domain_templates/semantic_segmentation.py (100%) rename {pl_examples => src/pl_examples}/domain_templates/unet.py (100%) rename {pl_examples => src/pl_examples}/fault_tolerant/automatic.py (100%) rename {pl_examples => src/pl_examples}/hpu_examples/simple_mnist/mnist.py (100%) rename {pl_examples => src/pl_examples}/hpu_examples/simple_mnist/ops_bf16_mnist.txt (100%) rename {pl_examples => src/pl_examples}/hpu_examples/simple_mnist/ops_fp32_mnist.txt (100%) rename {pl_examples => src/pl_examples}/integration_examples/__init__.py (100%) rename {pl_examples => src/pl_examples}/integration_examples/dali_image_classifier.py (100%) rename {pl_examples => src/pl_examples}/ipu_examples/__init__.py (100%) rename {pl_examples => src/pl_examples}/ipu_examples/mnist.py (100%) rename {pl_examples => src/pl_examples}/loop_examples/__init__.py (100%) rename {pl_examples => src/pl_examples}/loop_examples/kfold.py (100%) rename {pl_examples => src/pl_examples}/loop_examples/mnist_lite.py (100%) rename {pl_examples => src/pl_examples}/loop_examples/yielding_training_step.py (100%) rename {pl_examples => src/pl_examples}/run_examples.sh (100%) mode change 100755 => 100644 rename {pl_examples => src/pl_examples}/test_examples.py (100%) diff --git a/pl_examples/README.md b/src/pl_examples/README.md similarity index 100% rename from pl_examples/README.md rename to src/pl_examples/README.md diff --git a/pl_examples/__init__.py b/src/pl_examples/__init__.py similarity index 100% rename from pl_examples/__init__.py rename to src/pl_examples/__init__.py diff --git a/pl_examples/basic_examples/README.md b/src/pl_examples/basic_examples/README.md similarity index 100% rename from pl_examples/basic_examples/README.md rename to src/pl_examples/basic_examples/README.md diff --git a/pl_examples/basic_examples/__init__.py b/src/pl_examples/basic_examples/__init__.py similarity index 100% rename from pl_examples/basic_examples/__init__.py rename to src/pl_examples/basic_examples/__init__.py diff --git a/pl_examples/basic_examples/autoencoder.py b/src/pl_examples/basic_examples/autoencoder.py similarity index 100% rename from pl_examples/basic_examples/autoencoder.py rename to src/pl_examples/basic_examples/autoencoder.py diff --git a/pl_examples/basic_examples/backbone_image_classifier.py b/src/pl_examples/basic_examples/backbone_image_classifier.py similarity index 100% rename from pl_examples/basic_examples/backbone_image_classifier.py rename to src/pl_examples/basic_examples/backbone_image_classifier.py diff --git a/pl_examples/basic_examples/mnist_datamodule.py b/src/pl_examples/basic_examples/mnist_datamodule.py similarity index 100% rename from pl_examples/basic_examples/mnist_datamodule.py rename to src/pl_examples/basic_examples/mnist_datamodule.py diff --git a/pl_examples/basic_examples/mnist_examples/README.md b/src/pl_examples/basic_examples/mnist_examples/README.md similarity index 100% rename from pl_examples/basic_examples/mnist_examples/README.md rename to src/pl_examples/basic_examples/mnist_examples/README.md diff --git a/pl_examples/basic_examples/mnist_examples/__init__.py b/src/pl_examples/basic_examples/mnist_examples/__init__.py similarity index 100% rename from pl_examples/basic_examples/mnist_examples/__init__.py rename to src/pl_examples/basic_examples/mnist_examples/__init__.py diff --git a/pl_examples/basic_examples/mnist_examples/image_classifier_1_pytorch.py b/src/pl_examples/basic_examples/mnist_examples/image_classifier_1_pytorch.py similarity index 100% rename from pl_examples/basic_examples/mnist_examples/image_classifier_1_pytorch.py rename to src/pl_examples/basic_examples/mnist_examples/image_classifier_1_pytorch.py diff --git a/pl_examples/basic_examples/mnist_examples/image_classifier_2_lite.py b/src/pl_examples/basic_examples/mnist_examples/image_classifier_2_lite.py similarity index 100% rename from pl_examples/basic_examples/mnist_examples/image_classifier_2_lite.py rename to src/pl_examples/basic_examples/mnist_examples/image_classifier_2_lite.py diff --git a/pl_examples/basic_examples/mnist_examples/image_classifier_3_lite_to_lightning_module.py b/src/pl_examples/basic_examples/mnist_examples/image_classifier_3_lite_to_lightning_module.py similarity index 100% rename from pl_examples/basic_examples/mnist_examples/image_classifier_3_lite_to_lightning_module.py rename to src/pl_examples/basic_examples/mnist_examples/image_classifier_3_lite_to_lightning_module.py diff --git a/pl_examples/basic_examples/mnist_examples/image_classifier_4_lightning_module.py b/src/pl_examples/basic_examples/mnist_examples/image_classifier_4_lightning_module.py similarity index 100% rename from pl_examples/basic_examples/mnist_examples/image_classifier_4_lightning_module.py rename to src/pl_examples/basic_examples/mnist_examples/image_classifier_4_lightning_module.py diff --git a/pl_examples/basic_examples/mnist_examples/image_classifier_5_lightning_datamodule.py b/src/pl_examples/basic_examples/mnist_examples/image_classifier_5_lightning_datamodule.py similarity index 100% rename from pl_examples/basic_examples/mnist_examples/image_classifier_5_lightning_datamodule.py rename to src/pl_examples/basic_examples/mnist_examples/image_classifier_5_lightning_datamodule.py diff --git a/pl_examples/basic_examples/profiler_example.py b/src/pl_examples/basic_examples/profiler_example.py similarity index 100% rename from pl_examples/basic_examples/profiler_example.py rename to src/pl_examples/basic_examples/profiler_example.py diff --git a/pl_examples/bug_report/bug_report_model.ipynb b/src/pl_examples/bug_report/bug_report_model.ipynb similarity index 100% rename from pl_examples/bug_report/bug_report_model.ipynb rename to src/pl_examples/bug_report/bug_report_model.ipynb diff --git a/pl_examples/bug_report/bug_report_model.py b/src/pl_examples/bug_report/bug_report_model.py similarity index 100% rename from pl_examples/bug_report/bug_report_model.py rename to src/pl_examples/bug_report/bug_report_model.py diff --git a/pl_examples/domain_templates/__init__.py b/src/pl_examples/domain_templates/__init__.py similarity index 100% rename from pl_examples/domain_templates/__init__.py rename to src/pl_examples/domain_templates/__init__.py diff --git a/pl_examples/domain_templates/computer_vision_fine_tuning.py b/src/pl_examples/domain_templates/computer_vision_fine_tuning.py similarity index 100% rename from pl_examples/domain_templates/computer_vision_fine_tuning.py rename to src/pl_examples/domain_templates/computer_vision_fine_tuning.py diff --git a/pl_examples/domain_templates/generative_adversarial_net.py b/src/pl_examples/domain_templates/generative_adversarial_net.py similarity index 100% rename from pl_examples/domain_templates/generative_adversarial_net.py rename to src/pl_examples/domain_templates/generative_adversarial_net.py diff --git a/pl_examples/domain_templates/imagenet.py b/src/pl_examples/domain_templates/imagenet.py similarity index 100% rename from pl_examples/domain_templates/imagenet.py rename to src/pl_examples/domain_templates/imagenet.py diff --git a/pl_examples/domain_templates/reinforce_learn_Qnet.py b/src/pl_examples/domain_templates/reinforce_learn_Qnet.py similarity index 100% rename from pl_examples/domain_templates/reinforce_learn_Qnet.py rename to src/pl_examples/domain_templates/reinforce_learn_Qnet.py diff --git a/pl_examples/domain_templates/reinforce_learn_ppo.py b/src/pl_examples/domain_templates/reinforce_learn_ppo.py similarity index 100% rename from pl_examples/domain_templates/reinforce_learn_ppo.py rename to src/pl_examples/domain_templates/reinforce_learn_ppo.py diff --git a/pl_examples/domain_templates/semantic_segmentation.py b/src/pl_examples/domain_templates/semantic_segmentation.py similarity index 100% rename from pl_examples/domain_templates/semantic_segmentation.py rename to src/pl_examples/domain_templates/semantic_segmentation.py diff --git a/pl_examples/domain_templates/unet.py b/src/pl_examples/domain_templates/unet.py similarity index 100% rename from pl_examples/domain_templates/unet.py rename to src/pl_examples/domain_templates/unet.py diff --git a/pl_examples/fault_tolerant/automatic.py b/src/pl_examples/fault_tolerant/automatic.py similarity index 100% rename from pl_examples/fault_tolerant/automatic.py rename to src/pl_examples/fault_tolerant/automatic.py diff --git a/pl_examples/hpu_examples/simple_mnist/mnist.py b/src/pl_examples/hpu_examples/simple_mnist/mnist.py similarity index 100% rename from pl_examples/hpu_examples/simple_mnist/mnist.py rename to src/pl_examples/hpu_examples/simple_mnist/mnist.py diff --git a/pl_examples/hpu_examples/simple_mnist/ops_bf16_mnist.txt b/src/pl_examples/hpu_examples/simple_mnist/ops_bf16_mnist.txt similarity index 100% rename from pl_examples/hpu_examples/simple_mnist/ops_bf16_mnist.txt rename to src/pl_examples/hpu_examples/simple_mnist/ops_bf16_mnist.txt diff --git a/pl_examples/hpu_examples/simple_mnist/ops_fp32_mnist.txt b/src/pl_examples/hpu_examples/simple_mnist/ops_fp32_mnist.txt similarity index 100% rename from pl_examples/hpu_examples/simple_mnist/ops_fp32_mnist.txt rename to src/pl_examples/hpu_examples/simple_mnist/ops_fp32_mnist.txt diff --git a/pl_examples/integration_examples/__init__.py b/src/pl_examples/integration_examples/__init__.py similarity index 100% rename from pl_examples/integration_examples/__init__.py rename to src/pl_examples/integration_examples/__init__.py diff --git a/pl_examples/integration_examples/dali_image_classifier.py b/src/pl_examples/integration_examples/dali_image_classifier.py similarity index 100% rename from pl_examples/integration_examples/dali_image_classifier.py rename to src/pl_examples/integration_examples/dali_image_classifier.py diff --git a/pl_examples/ipu_examples/__init__.py b/src/pl_examples/ipu_examples/__init__.py similarity index 100% rename from pl_examples/ipu_examples/__init__.py rename to src/pl_examples/ipu_examples/__init__.py diff --git a/pl_examples/ipu_examples/mnist.py b/src/pl_examples/ipu_examples/mnist.py similarity index 100% rename from pl_examples/ipu_examples/mnist.py rename to src/pl_examples/ipu_examples/mnist.py diff --git a/pl_examples/loop_examples/__init__.py b/src/pl_examples/loop_examples/__init__.py similarity index 100% rename from pl_examples/loop_examples/__init__.py rename to src/pl_examples/loop_examples/__init__.py diff --git a/pl_examples/loop_examples/kfold.py b/src/pl_examples/loop_examples/kfold.py similarity index 100% rename from pl_examples/loop_examples/kfold.py rename to src/pl_examples/loop_examples/kfold.py diff --git a/pl_examples/loop_examples/mnist_lite.py b/src/pl_examples/loop_examples/mnist_lite.py similarity index 100% rename from pl_examples/loop_examples/mnist_lite.py rename to src/pl_examples/loop_examples/mnist_lite.py diff --git a/pl_examples/loop_examples/yielding_training_step.py b/src/pl_examples/loop_examples/yielding_training_step.py similarity index 100% rename from pl_examples/loop_examples/yielding_training_step.py rename to src/pl_examples/loop_examples/yielding_training_step.py diff --git a/pl_examples/run_examples.sh b/src/pl_examples/run_examples.sh old mode 100755 new mode 100644 similarity index 100% rename from pl_examples/run_examples.sh rename to src/pl_examples/run_examples.sh diff --git a/pl_examples/test_examples.py b/src/pl_examples/test_examples.py similarity index 100% rename from pl_examples/test_examples.py rename to src/pl_examples/test_examples.py From 41e2dc141e991ccaa46ee2ce1eaf5cf8d92a471f Mon Sep 17 00:00:00 2001 From: Jirka Date: Wed, 1 Jun 2022 14:54:54 +0200 Subject: [PATCH 03/20] move: legacy >> test/ --- {legacy => test/legacy}/README.md | 0 {legacy => test/legacy}/back-compatible-versions.txt | 0 {legacy => test/legacy}/checkpoints/.gitkeep | 0 {legacy => test/legacy}/generate_checkpoints.sh | 0 {legacy => test/legacy}/simple_classif_training.py | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename {legacy => test/legacy}/README.md (100%) rename {legacy => test/legacy}/back-compatible-versions.txt (100%) rename {legacy => test/legacy}/checkpoints/.gitkeep (100%) rename {legacy => test/legacy}/generate_checkpoints.sh (100%) rename {legacy => test/legacy}/simple_classif_training.py (100%) diff --git a/legacy/README.md b/test/legacy/README.md similarity index 100% rename from legacy/README.md rename to test/legacy/README.md diff --git a/legacy/back-compatible-versions.txt b/test/legacy/back-compatible-versions.txt similarity index 100% rename from legacy/back-compatible-versions.txt rename to test/legacy/back-compatible-versions.txt diff --git a/legacy/checkpoints/.gitkeep b/test/legacy/checkpoints/.gitkeep similarity index 100% rename from legacy/checkpoints/.gitkeep rename to test/legacy/checkpoints/.gitkeep diff --git a/legacy/generate_checkpoints.sh b/test/legacy/generate_checkpoints.sh similarity index 100% rename from legacy/generate_checkpoints.sh rename to test/legacy/generate_checkpoints.sh diff --git a/legacy/simple_classif_training.py b/test/legacy/simple_classif_training.py similarity index 100% rename from legacy/simple_classif_training.py rename to test/legacy/simple_classif_training.py From 701f5b686df80404136d4119a114c361026002b8 Mon Sep 17 00:00:00 2001 From: Jirka Date: Wed, 1 Jun 2022 15:01:08 +0200 Subject: [PATCH 04/20] move: tests >> test/ --- {tests => test}/README.md | 0 {tests => test}/standalone_tests.sh | 0 {tests => test/tests}/__init__.py | 0 {tests => test/tests}/accelerators/__init__.py | 0 {tests => test/tests}/accelerators/test_accelerator_connector.py | 0 {tests => test/tests}/accelerators/test_accelerator_registry.py | 0 {tests => test/tests}/accelerators/test_common.py | 0 {tests => test/tests}/accelerators/test_cpu.py | 0 {tests => test/tests}/accelerators/test_gpu.py | 0 {tests => test/tests}/accelerators/test_hpu.py | 0 {tests => test/tests}/accelerators/test_ipu.py | 0 {tests => test/tests}/accelerators/test_tpu.py | 0 {tests => test/tests}/benchmarks/__init__.py | 0 {tests => test/tests}/benchmarks/generate_comparison.py | 0 {tests => test/tests}/benchmarks/test_basic_parity.py | 0 {tests => test/tests}/benchmarks/test_sharded_parity.py | 0 {tests => test/tests}/benchmarks/test_sync_batchnorm_parity.py | 0 {tests => test/tests}/callbacks/__init__.py | 0 {tests => test/tests}/callbacks/test_callback_hook_outputs.py | 0 {tests => test/tests}/callbacks/test_callbacks.py | 0 {tests => test/tests}/callbacks/test_device_stats_monitor.py | 0 {tests => test/tests}/callbacks/test_early_stopping.py | 0 {tests => test/tests}/callbacks/test_finetuning_callback.py | 0 .../tests}/callbacks/test_gradient_accumulation_scheduler.py | 0 {tests => test/tests}/callbacks/test_lambda_function.py | 0 {tests => test/tests}/callbacks/test_lr_monitor.py | 0 {tests => test/tests}/callbacks/test_model_summary.py | 0 {tests => test/tests}/callbacks/test_prediction_writer.py | 0 {tests => test/tests}/callbacks/test_pruning.py | 0 {tests => test/tests}/callbacks/test_quantization.py | 0 {tests => test/tests}/callbacks/test_rich_model_summary.py | 0 {tests => test/tests}/callbacks/test_rich_progress_bar.py | 0 {tests => test/tests}/callbacks/test_stochastic_weight_avg.py | 0 {tests => test/tests}/callbacks/test_timer.py | 0 {tests => test/tests}/callbacks/test_tqdm_progress_bar.py | 0 {tests => test/tests}/checkpointing/__init__.py | 0 .../tests}/checkpointing/test_checkpoint_callback_frequency.py | 0 {tests => test/tests}/checkpointing/test_legacy_checkpoints.py | 0 {tests => test/tests}/checkpointing/test_model_checkpoint.py | 0 {tests => test/tests}/checkpointing/test_torch_saving.py | 0 {tests => test/tests}/checkpointing/test_trainer_checkpoint.py | 0 {tests => test/tests}/conftest.py | 0 {tests => test/tests}/core/__init__.py | 0 {tests => test/tests}/core/test_datamodules.py | 0 {tests => test/tests}/core/test_lightning_module.py | 0 {tests => test/tests}/core/test_lightning_optimizer.py | 0 {tests => test/tests}/core/test_metric_result_integration.py | 0 {tests => test/tests}/core/test_results.py | 0 {tests => test/tests}/deprecated_api/__init__.py | 0 {tests => test/tests}/deprecated_api/test_remove_1-7.py | 0 {tests => test/tests}/deprecated_api/test_remove_1-8.py | 0 {tests => test/tests}/deprecated_api/test_remove_1-9.py | 0 {tests => test/tests}/deprecated_api/test_remove_2-0.py | 0 {tests => test/tests}/helpers/__init__.py | 0 {tests => test/tests}/helpers/advanced_models.py | 0 {tests => test/tests}/helpers/boring_model.py | 0 {tests => test/tests}/helpers/dataloaders.py | 0 {tests => test/tests}/helpers/datamodules.py | 0 {tests => test/tests}/helpers/datasets.py | 0 {tests => test/tests}/helpers/deterministic_model.py | 0 {tests => test/tests}/helpers/imports.py | 0 {tests => test/tests}/helpers/pipelines.py | 0 {tests => test/tests}/helpers/runif.py | 0 {tests => test/tests}/helpers/simple_models.py | 0 {tests => test/tests}/helpers/test_datasets.py | 0 {tests => test/tests}/helpers/test_models.py | 0 {tests => test/tests}/helpers/torchtext_utils.py | 0 {tests => test/tests}/helpers/utils.py | 0 {tests => test/tests}/lite/__init__.py | 0 {tests => test/tests}/lite/test_lite.py | 0 {tests => test/tests}/lite/test_parity.py | 0 {tests => test/tests}/lite/test_wrappers.py | 0 {tests => test/tests}/loggers/__init__.py | 0 {tests => test/tests}/loggers/test_all.py | 0 {tests => test/tests}/loggers/test_comet.py | 0 {tests => test/tests}/loggers/test_csv.py | 0 {tests => test/tests}/loggers/test_logger.py | 0 {tests => test/tests}/loggers/test_mlflow.py | 0 {tests => test/tests}/loggers/test_neptune.py | 0 {tests => test/tests}/loggers/test_tensorboard.py | 0 {tests => test/tests}/loggers/test_wandb.py | 0 {tests => test/tests}/loops/__init__.py | 0 {tests => test/tests}/loops/batch/__init__.py | 0 {tests => test/tests}/loops/batch/test_truncated_bptt.py | 0 {tests => test/tests}/loops/epoch/__init__.py | 0 {tests => test/tests}/loops/epoch/test_training_epoch_loop.py | 0 {tests => test/tests}/loops/optimization/__init__.py | 0 {tests => test/tests}/loops/optimization/test_closure.py | 0 {tests => test/tests}/loops/optimization/test_manual_loop.py | 0 {tests => test/tests}/loops/optimization/test_optimizer_loop.py | 0 {tests => test/tests}/loops/test_all.py | 0 {tests => test/tests}/loops/test_evaluation_loop.py | 0 {tests => test/tests}/loops/test_evaluation_loop_flow.py | 0 {tests => test/tests}/loops/test_flow_warnings.py | 0 {tests => test/tests}/loops/test_loop_state_dict.py | 0 {tests => test/tests}/loops/test_loops.py | 0 {tests => test/tests}/loops/test_training_loop.py | 0 {tests => test/tests}/loops/test_training_loop_flow_dict.py | 0 {tests => test/tests}/loops/test_training_loop_flow_scalar.py | 0 {tests => test/tests}/loops/test_utilities.py | 0 {tests => test/tests}/models/__init__.py | 0 {tests => test/tests}/models/conf/config.yaml | 0 {tests => test/tests}/models/conf/training/default.yaml | 0 {tests => test/tests}/models/data/__init__.py | 0 {tests => test/tests}/models/data/horovod/__init__.py | 0 {tests => test/tests}/models/data/horovod/test_train_script.py | 0 {tests => test/tests}/models/data/horovod/train_default_model.py | 0 {tests => test/tests}/models/test_amp.py | 0 {tests => test/tests}/models/test_cpu.py | 0 {tests => test/tests}/models/test_gpu.py | 0 {tests => test/tests}/models/test_grad_norm.py | 0 {tests => test/tests}/models/test_hooks.py | 0 {tests => test/tests}/models/test_horovod.py | 0 {tests => test/tests}/models/test_hparams.py | 0 {tests => test/tests}/models/test_onnx.py | 0 {tests => test/tests}/models/test_restore.py | 0 {tests => test/tests}/models/test_torchscript.py | 0 {tests => test/tests}/models/test_tpu.py | 0 {tests => test/tests}/overrides/__init__.py | 0 {tests => test/tests}/overrides/test_base.py | 0 {tests => test/tests}/overrides/test_data_parallel.py | 0 {tests => test/tests}/overrides/test_distributed.py | 0 {tests => test/tests}/plugins/__init__.py | 0 {tests => test/tests}/plugins/environments/__init__.py | 0 .../tests}/plugins/environments/test_kubeflow_environment.py | 0 .../tests}/plugins/environments/test_lightning_environment.py | 0 .../tests}/plugins/environments/test_lsf_environment.py | 0 .../tests}/plugins/environments/test_slurm_environment.py | 0 .../tests}/plugins/environments/test_torchelastic_environment.py | 0 .../tests}/plugins/environments/torch_elastic_deadlock.py | 0 {tests => test/tests}/plugins/precision/__init__.py | 0 {tests => test/tests}/plugins/precision/hpu/ops_bf16.txt | 0 {tests => test/tests}/plugins/precision/hpu/ops_fp32.txt | 0 {tests => test/tests}/plugins/precision/hpu/test_hpu.py | 0 .../tests}/plugins/precision/test_deepspeed_precision.py | 0 {tests => test/tests}/plugins/precision/test_sharded_precision.py | 0 {tests => test/tests}/plugins/precision/test_tpu_bf16_plugin.py | 0 {tests => test/tests}/plugins/test_amp_plugins.py | 0 {tests => test/tests}/plugins/test_checkpoint_io_plugin.py | 0 {tests => test/tests}/plugins/test_cluster_integration.py | 0 {tests => test/tests}/plugins/test_double_plugin.py | 0 {tests => test/tests}/profiler/__init__.py | 0 {tests => test/tests}/profiler/test_profiler.py | 0 {tests => test/tests}/profiler/test_xla_profiler.py | 0 {tests => test/tests}/strategies/__init__.py | 0 {tests => test/tests}/strategies/ddp_model.py | 0 {tests => test/tests}/strategies/test_bagua_strategy.py | 0 {tests => test/tests}/strategies/test_collaborative.py | 0 {tests => test/tests}/strategies/test_common.py | 0 {tests => test/tests}/strategies/test_custom_plugin.py | 0 {tests => test/tests}/strategies/test_ddp.py | 0 {tests => test/tests}/strategies/test_ddp_fully_sharded_native.py | 0 .../strategies/test_ddp_fully_sharded_with_full_state_dict.py | 0 {tests => test/tests}/strategies/test_ddp_spawn.py | 0 {tests => test/tests}/strategies/test_ddp_spawn_strategy.py | 0 {tests => test/tests}/strategies/test_ddp_strategy.py | 0 .../tests}/strategies/test_ddp_strategy_with_comm_hook.py | 0 {tests => test/tests}/strategies/test_deepspeed_strategy.py | 0 {tests => test/tests}/strategies/test_dp.py | 0 {tests => test/tests}/strategies/test_sharded_strategy.py | 0 {tests => test/tests}/strategies/test_single_device_strategy.py | 0 {tests => test/tests}/strategies/test_strategy_registry.py | 0 {tests => test/tests}/strategies/test_tpu_spawn.py | 0 {tests => test/tests}/trainer/__init__.py | 0 {tests => test/tests}/trainer/connectors/__init__.py | 0 .../tests}/trainer/connectors/test_callback_connector.py | 0 .../tests}/trainer/connectors/test_checkpoint_connector.py | 0 {tests => test/tests}/trainer/connectors/test_data_connector.py | 0 {tests => test/tests}/trainer/connectors/test_signal_connector.py | 0 {tests => test/tests}/trainer/dynamic_args/__init__.py | 0 .../tests}/trainer/dynamic_args/test_multiple_eval_dataloaders.py | 0 {tests => test/tests}/trainer/flags/__init__.py | 0 .../tests}/trainer/flags/test_check_val_every_n_epoch.py | 0 {tests => test/tests}/trainer/flags/test_env_vars.py | 0 {tests => test/tests}/trainer/flags/test_fast_dev_run.py | 0 {tests => test/tests}/trainer/flags/test_limit_batches.py | 0 {tests => test/tests}/trainer/flags/test_min_max_epochs.py | 0 {tests => test/tests}/trainer/flags/test_overfit_batches.py | 0 {tests => test/tests}/trainer/flags/test_val_check_interval.py | 0 {tests => test/tests}/trainer/logging_/__init__.py | 0 .../tests}/trainer/logging_/test_distributed_logging.py | 0 {tests => test/tests}/trainer/logging_/test_eval_loop_logging.py | 0 {tests => test/tests}/trainer/logging_/test_logger_connector.py | 0 {tests => test/tests}/trainer/logging_/test_loop_logging.py | 0 .../tests}/trainer/logging_/test_progress_bar_logging.py | 0 {tests => test/tests}/trainer/logging_/test_train_loop_logging.py | 0 {tests => test/tests}/trainer/optimization/__init__.py | 0 {tests => test/tests}/trainer/optimization/test_backward_calls.py | 0 .../tests}/trainer/optimization/test_manual_optimization.py | 0 .../tests}/trainer/optimization/test_multiple_optimizers.py | 0 {tests => test/tests}/trainer/optimization/test_optimizers.py | 0 {tests => test/tests}/trainer/properties/__init__.py | 0 {tests => test/tests}/trainer/properties/test_auto_gpu_select.py | 0 .../tests}/trainer/properties/test_estimated_stepping_batches.py | 0 {tests => test/tests}/trainer/properties/test_get_model.py | 0 {tests => test/tests}/trainer/properties/test_log_dir.py | 0 {tests => test/tests}/trainer/properties/test_loggers.py | 0 {tests => test/tests}/trainer/test_config_validator.py | 0 {tests => test/tests}/trainer/test_dataloaders.py | 0 {tests => test/tests}/trainer/test_progress.py | 0 {tests => test/tests}/trainer/test_states.py | 0 {tests => test/tests}/trainer/test_supporters.py | 0 {tests => test/tests}/trainer/test_trainer.py | 0 {tests => test/tests}/trainer/test_trainer_cli.py | 0 {tests => test/tests}/tuner/__init__.py | 0 {tests => test/tests}/tuner/test_lr_finder.py | 0 {tests => test/tests}/tuner/test_scale_batch_size.py | 0 {tests => test/tests}/tuner/test_tuning.py | 0 {tests => test/tests}/utilities/__init__.py | 0 {tests => test/tests}/utilities/distributed.py | 0 {tests => test/tests}/utilities/test_all_gather_grad.py | 0 {tests => test/tests}/utilities/test_apply_func.py | 0 {tests => test/tests}/utilities/test_apply_func_torchtext.py | 0 {tests => test/tests}/utilities/test_argparse.py | 0 {tests => test/tests}/utilities/test_auto_restart.py | 0 {tests => test/tests}/utilities/test_cli.py | 0 {tests => test/tests}/utilities/test_cloud_io.py | 0 {tests => test/tests}/utilities/test_data.py | 0 .../tests}/utilities/test_deepspeed_collate_checkpoint.py | 0 {tests => test/tests}/utilities/test_distributed.py | 0 {tests => test/tests}/utilities/test_dtype_device_mixin.py | 0 {tests => test/tests}/utilities/test_enums.py | 0 {tests => test/tests}/utilities/test_fetching.py | 0 {tests => test/tests}/utilities/test_finite_checks.py | 0 {tests => test/tests}/utilities/test_grads.py | 0 {tests => test/tests}/utilities/test_imports.py | 0 {tests => test/tests}/utilities/test_logger.py | 0 {tests => test/tests}/utilities/test_memory.py | 0 {tests => test/tests}/utilities/test_meta.py | 0 {tests => test/tests}/utilities/test_migration.py | 0 {tests => test/tests}/utilities/test_model_helpers.py | 0 {tests => test/tests}/utilities/test_model_summary.py | 0 {tests => test/tests}/utilities/test_optimizer.py | 0 {tests => test/tests}/utilities/test_parameter_tying.py | 0 {tests => test/tests}/utilities/test_parsing.py | 0 {tests => test/tests}/utilities/test_rank_zero.py | 0 {tests => test/tests}/utilities/test_remote_filesystem.py | 0 {tests => test/tests}/utilities/test_seed.py | 0 {tests => test/tests}/utilities/test_types.py | 0 {tests => test/tests}/utilities/test_upgrade_checkpoint.py | 0 {tests => test/tests}/utilities/test_warnings.py | 0 {tests => test/tests}/utilities/test_xla_device_utils.py | 0 242 files changed, 0 insertions(+), 0 deletions(-) rename {tests => test}/README.md (100%) rename {tests => test}/standalone_tests.sh (100%) mode change 100755 => 100644 rename {tests => test/tests}/__init__.py (100%) rename {tests => test/tests}/accelerators/__init__.py (100%) rename {tests => test/tests}/accelerators/test_accelerator_connector.py (100%) rename {tests => test/tests}/accelerators/test_accelerator_registry.py (100%) rename {tests => test/tests}/accelerators/test_common.py (100%) rename {tests => test/tests}/accelerators/test_cpu.py (100%) rename {tests => test/tests}/accelerators/test_gpu.py (100%) rename {tests => test/tests}/accelerators/test_hpu.py (100%) rename {tests => test/tests}/accelerators/test_ipu.py (100%) rename {tests => test/tests}/accelerators/test_tpu.py (100%) rename {tests => test/tests}/benchmarks/__init__.py (100%) rename {tests => test/tests}/benchmarks/generate_comparison.py (100%) rename {tests => test/tests}/benchmarks/test_basic_parity.py (100%) rename {tests => test/tests}/benchmarks/test_sharded_parity.py (100%) rename {tests => test/tests}/benchmarks/test_sync_batchnorm_parity.py (100%) rename {tests => test/tests}/callbacks/__init__.py (100%) rename {tests => test/tests}/callbacks/test_callback_hook_outputs.py (100%) rename {tests => test/tests}/callbacks/test_callbacks.py (100%) rename {tests => test/tests}/callbacks/test_device_stats_monitor.py (100%) rename {tests => test/tests}/callbacks/test_early_stopping.py (100%) rename {tests => test/tests}/callbacks/test_finetuning_callback.py (100%) rename {tests => test/tests}/callbacks/test_gradient_accumulation_scheduler.py (100%) rename {tests => test/tests}/callbacks/test_lambda_function.py (100%) rename {tests => test/tests}/callbacks/test_lr_monitor.py (100%) rename {tests => test/tests}/callbacks/test_model_summary.py (100%) rename {tests => test/tests}/callbacks/test_prediction_writer.py (100%) rename {tests => test/tests}/callbacks/test_pruning.py (100%) rename {tests => test/tests}/callbacks/test_quantization.py (100%) rename {tests => test/tests}/callbacks/test_rich_model_summary.py (100%) rename {tests => test/tests}/callbacks/test_rich_progress_bar.py (100%) rename {tests => test/tests}/callbacks/test_stochastic_weight_avg.py (100%) rename {tests => test/tests}/callbacks/test_timer.py (100%) rename {tests => test/tests}/callbacks/test_tqdm_progress_bar.py (100%) rename {tests => test/tests}/checkpointing/__init__.py (100%) rename {tests => test/tests}/checkpointing/test_checkpoint_callback_frequency.py (100%) rename {tests => test/tests}/checkpointing/test_legacy_checkpoints.py (100%) rename {tests => test/tests}/checkpointing/test_model_checkpoint.py (100%) rename {tests => test/tests}/checkpointing/test_torch_saving.py (100%) rename {tests => test/tests}/checkpointing/test_trainer_checkpoint.py (100%) rename {tests => test/tests}/conftest.py (100%) rename {tests => test/tests}/core/__init__.py (100%) rename {tests => test/tests}/core/test_datamodules.py (100%) rename {tests => test/tests}/core/test_lightning_module.py (100%) rename {tests => test/tests}/core/test_lightning_optimizer.py (100%) rename {tests => test/tests}/core/test_metric_result_integration.py (100%) rename {tests => test/tests}/core/test_results.py (100%) rename {tests => test/tests}/deprecated_api/__init__.py (100%) rename {tests => test/tests}/deprecated_api/test_remove_1-7.py (100%) rename {tests => test/tests}/deprecated_api/test_remove_1-8.py (100%) rename {tests => test/tests}/deprecated_api/test_remove_1-9.py (100%) rename {tests => test/tests}/deprecated_api/test_remove_2-0.py (100%) rename {tests => test/tests}/helpers/__init__.py (100%) rename {tests => test/tests}/helpers/advanced_models.py (100%) rename {tests => test/tests}/helpers/boring_model.py (100%) rename {tests => test/tests}/helpers/dataloaders.py (100%) rename {tests => test/tests}/helpers/datamodules.py (100%) rename {tests => test/tests}/helpers/datasets.py (100%) rename {tests => test/tests}/helpers/deterministic_model.py (100%) rename {tests => test/tests}/helpers/imports.py (100%) rename {tests => test/tests}/helpers/pipelines.py (100%) rename {tests => test/tests}/helpers/runif.py (100%) rename {tests => test/tests}/helpers/simple_models.py (100%) rename {tests => test/tests}/helpers/test_datasets.py (100%) rename {tests => test/tests}/helpers/test_models.py (100%) rename {tests => test/tests}/helpers/torchtext_utils.py (100%) rename {tests => test/tests}/helpers/utils.py (100%) rename {tests => test/tests}/lite/__init__.py (100%) rename {tests => test/tests}/lite/test_lite.py (100%) rename {tests => test/tests}/lite/test_parity.py (100%) rename {tests => test/tests}/lite/test_wrappers.py (100%) rename {tests => test/tests}/loggers/__init__.py (100%) rename {tests => test/tests}/loggers/test_all.py (100%) rename {tests => test/tests}/loggers/test_comet.py (100%) rename {tests => test/tests}/loggers/test_csv.py (100%) rename {tests => test/tests}/loggers/test_logger.py (100%) rename {tests => test/tests}/loggers/test_mlflow.py (100%) rename {tests => test/tests}/loggers/test_neptune.py (100%) rename {tests => test/tests}/loggers/test_tensorboard.py (100%) rename {tests => test/tests}/loggers/test_wandb.py (100%) rename {tests => test/tests}/loops/__init__.py (100%) rename {tests => test/tests}/loops/batch/__init__.py (100%) rename {tests => test/tests}/loops/batch/test_truncated_bptt.py (100%) rename {tests => test/tests}/loops/epoch/__init__.py (100%) rename {tests => test/tests}/loops/epoch/test_training_epoch_loop.py (100%) rename {tests => test/tests}/loops/optimization/__init__.py (100%) rename {tests => test/tests}/loops/optimization/test_closure.py (100%) rename {tests => test/tests}/loops/optimization/test_manual_loop.py (100%) rename {tests => test/tests}/loops/optimization/test_optimizer_loop.py (100%) rename {tests => test/tests}/loops/test_all.py (100%) rename {tests => test/tests}/loops/test_evaluation_loop.py (100%) rename {tests => test/tests}/loops/test_evaluation_loop_flow.py (100%) rename {tests => test/tests}/loops/test_flow_warnings.py (100%) rename {tests => test/tests}/loops/test_loop_state_dict.py (100%) rename {tests => test/tests}/loops/test_loops.py (100%) rename {tests => test/tests}/loops/test_training_loop.py (100%) rename {tests => test/tests}/loops/test_training_loop_flow_dict.py (100%) rename {tests => test/tests}/loops/test_training_loop_flow_scalar.py (100%) rename {tests => test/tests}/loops/test_utilities.py (100%) rename {tests => test/tests}/models/__init__.py (100%) rename {tests => test/tests}/models/conf/config.yaml (100%) rename {tests => test/tests}/models/conf/training/default.yaml (100%) rename {tests => test/tests}/models/data/__init__.py (100%) rename {tests => test/tests}/models/data/horovod/__init__.py (100%) rename {tests => test/tests}/models/data/horovod/test_train_script.py (100%) rename {tests => test/tests}/models/data/horovod/train_default_model.py (100%) rename {tests => test/tests}/models/test_amp.py (100%) rename {tests => test/tests}/models/test_cpu.py (100%) rename {tests => test/tests}/models/test_gpu.py (100%) rename {tests => test/tests}/models/test_grad_norm.py (100%) rename {tests => test/tests}/models/test_hooks.py (100%) rename {tests => test/tests}/models/test_horovod.py (100%) rename {tests => test/tests}/models/test_hparams.py (100%) rename {tests => test/tests}/models/test_onnx.py (100%) rename {tests => test/tests}/models/test_restore.py (100%) rename {tests => test/tests}/models/test_torchscript.py (100%) rename {tests => test/tests}/models/test_tpu.py (100%) rename {tests => test/tests}/overrides/__init__.py (100%) rename {tests => test/tests}/overrides/test_base.py (100%) rename {tests => test/tests}/overrides/test_data_parallel.py (100%) rename {tests => test/tests}/overrides/test_distributed.py (100%) rename {tests => test/tests}/plugins/__init__.py (100%) rename {tests => test/tests}/plugins/environments/__init__.py (100%) rename {tests => test/tests}/plugins/environments/test_kubeflow_environment.py (100%) rename {tests => test/tests}/plugins/environments/test_lightning_environment.py (100%) rename {tests => test/tests}/plugins/environments/test_lsf_environment.py (100%) rename {tests => test/tests}/plugins/environments/test_slurm_environment.py (100%) rename {tests => test/tests}/plugins/environments/test_torchelastic_environment.py (100%) rename {tests => test/tests}/plugins/environments/torch_elastic_deadlock.py (100%) rename {tests => test/tests}/plugins/precision/__init__.py (100%) rename {tests => test/tests}/plugins/precision/hpu/ops_bf16.txt (100%) rename {tests => test/tests}/plugins/precision/hpu/ops_fp32.txt (100%) rename {tests => test/tests}/plugins/precision/hpu/test_hpu.py (100%) rename {tests => test/tests}/plugins/precision/test_deepspeed_precision.py (100%) rename {tests => test/tests}/plugins/precision/test_sharded_precision.py (100%) rename {tests => test/tests}/plugins/precision/test_tpu_bf16_plugin.py (100%) rename {tests => test/tests}/plugins/test_amp_plugins.py (100%) rename {tests => test/tests}/plugins/test_checkpoint_io_plugin.py (100%) rename {tests => test/tests}/plugins/test_cluster_integration.py (100%) rename {tests => test/tests}/plugins/test_double_plugin.py (100%) rename {tests => test/tests}/profiler/__init__.py (100%) rename {tests => test/tests}/profiler/test_profiler.py (100%) rename {tests => test/tests}/profiler/test_xla_profiler.py (100%) rename {tests => test/tests}/strategies/__init__.py (100%) rename {tests => test/tests}/strategies/ddp_model.py (100%) rename {tests => test/tests}/strategies/test_bagua_strategy.py (100%) rename {tests => test/tests}/strategies/test_collaborative.py (100%) rename {tests => test/tests}/strategies/test_common.py (100%) rename {tests => test/tests}/strategies/test_custom_plugin.py (100%) rename {tests => test/tests}/strategies/test_ddp.py (100%) rename {tests => test/tests}/strategies/test_ddp_fully_sharded_native.py (100%) rename {tests => test/tests}/strategies/test_ddp_fully_sharded_with_full_state_dict.py (100%) rename {tests => test/tests}/strategies/test_ddp_spawn.py (100%) rename {tests => test/tests}/strategies/test_ddp_spawn_strategy.py (100%) rename {tests => test/tests}/strategies/test_ddp_strategy.py (100%) rename {tests => test/tests}/strategies/test_ddp_strategy_with_comm_hook.py (100%) rename {tests => test/tests}/strategies/test_deepspeed_strategy.py (100%) rename {tests => test/tests}/strategies/test_dp.py (100%) rename {tests => test/tests}/strategies/test_sharded_strategy.py (100%) rename {tests => test/tests}/strategies/test_single_device_strategy.py (100%) rename {tests => test/tests}/strategies/test_strategy_registry.py (100%) rename {tests => test/tests}/strategies/test_tpu_spawn.py (100%) rename {tests => test/tests}/trainer/__init__.py (100%) rename {tests => test/tests}/trainer/connectors/__init__.py (100%) rename {tests => test/tests}/trainer/connectors/test_callback_connector.py (100%) rename {tests => test/tests}/trainer/connectors/test_checkpoint_connector.py (100%) rename {tests => test/tests}/trainer/connectors/test_data_connector.py (100%) rename {tests => test/tests}/trainer/connectors/test_signal_connector.py (100%) rename {tests => test/tests}/trainer/dynamic_args/__init__.py (100%) rename {tests => test/tests}/trainer/dynamic_args/test_multiple_eval_dataloaders.py (100%) rename {tests => test/tests}/trainer/flags/__init__.py (100%) rename {tests => test/tests}/trainer/flags/test_check_val_every_n_epoch.py (100%) rename {tests => test/tests}/trainer/flags/test_env_vars.py (100%) rename {tests => test/tests}/trainer/flags/test_fast_dev_run.py (100%) rename {tests => test/tests}/trainer/flags/test_limit_batches.py (100%) rename {tests => test/tests}/trainer/flags/test_min_max_epochs.py (100%) rename {tests => test/tests}/trainer/flags/test_overfit_batches.py (100%) rename {tests => test/tests}/trainer/flags/test_val_check_interval.py (100%) rename {tests => test/tests}/trainer/logging_/__init__.py (100%) rename {tests => test/tests}/trainer/logging_/test_distributed_logging.py (100%) rename {tests => test/tests}/trainer/logging_/test_eval_loop_logging.py (100%) rename {tests => test/tests}/trainer/logging_/test_logger_connector.py (100%) rename {tests => test/tests}/trainer/logging_/test_loop_logging.py (100%) rename {tests => test/tests}/trainer/logging_/test_progress_bar_logging.py (100%) rename {tests => test/tests}/trainer/logging_/test_train_loop_logging.py (100%) rename {tests => test/tests}/trainer/optimization/__init__.py (100%) rename {tests => test/tests}/trainer/optimization/test_backward_calls.py (100%) rename {tests => test/tests}/trainer/optimization/test_manual_optimization.py (100%) rename {tests => test/tests}/trainer/optimization/test_multiple_optimizers.py (100%) rename {tests => test/tests}/trainer/optimization/test_optimizers.py (100%) rename {tests => test/tests}/trainer/properties/__init__.py (100%) rename {tests => test/tests}/trainer/properties/test_auto_gpu_select.py (100%) rename {tests => test/tests}/trainer/properties/test_estimated_stepping_batches.py (100%) rename {tests => test/tests}/trainer/properties/test_get_model.py (100%) rename {tests => test/tests}/trainer/properties/test_log_dir.py (100%) rename {tests => test/tests}/trainer/properties/test_loggers.py (100%) rename {tests => test/tests}/trainer/test_config_validator.py (100%) rename {tests => test/tests}/trainer/test_dataloaders.py (100%) rename {tests => test/tests}/trainer/test_progress.py (100%) rename {tests => test/tests}/trainer/test_states.py (100%) rename {tests => test/tests}/trainer/test_supporters.py (100%) rename {tests => test/tests}/trainer/test_trainer.py (100%) rename {tests => test/tests}/trainer/test_trainer_cli.py (100%) rename {tests => test/tests}/tuner/__init__.py (100%) rename {tests => test/tests}/tuner/test_lr_finder.py (100%) rename {tests => test/tests}/tuner/test_scale_batch_size.py (100%) rename {tests => test/tests}/tuner/test_tuning.py (100%) rename {tests => test/tests}/utilities/__init__.py (100%) rename {tests => test/tests}/utilities/distributed.py (100%) rename {tests => test/tests}/utilities/test_all_gather_grad.py (100%) rename {tests => test/tests}/utilities/test_apply_func.py (100%) rename {tests => test/tests}/utilities/test_apply_func_torchtext.py (100%) rename {tests => test/tests}/utilities/test_argparse.py (100%) rename {tests => test/tests}/utilities/test_auto_restart.py (100%) rename {tests => test/tests}/utilities/test_cli.py (100%) rename {tests => test/tests}/utilities/test_cloud_io.py (100%) rename {tests => test/tests}/utilities/test_data.py (100%) rename {tests => test/tests}/utilities/test_deepspeed_collate_checkpoint.py (100%) rename {tests => test/tests}/utilities/test_distributed.py (100%) rename {tests => test/tests}/utilities/test_dtype_device_mixin.py (100%) rename {tests => test/tests}/utilities/test_enums.py (100%) rename {tests => test/tests}/utilities/test_fetching.py (100%) rename {tests => test/tests}/utilities/test_finite_checks.py (100%) rename {tests => test/tests}/utilities/test_grads.py (100%) rename {tests => test/tests}/utilities/test_imports.py (100%) rename {tests => test/tests}/utilities/test_logger.py (100%) rename {tests => test/tests}/utilities/test_memory.py (100%) rename {tests => test/tests}/utilities/test_meta.py (100%) rename {tests => test/tests}/utilities/test_migration.py (100%) rename {tests => test/tests}/utilities/test_model_helpers.py (100%) rename {tests => test/tests}/utilities/test_model_summary.py (100%) rename {tests => test/tests}/utilities/test_optimizer.py (100%) rename {tests => test/tests}/utilities/test_parameter_tying.py (100%) rename {tests => test/tests}/utilities/test_parsing.py (100%) rename {tests => test/tests}/utilities/test_rank_zero.py (100%) rename {tests => test/tests}/utilities/test_remote_filesystem.py (100%) rename {tests => test/tests}/utilities/test_seed.py (100%) rename {tests => test/tests}/utilities/test_types.py (100%) rename {tests => test/tests}/utilities/test_upgrade_checkpoint.py (100%) rename {tests => test/tests}/utilities/test_warnings.py (100%) rename {tests => test/tests}/utilities/test_xla_device_utils.py (100%) diff --git a/tests/README.md b/test/README.md similarity index 100% rename from tests/README.md rename to test/README.md diff --git a/tests/standalone_tests.sh b/test/standalone_tests.sh old mode 100755 new mode 100644 similarity index 100% rename from tests/standalone_tests.sh rename to test/standalone_tests.sh diff --git a/tests/__init__.py b/test/tests/__init__.py similarity index 100% rename from tests/__init__.py rename to test/tests/__init__.py diff --git a/tests/accelerators/__init__.py b/test/tests/accelerators/__init__.py similarity index 100% rename from tests/accelerators/__init__.py rename to test/tests/accelerators/__init__.py diff --git a/tests/accelerators/test_accelerator_connector.py b/test/tests/accelerators/test_accelerator_connector.py similarity index 100% rename from tests/accelerators/test_accelerator_connector.py rename to test/tests/accelerators/test_accelerator_connector.py diff --git a/tests/accelerators/test_accelerator_registry.py b/test/tests/accelerators/test_accelerator_registry.py similarity index 100% rename from tests/accelerators/test_accelerator_registry.py rename to test/tests/accelerators/test_accelerator_registry.py diff --git a/tests/accelerators/test_common.py b/test/tests/accelerators/test_common.py similarity index 100% rename from tests/accelerators/test_common.py rename to test/tests/accelerators/test_common.py diff --git a/tests/accelerators/test_cpu.py b/test/tests/accelerators/test_cpu.py similarity index 100% rename from tests/accelerators/test_cpu.py rename to test/tests/accelerators/test_cpu.py diff --git a/tests/accelerators/test_gpu.py b/test/tests/accelerators/test_gpu.py similarity index 100% rename from tests/accelerators/test_gpu.py rename to test/tests/accelerators/test_gpu.py diff --git a/tests/accelerators/test_hpu.py b/test/tests/accelerators/test_hpu.py similarity index 100% rename from tests/accelerators/test_hpu.py rename to test/tests/accelerators/test_hpu.py diff --git a/tests/accelerators/test_ipu.py b/test/tests/accelerators/test_ipu.py similarity index 100% rename from tests/accelerators/test_ipu.py rename to test/tests/accelerators/test_ipu.py diff --git a/tests/accelerators/test_tpu.py b/test/tests/accelerators/test_tpu.py similarity index 100% rename from tests/accelerators/test_tpu.py rename to test/tests/accelerators/test_tpu.py diff --git a/tests/benchmarks/__init__.py b/test/tests/benchmarks/__init__.py similarity index 100% rename from tests/benchmarks/__init__.py rename to test/tests/benchmarks/__init__.py diff --git a/tests/benchmarks/generate_comparison.py b/test/tests/benchmarks/generate_comparison.py similarity index 100% rename from tests/benchmarks/generate_comparison.py rename to test/tests/benchmarks/generate_comparison.py diff --git a/tests/benchmarks/test_basic_parity.py b/test/tests/benchmarks/test_basic_parity.py similarity index 100% rename from tests/benchmarks/test_basic_parity.py rename to test/tests/benchmarks/test_basic_parity.py diff --git a/tests/benchmarks/test_sharded_parity.py b/test/tests/benchmarks/test_sharded_parity.py similarity index 100% rename from tests/benchmarks/test_sharded_parity.py rename to test/tests/benchmarks/test_sharded_parity.py diff --git a/tests/benchmarks/test_sync_batchnorm_parity.py b/test/tests/benchmarks/test_sync_batchnorm_parity.py similarity index 100% rename from tests/benchmarks/test_sync_batchnorm_parity.py rename to test/tests/benchmarks/test_sync_batchnorm_parity.py diff --git a/tests/callbacks/__init__.py b/test/tests/callbacks/__init__.py similarity index 100% rename from tests/callbacks/__init__.py rename to test/tests/callbacks/__init__.py diff --git a/tests/callbacks/test_callback_hook_outputs.py b/test/tests/callbacks/test_callback_hook_outputs.py similarity index 100% rename from tests/callbacks/test_callback_hook_outputs.py rename to test/tests/callbacks/test_callback_hook_outputs.py diff --git a/tests/callbacks/test_callbacks.py b/test/tests/callbacks/test_callbacks.py similarity index 100% rename from tests/callbacks/test_callbacks.py rename to test/tests/callbacks/test_callbacks.py diff --git a/tests/callbacks/test_device_stats_monitor.py b/test/tests/callbacks/test_device_stats_monitor.py similarity index 100% rename from tests/callbacks/test_device_stats_monitor.py rename to test/tests/callbacks/test_device_stats_monitor.py diff --git a/tests/callbacks/test_early_stopping.py b/test/tests/callbacks/test_early_stopping.py similarity index 100% rename from tests/callbacks/test_early_stopping.py rename to test/tests/callbacks/test_early_stopping.py diff --git a/tests/callbacks/test_finetuning_callback.py b/test/tests/callbacks/test_finetuning_callback.py similarity index 100% rename from tests/callbacks/test_finetuning_callback.py rename to test/tests/callbacks/test_finetuning_callback.py diff --git a/tests/callbacks/test_gradient_accumulation_scheduler.py b/test/tests/callbacks/test_gradient_accumulation_scheduler.py similarity index 100% rename from tests/callbacks/test_gradient_accumulation_scheduler.py rename to test/tests/callbacks/test_gradient_accumulation_scheduler.py diff --git a/tests/callbacks/test_lambda_function.py b/test/tests/callbacks/test_lambda_function.py similarity index 100% rename from tests/callbacks/test_lambda_function.py rename to test/tests/callbacks/test_lambda_function.py diff --git a/tests/callbacks/test_lr_monitor.py b/test/tests/callbacks/test_lr_monitor.py similarity index 100% rename from tests/callbacks/test_lr_monitor.py rename to test/tests/callbacks/test_lr_monitor.py diff --git a/tests/callbacks/test_model_summary.py b/test/tests/callbacks/test_model_summary.py similarity index 100% rename from tests/callbacks/test_model_summary.py rename to test/tests/callbacks/test_model_summary.py diff --git a/tests/callbacks/test_prediction_writer.py b/test/tests/callbacks/test_prediction_writer.py similarity index 100% rename from tests/callbacks/test_prediction_writer.py rename to test/tests/callbacks/test_prediction_writer.py diff --git a/tests/callbacks/test_pruning.py b/test/tests/callbacks/test_pruning.py similarity index 100% rename from tests/callbacks/test_pruning.py rename to test/tests/callbacks/test_pruning.py diff --git a/tests/callbacks/test_quantization.py b/test/tests/callbacks/test_quantization.py similarity index 100% rename from tests/callbacks/test_quantization.py rename to test/tests/callbacks/test_quantization.py diff --git a/tests/callbacks/test_rich_model_summary.py b/test/tests/callbacks/test_rich_model_summary.py similarity index 100% rename from tests/callbacks/test_rich_model_summary.py rename to test/tests/callbacks/test_rich_model_summary.py diff --git a/tests/callbacks/test_rich_progress_bar.py b/test/tests/callbacks/test_rich_progress_bar.py similarity index 100% rename from tests/callbacks/test_rich_progress_bar.py rename to test/tests/callbacks/test_rich_progress_bar.py diff --git a/tests/callbacks/test_stochastic_weight_avg.py b/test/tests/callbacks/test_stochastic_weight_avg.py similarity index 100% rename from tests/callbacks/test_stochastic_weight_avg.py rename to test/tests/callbacks/test_stochastic_weight_avg.py diff --git a/tests/callbacks/test_timer.py b/test/tests/callbacks/test_timer.py similarity index 100% rename from tests/callbacks/test_timer.py rename to test/tests/callbacks/test_timer.py diff --git a/tests/callbacks/test_tqdm_progress_bar.py b/test/tests/callbacks/test_tqdm_progress_bar.py similarity index 100% rename from tests/callbacks/test_tqdm_progress_bar.py rename to test/tests/callbacks/test_tqdm_progress_bar.py diff --git a/tests/checkpointing/__init__.py b/test/tests/checkpointing/__init__.py similarity index 100% rename from tests/checkpointing/__init__.py rename to test/tests/checkpointing/__init__.py diff --git a/tests/checkpointing/test_checkpoint_callback_frequency.py b/test/tests/checkpointing/test_checkpoint_callback_frequency.py similarity index 100% rename from tests/checkpointing/test_checkpoint_callback_frequency.py rename to test/tests/checkpointing/test_checkpoint_callback_frequency.py diff --git a/tests/checkpointing/test_legacy_checkpoints.py b/test/tests/checkpointing/test_legacy_checkpoints.py similarity index 100% rename from tests/checkpointing/test_legacy_checkpoints.py rename to test/tests/checkpointing/test_legacy_checkpoints.py diff --git a/tests/checkpointing/test_model_checkpoint.py b/test/tests/checkpointing/test_model_checkpoint.py similarity index 100% rename from tests/checkpointing/test_model_checkpoint.py rename to test/tests/checkpointing/test_model_checkpoint.py diff --git a/tests/checkpointing/test_torch_saving.py b/test/tests/checkpointing/test_torch_saving.py similarity index 100% rename from tests/checkpointing/test_torch_saving.py rename to test/tests/checkpointing/test_torch_saving.py diff --git a/tests/checkpointing/test_trainer_checkpoint.py b/test/tests/checkpointing/test_trainer_checkpoint.py similarity index 100% rename from tests/checkpointing/test_trainer_checkpoint.py rename to test/tests/checkpointing/test_trainer_checkpoint.py diff --git a/tests/conftest.py b/test/tests/conftest.py similarity index 100% rename from tests/conftest.py rename to test/tests/conftest.py diff --git a/tests/core/__init__.py b/test/tests/core/__init__.py similarity index 100% rename from tests/core/__init__.py rename to test/tests/core/__init__.py diff --git a/tests/core/test_datamodules.py b/test/tests/core/test_datamodules.py similarity index 100% rename from tests/core/test_datamodules.py rename to test/tests/core/test_datamodules.py diff --git a/tests/core/test_lightning_module.py b/test/tests/core/test_lightning_module.py similarity index 100% rename from tests/core/test_lightning_module.py rename to test/tests/core/test_lightning_module.py diff --git a/tests/core/test_lightning_optimizer.py b/test/tests/core/test_lightning_optimizer.py similarity index 100% rename from tests/core/test_lightning_optimizer.py rename to test/tests/core/test_lightning_optimizer.py diff --git a/tests/core/test_metric_result_integration.py b/test/tests/core/test_metric_result_integration.py similarity index 100% rename from tests/core/test_metric_result_integration.py rename to test/tests/core/test_metric_result_integration.py diff --git a/tests/core/test_results.py b/test/tests/core/test_results.py similarity index 100% rename from tests/core/test_results.py rename to test/tests/core/test_results.py diff --git a/tests/deprecated_api/__init__.py b/test/tests/deprecated_api/__init__.py similarity index 100% rename from tests/deprecated_api/__init__.py rename to test/tests/deprecated_api/__init__.py diff --git a/tests/deprecated_api/test_remove_1-7.py b/test/tests/deprecated_api/test_remove_1-7.py similarity index 100% rename from tests/deprecated_api/test_remove_1-7.py rename to test/tests/deprecated_api/test_remove_1-7.py diff --git a/tests/deprecated_api/test_remove_1-8.py b/test/tests/deprecated_api/test_remove_1-8.py similarity index 100% rename from tests/deprecated_api/test_remove_1-8.py rename to test/tests/deprecated_api/test_remove_1-8.py diff --git a/tests/deprecated_api/test_remove_1-9.py b/test/tests/deprecated_api/test_remove_1-9.py similarity index 100% rename from tests/deprecated_api/test_remove_1-9.py rename to test/tests/deprecated_api/test_remove_1-9.py diff --git a/tests/deprecated_api/test_remove_2-0.py b/test/tests/deprecated_api/test_remove_2-0.py similarity index 100% rename from tests/deprecated_api/test_remove_2-0.py rename to test/tests/deprecated_api/test_remove_2-0.py diff --git a/tests/helpers/__init__.py b/test/tests/helpers/__init__.py similarity index 100% rename from tests/helpers/__init__.py rename to test/tests/helpers/__init__.py diff --git a/tests/helpers/advanced_models.py b/test/tests/helpers/advanced_models.py similarity index 100% rename from tests/helpers/advanced_models.py rename to test/tests/helpers/advanced_models.py diff --git a/tests/helpers/boring_model.py b/test/tests/helpers/boring_model.py similarity index 100% rename from tests/helpers/boring_model.py rename to test/tests/helpers/boring_model.py diff --git a/tests/helpers/dataloaders.py b/test/tests/helpers/dataloaders.py similarity index 100% rename from tests/helpers/dataloaders.py rename to test/tests/helpers/dataloaders.py diff --git a/tests/helpers/datamodules.py b/test/tests/helpers/datamodules.py similarity index 100% rename from tests/helpers/datamodules.py rename to test/tests/helpers/datamodules.py diff --git a/tests/helpers/datasets.py b/test/tests/helpers/datasets.py similarity index 100% rename from tests/helpers/datasets.py rename to test/tests/helpers/datasets.py diff --git a/tests/helpers/deterministic_model.py b/test/tests/helpers/deterministic_model.py similarity index 100% rename from tests/helpers/deterministic_model.py rename to test/tests/helpers/deterministic_model.py diff --git a/tests/helpers/imports.py b/test/tests/helpers/imports.py similarity index 100% rename from tests/helpers/imports.py rename to test/tests/helpers/imports.py diff --git a/tests/helpers/pipelines.py b/test/tests/helpers/pipelines.py similarity index 100% rename from tests/helpers/pipelines.py rename to test/tests/helpers/pipelines.py diff --git a/tests/helpers/runif.py b/test/tests/helpers/runif.py similarity index 100% rename from tests/helpers/runif.py rename to test/tests/helpers/runif.py diff --git a/tests/helpers/simple_models.py b/test/tests/helpers/simple_models.py similarity index 100% rename from tests/helpers/simple_models.py rename to test/tests/helpers/simple_models.py diff --git a/tests/helpers/test_datasets.py b/test/tests/helpers/test_datasets.py similarity index 100% rename from tests/helpers/test_datasets.py rename to test/tests/helpers/test_datasets.py diff --git a/tests/helpers/test_models.py b/test/tests/helpers/test_models.py similarity index 100% rename from tests/helpers/test_models.py rename to test/tests/helpers/test_models.py diff --git a/tests/helpers/torchtext_utils.py b/test/tests/helpers/torchtext_utils.py similarity index 100% rename from tests/helpers/torchtext_utils.py rename to test/tests/helpers/torchtext_utils.py diff --git a/tests/helpers/utils.py b/test/tests/helpers/utils.py similarity index 100% rename from tests/helpers/utils.py rename to test/tests/helpers/utils.py diff --git a/tests/lite/__init__.py b/test/tests/lite/__init__.py similarity index 100% rename from tests/lite/__init__.py rename to test/tests/lite/__init__.py diff --git a/tests/lite/test_lite.py b/test/tests/lite/test_lite.py similarity index 100% rename from tests/lite/test_lite.py rename to test/tests/lite/test_lite.py diff --git a/tests/lite/test_parity.py b/test/tests/lite/test_parity.py similarity index 100% rename from tests/lite/test_parity.py rename to test/tests/lite/test_parity.py diff --git a/tests/lite/test_wrappers.py b/test/tests/lite/test_wrappers.py similarity index 100% rename from tests/lite/test_wrappers.py rename to test/tests/lite/test_wrappers.py diff --git a/tests/loggers/__init__.py b/test/tests/loggers/__init__.py similarity index 100% rename from tests/loggers/__init__.py rename to test/tests/loggers/__init__.py diff --git a/tests/loggers/test_all.py b/test/tests/loggers/test_all.py similarity index 100% rename from tests/loggers/test_all.py rename to test/tests/loggers/test_all.py diff --git a/tests/loggers/test_comet.py b/test/tests/loggers/test_comet.py similarity index 100% rename from tests/loggers/test_comet.py rename to test/tests/loggers/test_comet.py diff --git a/tests/loggers/test_csv.py b/test/tests/loggers/test_csv.py similarity index 100% rename from tests/loggers/test_csv.py rename to test/tests/loggers/test_csv.py diff --git a/tests/loggers/test_logger.py b/test/tests/loggers/test_logger.py similarity index 100% rename from tests/loggers/test_logger.py rename to test/tests/loggers/test_logger.py diff --git a/tests/loggers/test_mlflow.py b/test/tests/loggers/test_mlflow.py similarity index 100% rename from tests/loggers/test_mlflow.py rename to test/tests/loggers/test_mlflow.py diff --git a/tests/loggers/test_neptune.py b/test/tests/loggers/test_neptune.py similarity index 100% rename from tests/loggers/test_neptune.py rename to test/tests/loggers/test_neptune.py diff --git a/tests/loggers/test_tensorboard.py b/test/tests/loggers/test_tensorboard.py similarity index 100% rename from tests/loggers/test_tensorboard.py rename to test/tests/loggers/test_tensorboard.py diff --git a/tests/loggers/test_wandb.py b/test/tests/loggers/test_wandb.py similarity index 100% rename from tests/loggers/test_wandb.py rename to test/tests/loggers/test_wandb.py diff --git a/tests/loops/__init__.py b/test/tests/loops/__init__.py similarity index 100% rename from tests/loops/__init__.py rename to test/tests/loops/__init__.py diff --git a/tests/loops/batch/__init__.py b/test/tests/loops/batch/__init__.py similarity index 100% rename from tests/loops/batch/__init__.py rename to test/tests/loops/batch/__init__.py diff --git a/tests/loops/batch/test_truncated_bptt.py b/test/tests/loops/batch/test_truncated_bptt.py similarity index 100% rename from tests/loops/batch/test_truncated_bptt.py rename to test/tests/loops/batch/test_truncated_bptt.py diff --git a/tests/loops/epoch/__init__.py b/test/tests/loops/epoch/__init__.py similarity index 100% rename from tests/loops/epoch/__init__.py rename to test/tests/loops/epoch/__init__.py diff --git a/tests/loops/epoch/test_training_epoch_loop.py b/test/tests/loops/epoch/test_training_epoch_loop.py similarity index 100% rename from tests/loops/epoch/test_training_epoch_loop.py rename to test/tests/loops/epoch/test_training_epoch_loop.py diff --git a/tests/loops/optimization/__init__.py b/test/tests/loops/optimization/__init__.py similarity index 100% rename from tests/loops/optimization/__init__.py rename to test/tests/loops/optimization/__init__.py diff --git a/tests/loops/optimization/test_closure.py b/test/tests/loops/optimization/test_closure.py similarity index 100% rename from tests/loops/optimization/test_closure.py rename to test/tests/loops/optimization/test_closure.py diff --git a/tests/loops/optimization/test_manual_loop.py b/test/tests/loops/optimization/test_manual_loop.py similarity index 100% rename from tests/loops/optimization/test_manual_loop.py rename to test/tests/loops/optimization/test_manual_loop.py diff --git a/tests/loops/optimization/test_optimizer_loop.py b/test/tests/loops/optimization/test_optimizer_loop.py similarity index 100% rename from tests/loops/optimization/test_optimizer_loop.py rename to test/tests/loops/optimization/test_optimizer_loop.py diff --git a/tests/loops/test_all.py b/test/tests/loops/test_all.py similarity index 100% rename from tests/loops/test_all.py rename to test/tests/loops/test_all.py diff --git a/tests/loops/test_evaluation_loop.py b/test/tests/loops/test_evaluation_loop.py similarity index 100% rename from tests/loops/test_evaluation_loop.py rename to test/tests/loops/test_evaluation_loop.py diff --git a/tests/loops/test_evaluation_loop_flow.py b/test/tests/loops/test_evaluation_loop_flow.py similarity index 100% rename from tests/loops/test_evaluation_loop_flow.py rename to test/tests/loops/test_evaluation_loop_flow.py diff --git a/tests/loops/test_flow_warnings.py b/test/tests/loops/test_flow_warnings.py similarity index 100% rename from tests/loops/test_flow_warnings.py rename to test/tests/loops/test_flow_warnings.py diff --git a/tests/loops/test_loop_state_dict.py b/test/tests/loops/test_loop_state_dict.py similarity index 100% rename from tests/loops/test_loop_state_dict.py rename to test/tests/loops/test_loop_state_dict.py diff --git a/tests/loops/test_loops.py b/test/tests/loops/test_loops.py similarity index 100% rename from tests/loops/test_loops.py rename to test/tests/loops/test_loops.py diff --git a/tests/loops/test_training_loop.py b/test/tests/loops/test_training_loop.py similarity index 100% rename from tests/loops/test_training_loop.py rename to test/tests/loops/test_training_loop.py diff --git a/tests/loops/test_training_loop_flow_dict.py b/test/tests/loops/test_training_loop_flow_dict.py similarity index 100% rename from tests/loops/test_training_loop_flow_dict.py rename to test/tests/loops/test_training_loop_flow_dict.py diff --git a/tests/loops/test_training_loop_flow_scalar.py b/test/tests/loops/test_training_loop_flow_scalar.py similarity index 100% rename from tests/loops/test_training_loop_flow_scalar.py rename to test/tests/loops/test_training_loop_flow_scalar.py diff --git a/tests/loops/test_utilities.py b/test/tests/loops/test_utilities.py similarity index 100% rename from tests/loops/test_utilities.py rename to test/tests/loops/test_utilities.py diff --git a/tests/models/__init__.py b/test/tests/models/__init__.py similarity index 100% rename from tests/models/__init__.py rename to test/tests/models/__init__.py diff --git a/tests/models/conf/config.yaml b/test/tests/models/conf/config.yaml similarity index 100% rename from tests/models/conf/config.yaml rename to test/tests/models/conf/config.yaml diff --git a/tests/models/conf/training/default.yaml b/test/tests/models/conf/training/default.yaml similarity index 100% rename from tests/models/conf/training/default.yaml rename to test/tests/models/conf/training/default.yaml diff --git a/tests/models/data/__init__.py b/test/tests/models/data/__init__.py similarity index 100% rename from tests/models/data/__init__.py rename to test/tests/models/data/__init__.py diff --git a/tests/models/data/horovod/__init__.py b/test/tests/models/data/horovod/__init__.py similarity index 100% rename from tests/models/data/horovod/__init__.py rename to test/tests/models/data/horovod/__init__.py diff --git a/tests/models/data/horovod/test_train_script.py b/test/tests/models/data/horovod/test_train_script.py similarity index 100% rename from tests/models/data/horovod/test_train_script.py rename to test/tests/models/data/horovod/test_train_script.py diff --git a/tests/models/data/horovod/train_default_model.py b/test/tests/models/data/horovod/train_default_model.py similarity index 100% rename from tests/models/data/horovod/train_default_model.py rename to test/tests/models/data/horovod/train_default_model.py diff --git a/tests/models/test_amp.py b/test/tests/models/test_amp.py similarity index 100% rename from tests/models/test_amp.py rename to test/tests/models/test_amp.py diff --git a/tests/models/test_cpu.py b/test/tests/models/test_cpu.py similarity index 100% rename from tests/models/test_cpu.py rename to test/tests/models/test_cpu.py diff --git a/tests/models/test_gpu.py b/test/tests/models/test_gpu.py similarity index 100% rename from tests/models/test_gpu.py rename to test/tests/models/test_gpu.py diff --git a/tests/models/test_grad_norm.py b/test/tests/models/test_grad_norm.py similarity index 100% rename from tests/models/test_grad_norm.py rename to test/tests/models/test_grad_norm.py diff --git a/tests/models/test_hooks.py b/test/tests/models/test_hooks.py similarity index 100% rename from tests/models/test_hooks.py rename to test/tests/models/test_hooks.py diff --git a/tests/models/test_horovod.py b/test/tests/models/test_horovod.py similarity index 100% rename from tests/models/test_horovod.py rename to test/tests/models/test_horovod.py diff --git a/tests/models/test_hparams.py b/test/tests/models/test_hparams.py similarity index 100% rename from tests/models/test_hparams.py rename to test/tests/models/test_hparams.py diff --git a/tests/models/test_onnx.py b/test/tests/models/test_onnx.py similarity index 100% rename from tests/models/test_onnx.py rename to test/tests/models/test_onnx.py diff --git a/tests/models/test_restore.py b/test/tests/models/test_restore.py similarity index 100% rename from tests/models/test_restore.py rename to test/tests/models/test_restore.py diff --git a/tests/models/test_torchscript.py b/test/tests/models/test_torchscript.py similarity index 100% rename from tests/models/test_torchscript.py rename to test/tests/models/test_torchscript.py diff --git a/tests/models/test_tpu.py b/test/tests/models/test_tpu.py similarity index 100% rename from tests/models/test_tpu.py rename to test/tests/models/test_tpu.py diff --git a/tests/overrides/__init__.py b/test/tests/overrides/__init__.py similarity index 100% rename from tests/overrides/__init__.py rename to test/tests/overrides/__init__.py diff --git a/tests/overrides/test_base.py b/test/tests/overrides/test_base.py similarity index 100% rename from tests/overrides/test_base.py rename to test/tests/overrides/test_base.py diff --git a/tests/overrides/test_data_parallel.py b/test/tests/overrides/test_data_parallel.py similarity index 100% rename from tests/overrides/test_data_parallel.py rename to test/tests/overrides/test_data_parallel.py diff --git a/tests/overrides/test_distributed.py b/test/tests/overrides/test_distributed.py similarity index 100% rename from tests/overrides/test_distributed.py rename to test/tests/overrides/test_distributed.py diff --git a/tests/plugins/__init__.py b/test/tests/plugins/__init__.py similarity index 100% rename from tests/plugins/__init__.py rename to test/tests/plugins/__init__.py diff --git a/tests/plugins/environments/__init__.py b/test/tests/plugins/environments/__init__.py similarity index 100% rename from tests/plugins/environments/__init__.py rename to test/tests/plugins/environments/__init__.py diff --git a/tests/plugins/environments/test_kubeflow_environment.py b/test/tests/plugins/environments/test_kubeflow_environment.py similarity index 100% rename from tests/plugins/environments/test_kubeflow_environment.py rename to test/tests/plugins/environments/test_kubeflow_environment.py diff --git a/tests/plugins/environments/test_lightning_environment.py b/test/tests/plugins/environments/test_lightning_environment.py similarity index 100% rename from tests/plugins/environments/test_lightning_environment.py rename to test/tests/plugins/environments/test_lightning_environment.py diff --git a/tests/plugins/environments/test_lsf_environment.py b/test/tests/plugins/environments/test_lsf_environment.py similarity index 100% rename from tests/plugins/environments/test_lsf_environment.py rename to test/tests/plugins/environments/test_lsf_environment.py diff --git a/tests/plugins/environments/test_slurm_environment.py b/test/tests/plugins/environments/test_slurm_environment.py similarity index 100% rename from tests/plugins/environments/test_slurm_environment.py rename to test/tests/plugins/environments/test_slurm_environment.py diff --git a/tests/plugins/environments/test_torchelastic_environment.py b/test/tests/plugins/environments/test_torchelastic_environment.py similarity index 100% rename from tests/plugins/environments/test_torchelastic_environment.py rename to test/tests/plugins/environments/test_torchelastic_environment.py diff --git a/tests/plugins/environments/torch_elastic_deadlock.py b/test/tests/plugins/environments/torch_elastic_deadlock.py similarity index 100% rename from tests/plugins/environments/torch_elastic_deadlock.py rename to test/tests/plugins/environments/torch_elastic_deadlock.py diff --git a/tests/plugins/precision/__init__.py b/test/tests/plugins/precision/__init__.py similarity index 100% rename from tests/plugins/precision/__init__.py rename to test/tests/plugins/precision/__init__.py diff --git a/tests/plugins/precision/hpu/ops_bf16.txt b/test/tests/plugins/precision/hpu/ops_bf16.txt similarity index 100% rename from tests/plugins/precision/hpu/ops_bf16.txt rename to test/tests/plugins/precision/hpu/ops_bf16.txt diff --git a/tests/plugins/precision/hpu/ops_fp32.txt b/test/tests/plugins/precision/hpu/ops_fp32.txt similarity index 100% rename from tests/plugins/precision/hpu/ops_fp32.txt rename to test/tests/plugins/precision/hpu/ops_fp32.txt diff --git a/tests/plugins/precision/hpu/test_hpu.py b/test/tests/plugins/precision/hpu/test_hpu.py similarity index 100% rename from tests/plugins/precision/hpu/test_hpu.py rename to test/tests/plugins/precision/hpu/test_hpu.py diff --git a/tests/plugins/precision/test_deepspeed_precision.py b/test/tests/plugins/precision/test_deepspeed_precision.py similarity index 100% rename from tests/plugins/precision/test_deepspeed_precision.py rename to test/tests/plugins/precision/test_deepspeed_precision.py diff --git a/tests/plugins/precision/test_sharded_precision.py b/test/tests/plugins/precision/test_sharded_precision.py similarity index 100% rename from tests/plugins/precision/test_sharded_precision.py rename to test/tests/plugins/precision/test_sharded_precision.py diff --git a/tests/plugins/precision/test_tpu_bf16_plugin.py b/test/tests/plugins/precision/test_tpu_bf16_plugin.py similarity index 100% rename from tests/plugins/precision/test_tpu_bf16_plugin.py rename to test/tests/plugins/precision/test_tpu_bf16_plugin.py diff --git a/tests/plugins/test_amp_plugins.py b/test/tests/plugins/test_amp_plugins.py similarity index 100% rename from tests/plugins/test_amp_plugins.py rename to test/tests/plugins/test_amp_plugins.py diff --git a/tests/plugins/test_checkpoint_io_plugin.py b/test/tests/plugins/test_checkpoint_io_plugin.py similarity index 100% rename from tests/plugins/test_checkpoint_io_plugin.py rename to test/tests/plugins/test_checkpoint_io_plugin.py diff --git a/tests/plugins/test_cluster_integration.py b/test/tests/plugins/test_cluster_integration.py similarity index 100% rename from tests/plugins/test_cluster_integration.py rename to test/tests/plugins/test_cluster_integration.py diff --git a/tests/plugins/test_double_plugin.py b/test/tests/plugins/test_double_plugin.py similarity index 100% rename from tests/plugins/test_double_plugin.py rename to test/tests/plugins/test_double_plugin.py diff --git a/tests/profiler/__init__.py b/test/tests/profiler/__init__.py similarity index 100% rename from tests/profiler/__init__.py rename to test/tests/profiler/__init__.py diff --git a/tests/profiler/test_profiler.py b/test/tests/profiler/test_profiler.py similarity index 100% rename from tests/profiler/test_profiler.py rename to test/tests/profiler/test_profiler.py diff --git a/tests/profiler/test_xla_profiler.py b/test/tests/profiler/test_xla_profiler.py similarity index 100% rename from tests/profiler/test_xla_profiler.py rename to test/tests/profiler/test_xla_profiler.py diff --git a/tests/strategies/__init__.py b/test/tests/strategies/__init__.py similarity index 100% rename from tests/strategies/__init__.py rename to test/tests/strategies/__init__.py diff --git a/tests/strategies/ddp_model.py b/test/tests/strategies/ddp_model.py similarity index 100% rename from tests/strategies/ddp_model.py rename to test/tests/strategies/ddp_model.py diff --git a/tests/strategies/test_bagua_strategy.py b/test/tests/strategies/test_bagua_strategy.py similarity index 100% rename from tests/strategies/test_bagua_strategy.py rename to test/tests/strategies/test_bagua_strategy.py diff --git a/tests/strategies/test_collaborative.py b/test/tests/strategies/test_collaborative.py similarity index 100% rename from tests/strategies/test_collaborative.py rename to test/tests/strategies/test_collaborative.py diff --git a/tests/strategies/test_common.py b/test/tests/strategies/test_common.py similarity index 100% rename from tests/strategies/test_common.py rename to test/tests/strategies/test_common.py diff --git a/tests/strategies/test_custom_plugin.py b/test/tests/strategies/test_custom_plugin.py similarity index 100% rename from tests/strategies/test_custom_plugin.py rename to test/tests/strategies/test_custom_plugin.py diff --git a/tests/strategies/test_ddp.py b/test/tests/strategies/test_ddp.py similarity index 100% rename from tests/strategies/test_ddp.py rename to test/tests/strategies/test_ddp.py diff --git a/tests/strategies/test_ddp_fully_sharded_native.py b/test/tests/strategies/test_ddp_fully_sharded_native.py similarity index 100% rename from tests/strategies/test_ddp_fully_sharded_native.py rename to test/tests/strategies/test_ddp_fully_sharded_native.py diff --git a/tests/strategies/test_ddp_fully_sharded_with_full_state_dict.py b/test/tests/strategies/test_ddp_fully_sharded_with_full_state_dict.py similarity index 100% rename from tests/strategies/test_ddp_fully_sharded_with_full_state_dict.py rename to test/tests/strategies/test_ddp_fully_sharded_with_full_state_dict.py diff --git a/tests/strategies/test_ddp_spawn.py b/test/tests/strategies/test_ddp_spawn.py similarity index 100% rename from tests/strategies/test_ddp_spawn.py rename to test/tests/strategies/test_ddp_spawn.py diff --git a/tests/strategies/test_ddp_spawn_strategy.py b/test/tests/strategies/test_ddp_spawn_strategy.py similarity index 100% rename from tests/strategies/test_ddp_spawn_strategy.py rename to test/tests/strategies/test_ddp_spawn_strategy.py diff --git a/tests/strategies/test_ddp_strategy.py b/test/tests/strategies/test_ddp_strategy.py similarity index 100% rename from tests/strategies/test_ddp_strategy.py rename to test/tests/strategies/test_ddp_strategy.py diff --git a/tests/strategies/test_ddp_strategy_with_comm_hook.py b/test/tests/strategies/test_ddp_strategy_with_comm_hook.py similarity index 100% rename from tests/strategies/test_ddp_strategy_with_comm_hook.py rename to test/tests/strategies/test_ddp_strategy_with_comm_hook.py diff --git a/tests/strategies/test_deepspeed_strategy.py b/test/tests/strategies/test_deepspeed_strategy.py similarity index 100% rename from tests/strategies/test_deepspeed_strategy.py rename to test/tests/strategies/test_deepspeed_strategy.py diff --git a/tests/strategies/test_dp.py b/test/tests/strategies/test_dp.py similarity index 100% rename from tests/strategies/test_dp.py rename to test/tests/strategies/test_dp.py diff --git a/tests/strategies/test_sharded_strategy.py b/test/tests/strategies/test_sharded_strategy.py similarity index 100% rename from tests/strategies/test_sharded_strategy.py rename to test/tests/strategies/test_sharded_strategy.py diff --git a/tests/strategies/test_single_device_strategy.py b/test/tests/strategies/test_single_device_strategy.py similarity index 100% rename from tests/strategies/test_single_device_strategy.py rename to test/tests/strategies/test_single_device_strategy.py diff --git a/tests/strategies/test_strategy_registry.py b/test/tests/strategies/test_strategy_registry.py similarity index 100% rename from tests/strategies/test_strategy_registry.py rename to test/tests/strategies/test_strategy_registry.py diff --git a/tests/strategies/test_tpu_spawn.py b/test/tests/strategies/test_tpu_spawn.py similarity index 100% rename from tests/strategies/test_tpu_spawn.py rename to test/tests/strategies/test_tpu_spawn.py diff --git a/tests/trainer/__init__.py b/test/tests/trainer/__init__.py similarity index 100% rename from tests/trainer/__init__.py rename to test/tests/trainer/__init__.py diff --git a/tests/trainer/connectors/__init__.py b/test/tests/trainer/connectors/__init__.py similarity index 100% rename from tests/trainer/connectors/__init__.py rename to test/tests/trainer/connectors/__init__.py diff --git a/tests/trainer/connectors/test_callback_connector.py b/test/tests/trainer/connectors/test_callback_connector.py similarity index 100% rename from tests/trainer/connectors/test_callback_connector.py rename to test/tests/trainer/connectors/test_callback_connector.py diff --git a/tests/trainer/connectors/test_checkpoint_connector.py b/test/tests/trainer/connectors/test_checkpoint_connector.py similarity index 100% rename from tests/trainer/connectors/test_checkpoint_connector.py rename to test/tests/trainer/connectors/test_checkpoint_connector.py diff --git a/tests/trainer/connectors/test_data_connector.py b/test/tests/trainer/connectors/test_data_connector.py similarity index 100% rename from tests/trainer/connectors/test_data_connector.py rename to test/tests/trainer/connectors/test_data_connector.py diff --git a/tests/trainer/connectors/test_signal_connector.py b/test/tests/trainer/connectors/test_signal_connector.py similarity index 100% rename from tests/trainer/connectors/test_signal_connector.py rename to test/tests/trainer/connectors/test_signal_connector.py diff --git a/tests/trainer/dynamic_args/__init__.py b/test/tests/trainer/dynamic_args/__init__.py similarity index 100% rename from tests/trainer/dynamic_args/__init__.py rename to test/tests/trainer/dynamic_args/__init__.py diff --git a/tests/trainer/dynamic_args/test_multiple_eval_dataloaders.py b/test/tests/trainer/dynamic_args/test_multiple_eval_dataloaders.py similarity index 100% rename from tests/trainer/dynamic_args/test_multiple_eval_dataloaders.py rename to test/tests/trainer/dynamic_args/test_multiple_eval_dataloaders.py diff --git a/tests/trainer/flags/__init__.py b/test/tests/trainer/flags/__init__.py similarity index 100% rename from tests/trainer/flags/__init__.py rename to test/tests/trainer/flags/__init__.py diff --git a/tests/trainer/flags/test_check_val_every_n_epoch.py b/test/tests/trainer/flags/test_check_val_every_n_epoch.py similarity index 100% rename from tests/trainer/flags/test_check_val_every_n_epoch.py rename to test/tests/trainer/flags/test_check_val_every_n_epoch.py diff --git a/tests/trainer/flags/test_env_vars.py b/test/tests/trainer/flags/test_env_vars.py similarity index 100% rename from tests/trainer/flags/test_env_vars.py rename to test/tests/trainer/flags/test_env_vars.py diff --git a/tests/trainer/flags/test_fast_dev_run.py b/test/tests/trainer/flags/test_fast_dev_run.py similarity index 100% rename from tests/trainer/flags/test_fast_dev_run.py rename to test/tests/trainer/flags/test_fast_dev_run.py diff --git a/tests/trainer/flags/test_limit_batches.py b/test/tests/trainer/flags/test_limit_batches.py similarity index 100% rename from tests/trainer/flags/test_limit_batches.py rename to test/tests/trainer/flags/test_limit_batches.py diff --git a/tests/trainer/flags/test_min_max_epochs.py b/test/tests/trainer/flags/test_min_max_epochs.py similarity index 100% rename from tests/trainer/flags/test_min_max_epochs.py rename to test/tests/trainer/flags/test_min_max_epochs.py diff --git a/tests/trainer/flags/test_overfit_batches.py b/test/tests/trainer/flags/test_overfit_batches.py similarity index 100% rename from tests/trainer/flags/test_overfit_batches.py rename to test/tests/trainer/flags/test_overfit_batches.py diff --git a/tests/trainer/flags/test_val_check_interval.py b/test/tests/trainer/flags/test_val_check_interval.py similarity index 100% rename from tests/trainer/flags/test_val_check_interval.py rename to test/tests/trainer/flags/test_val_check_interval.py diff --git a/tests/trainer/logging_/__init__.py b/test/tests/trainer/logging_/__init__.py similarity index 100% rename from tests/trainer/logging_/__init__.py rename to test/tests/trainer/logging_/__init__.py diff --git a/tests/trainer/logging_/test_distributed_logging.py b/test/tests/trainer/logging_/test_distributed_logging.py similarity index 100% rename from tests/trainer/logging_/test_distributed_logging.py rename to test/tests/trainer/logging_/test_distributed_logging.py diff --git a/tests/trainer/logging_/test_eval_loop_logging.py b/test/tests/trainer/logging_/test_eval_loop_logging.py similarity index 100% rename from tests/trainer/logging_/test_eval_loop_logging.py rename to test/tests/trainer/logging_/test_eval_loop_logging.py diff --git a/tests/trainer/logging_/test_logger_connector.py b/test/tests/trainer/logging_/test_logger_connector.py similarity index 100% rename from tests/trainer/logging_/test_logger_connector.py rename to test/tests/trainer/logging_/test_logger_connector.py diff --git a/tests/trainer/logging_/test_loop_logging.py b/test/tests/trainer/logging_/test_loop_logging.py similarity index 100% rename from tests/trainer/logging_/test_loop_logging.py rename to test/tests/trainer/logging_/test_loop_logging.py diff --git a/tests/trainer/logging_/test_progress_bar_logging.py b/test/tests/trainer/logging_/test_progress_bar_logging.py similarity index 100% rename from tests/trainer/logging_/test_progress_bar_logging.py rename to test/tests/trainer/logging_/test_progress_bar_logging.py diff --git a/tests/trainer/logging_/test_train_loop_logging.py b/test/tests/trainer/logging_/test_train_loop_logging.py similarity index 100% rename from tests/trainer/logging_/test_train_loop_logging.py rename to test/tests/trainer/logging_/test_train_loop_logging.py diff --git a/tests/trainer/optimization/__init__.py b/test/tests/trainer/optimization/__init__.py similarity index 100% rename from tests/trainer/optimization/__init__.py rename to test/tests/trainer/optimization/__init__.py diff --git a/tests/trainer/optimization/test_backward_calls.py b/test/tests/trainer/optimization/test_backward_calls.py similarity index 100% rename from tests/trainer/optimization/test_backward_calls.py rename to test/tests/trainer/optimization/test_backward_calls.py diff --git a/tests/trainer/optimization/test_manual_optimization.py b/test/tests/trainer/optimization/test_manual_optimization.py similarity index 100% rename from tests/trainer/optimization/test_manual_optimization.py rename to test/tests/trainer/optimization/test_manual_optimization.py diff --git a/tests/trainer/optimization/test_multiple_optimizers.py b/test/tests/trainer/optimization/test_multiple_optimizers.py similarity index 100% rename from tests/trainer/optimization/test_multiple_optimizers.py rename to test/tests/trainer/optimization/test_multiple_optimizers.py diff --git a/tests/trainer/optimization/test_optimizers.py b/test/tests/trainer/optimization/test_optimizers.py similarity index 100% rename from tests/trainer/optimization/test_optimizers.py rename to test/tests/trainer/optimization/test_optimizers.py diff --git a/tests/trainer/properties/__init__.py b/test/tests/trainer/properties/__init__.py similarity index 100% rename from tests/trainer/properties/__init__.py rename to test/tests/trainer/properties/__init__.py diff --git a/tests/trainer/properties/test_auto_gpu_select.py b/test/tests/trainer/properties/test_auto_gpu_select.py similarity index 100% rename from tests/trainer/properties/test_auto_gpu_select.py rename to test/tests/trainer/properties/test_auto_gpu_select.py diff --git a/tests/trainer/properties/test_estimated_stepping_batches.py b/test/tests/trainer/properties/test_estimated_stepping_batches.py similarity index 100% rename from tests/trainer/properties/test_estimated_stepping_batches.py rename to test/tests/trainer/properties/test_estimated_stepping_batches.py diff --git a/tests/trainer/properties/test_get_model.py b/test/tests/trainer/properties/test_get_model.py similarity index 100% rename from tests/trainer/properties/test_get_model.py rename to test/tests/trainer/properties/test_get_model.py diff --git a/tests/trainer/properties/test_log_dir.py b/test/tests/trainer/properties/test_log_dir.py similarity index 100% rename from tests/trainer/properties/test_log_dir.py rename to test/tests/trainer/properties/test_log_dir.py diff --git a/tests/trainer/properties/test_loggers.py b/test/tests/trainer/properties/test_loggers.py similarity index 100% rename from tests/trainer/properties/test_loggers.py rename to test/tests/trainer/properties/test_loggers.py diff --git a/tests/trainer/test_config_validator.py b/test/tests/trainer/test_config_validator.py similarity index 100% rename from tests/trainer/test_config_validator.py rename to test/tests/trainer/test_config_validator.py diff --git a/tests/trainer/test_dataloaders.py b/test/tests/trainer/test_dataloaders.py similarity index 100% rename from tests/trainer/test_dataloaders.py rename to test/tests/trainer/test_dataloaders.py diff --git a/tests/trainer/test_progress.py b/test/tests/trainer/test_progress.py similarity index 100% rename from tests/trainer/test_progress.py rename to test/tests/trainer/test_progress.py diff --git a/tests/trainer/test_states.py b/test/tests/trainer/test_states.py similarity index 100% rename from tests/trainer/test_states.py rename to test/tests/trainer/test_states.py diff --git a/tests/trainer/test_supporters.py b/test/tests/trainer/test_supporters.py similarity index 100% rename from tests/trainer/test_supporters.py rename to test/tests/trainer/test_supporters.py diff --git a/tests/trainer/test_trainer.py b/test/tests/trainer/test_trainer.py similarity index 100% rename from tests/trainer/test_trainer.py rename to test/tests/trainer/test_trainer.py diff --git a/tests/trainer/test_trainer_cli.py b/test/tests/trainer/test_trainer_cli.py similarity index 100% rename from tests/trainer/test_trainer_cli.py rename to test/tests/trainer/test_trainer_cli.py diff --git a/tests/tuner/__init__.py b/test/tests/tuner/__init__.py similarity index 100% rename from tests/tuner/__init__.py rename to test/tests/tuner/__init__.py diff --git a/tests/tuner/test_lr_finder.py b/test/tests/tuner/test_lr_finder.py similarity index 100% rename from tests/tuner/test_lr_finder.py rename to test/tests/tuner/test_lr_finder.py diff --git a/tests/tuner/test_scale_batch_size.py b/test/tests/tuner/test_scale_batch_size.py similarity index 100% rename from tests/tuner/test_scale_batch_size.py rename to test/tests/tuner/test_scale_batch_size.py diff --git a/tests/tuner/test_tuning.py b/test/tests/tuner/test_tuning.py similarity index 100% rename from tests/tuner/test_tuning.py rename to test/tests/tuner/test_tuning.py diff --git a/tests/utilities/__init__.py b/test/tests/utilities/__init__.py similarity index 100% rename from tests/utilities/__init__.py rename to test/tests/utilities/__init__.py diff --git a/tests/utilities/distributed.py b/test/tests/utilities/distributed.py similarity index 100% rename from tests/utilities/distributed.py rename to test/tests/utilities/distributed.py diff --git a/tests/utilities/test_all_gather_grad.py b/test/tests/utilities/test_all_gather_grad.py similarity index 100% rename from tests/utilities/test_all_gather_grad.py rename to test/tests/utilities/test_all_gather_grad.py diff --git a/tests/utilities/test_apply_func.py b/test/tests/utilities/test_apply_func.py similarity index 100% rename from tests/utilities/test_apply_func.py rename to test/tests/utilities/test_apply_func.py diff --git a/tests/utilities/test_apply_func_torchtext.py b/test/tests/utilities/test_apply_func_torchtext.py similarity index 100% rename from tests/utilities/test_apply_func_torchtext.py rename to test/tests/utilities/test_apply_func_torchtext.py diff --git a/tests/utilities/test_argparse.py b/test/tests/utilities/test_argparse.py similarity index 100% rename from tests/utilities/test_argparse.py rename to test/tests/utilities/test_argparse.py diff --git a/tests/utilities/test_auto_restart.py b/test/tests/utilities/test_auto_restart.py similarity index 100% rename from tests/utilities/test_auto_restart.py rename to test/tests/utilities/test_auto_restart.py diff --git a/tests/utilities/test_cli.py b/test/tests/utilities/test_cli.py similarity index 100% rename from tests/utilities/test_cli.py rename to test/tests/utilities/test_cli.py diff --git a/tests/utilities/test_cloud_io.py b/test/tests/utilities/test_cloud_io.py similarity index 100% rename from tests/utilities/test_cloud_io.py rename to test/tests/utilities/test_cloud_io.py diff --git a/tests/utilities/test_data.py b/test/tests/utilities/test_data.py similarity index 100% rename from tests/utilities/test_data.py rename to test/tests/utilities/test_data.py diff --git a/tests/utilities/test_deepspeed_collate_checkpoint.py b/test/tests/utilities/test_deepspeed_collate_checkpoint.py similarity index 100% rename from tests/utilities/test_deepspeed_collate_checkpoint.py rename to test/tests/utilities/test_deepspeed_collate_checkpoint.py diff --git a/tests/utilities/test_distributed.py b/test/tests/utilities/test_distributed.py similarity index 100% rename from tests/utilities/test_distributed.py rename to test/tests/utilities/test_distributed.py diff --git a/tests/utilities/test_dtype_device_mixin.py b/test/tests/utilities/test_dtype_device_mixin.py similarity index 100% rename from tests/utilities/test_dtype_device_mixin.py rename to test/tests/utilities/test_dtype_device_mixin.py diff --git a/tests/utilities/test_enums.py b/test/tests/utilities/test_enums.py similarity index 100% rename from tests/utilities/test_enums.py rename to test/tests/utilities/test_enums.py diff --git a/tests/utilities/test_fetching.py b/test/tests/utilities/test_fetching.py similarity index 100% rename from tests/utilities/test_fetching.py rename to test/tests/utilities/test_fetching.py diff --git a/tests/utilities/test_finite_checks.py b/test/tests/utilities/test_finite_checks.py similarity index 100% rename from tests/utilities/test_finite_checks.py rename to test/tests/utilities/test_finite_checks.py diff --git a/tests/utilities/test_grads.py b/test/tests/utilities/test_grads.py similarity index 100% rename from tests/utilities/test_grads.py rename to test/tests/utilities/test_grads.py diff --git a/tests/utilities/test_imports.py b/test/tests/utilities/test_imports.py similarity index 100% rename from tests/utilities/test_imports.py rename to test/tests/utilities/test_imports.py diff --git a/tests/utilities/test_logger.py b/test/tests/utilities/test_logger.py similarity index 100% rename from tests/utilities/test_logger.py rename to test/tests/utilities/test_logger.py diff --git a/tests/utilities/test_memory.py b/test/tests/utilities/test_memory.py similarity index 100% rename from tests/utilities/test_memory.py rename to test/tests/utilities/test_memory.py diff --git a/tests/utilities/test_meta.py b/test/tests/utilities/test_meta.py similarity index 100% rename from tests/utilities/test_meta.py rename to test/tests/utilities/test_meta.py diff --git a/tests/utilities/test_migration.py b/test/tests/utilities/test_migration.py similarity index 100% rename from tests/utilities/test_migration.py rename to test/tests/utilities/test_migration.py diff --git a/tests/utilities/test_model_helpers.py b/test/tests/utilities/test_model_helpers.py similarity index 100% rename from tests/utilities/test_model_helpers.py rename to test/tests/utilities/test_model_helpers.py diff --git a/tests/utilities/test_model_summary.py b/test/tests/utilities/test_model_summary.py similarity index 100% rename from tests/utilities/test_model_summary.py rename to test/tests/utilities/test_model_summary.py diff --git a/tests/utilities/test_optimizer.py b/test/tests/utilities/test_optimizer.py similarity index 100% rename from tests/utilities/test_optimizer.py rename to test/tests/utilities/test_optimizer.py diff --git a/tests/utilities/test_parameter_tying.py b/test/tests/utilities/test_parameter_tying.py similarity index 100% rename from tests/utilities/test_parameter_tying.py rename to test/tests/utilities/test_parameter_tying.py diff --git a/tests/utilities/test_parsing.py b/test/tests/utilities/test_parsing.py similarity index 100% rename from tests/utilities/test_parsing.py rename to test/tests/utilities/test_parsing.py diff --git a/tests/utilities/test_rank_zero.py b/test/tests/utilities/test_rank_zero.py similarity index 100% rename from tests/utilities/test_rank_zero.py rename to test/tests/utilities/test_rank_zero.py diff --git a/tests/utilities/test_remote_filesystem.py b/test/tests/utilities/test_remote_filesystem.py similarity index 100% rename from tests/utilities/test_remote_filesystem.py rename to test/tests/utilities/test_remote_filesystem.py diff --git a/tests/utilities/test_seed.py b/test/tests/utilities/test_seed.py similarity index 100% rename from tests/utilities/test_seed.py rename to test/tests/utilities/test_seed.py diff --git a/tests/utilities/test_types.py b/test/tests/utilities/test_types.py similarity index 100% rename from tests/utilities/test_types.py rename to test/tests/utilities/test_types.py diff --git a/tests/utilities/test_upgrade_checkpoint.py b/test/tests/utilities/test_upgrade_checkpoint.py similarity index 100% rename from tests/utilities/test_upgrade_checkpoint.py rename to test/tests/utilities/test_upgrade_checkpoint.py diff --git a/tests/utilities/test_warnings.py b/test/tests/utilities/test_warnings.py similarity index 100% rename from tests/utilities/test_warnings.py rename to test/tests/utilities/test_warnings.py diff --git a/tests/utilities/test_xla_device_utils.py b/test/tests/utilities/test_xla_device_utils.py similarity index 100% rename from tests/utilities/test_xla_device_utils.py rename to test/tests/utilities/test_xla_device_utils.py From bf07902ce251207b75d63450422deee946573e8a Mon Sep 17 00:00:00 2001 From: Jirka Date: Wed, 1 Jun 2022 15:05:16 +0200 Subject: [PATCH 05/20] rename unittests --- pyproject.toml | 4 ++-- test/tests/helpers/__init__.py | 7 ------- test/{tests => unittests}/__init__.py | 0 test/{tests => unittests}/accelerators/__init__.py | 0 .../accelerators/test_accelerator_connector.py | 2 +- .../accelerators/test_accelerator_registry.py | 0 .../accelerators/test_common.py | 0 test/{tests => unittests}/accelerators/test_cpu.py | 2 +- test/{tests => unittests}/accelerators/test_gpu.py | 4 ++-- test/{tests => unittests}/accelerators/test_hpu.py | 8 ++++---- test/{tests => unittests}/accelerators/test_ipu.py | 8 ++++---- test/{tests => unittests}/accelerators/test_tpu.py | 6 +++--- test/{tests => unittests}/benchmarks/__init__.py | 0 .../benchmarks/generate_comparison.py | 4 ++-- .../benchmarks/test_basic_parity.py | 2 +- .../benchmarks/test_sharded_parity.py | 4 ++-- .../benchmarks/test_sync_batchnorm_parity.py | 2 +- test/{tests => unittests}/callbacks/__init__.py | 0 .../callbacks/test_callback_hook_outputs.py | 2 +- .../callbacks/test_callbacks.py | 4 ++-- .../callbacks/test_device_stats_monitor.py | 4 ++-- .../callbacks/test_early_stopping.py | 8 ++++---- .../callbacks/test_finetuning_callback.py | 2 +- .../test_gradient_accumulation_scheduler.py | 2 +- .../callbacks/test_lambda_function.py | 4 ++-- .../callbacks/test_lr_monitor.py | 8 ++++---- .../callbacks/test_model_summary.py | 2 +- .../callbacks/test_prediction_writer.py | 4 ++-- .../{tests => unittests}/callbacks/test_pruning.py | 4 ++-- .../callbacks/test_quantization.py | 8 ++++---- .../callbacks/test_rich_model_summary.py | 4 ++-- .../callbacks/test_rich_progress_bar.py | 4 ++-- .../callbacks/test_stochastic_weight_avg.py | 4 ++-- test/{tests => unittests}/callbacks/test_timer.py | 4 ++-- .../callbacks/test_tqdm_progress_bar.py | 4 ++-- .../{tests => unittests}/checkpointing/__init__.py | 0 .../test_checkpoint_callback_frequency.py | 4 ++-- .../checkpointing/test_legacy_checkpoints.py | 2 +- .../checkpointing/test_model_checkpoint.py | 6 +++--- .../checkpointing/test_torch_saving.py | 4 ++-- .../checkpointing/test_trainer_checkpoint.py | 2 +- test/{tests => unittests}/conftest.py | 2 +- test/{tests => unittests}/core/__init__.py | 0 test/{tests => unittests}/core/test_datamodules.py | 10 +++++----- .../core/test_lightning_module.py | 4 ++-- .../core/test_lightning_optimizer.py | 2 +- .../core/test_metric_result_integration.py | 6 +++--- test/{tests => unittests}/core/test_results.py | 4 ++-- .../deprecated_api/__init__.py | 2 +- .../deprecated_api/test_remove_1-7.py | 6 +++--- .../deprecated_api/test_remove_1-8.py | 8 ++++---- .../deprecated_api/test_remove_1-9.py | 0 .../deprecated_api/test_remove_2-0.py | 4 ++-- test/unittests/helpers/__init__.py | 7 +++++++ .../helpers/advanced_models.py | 4 ++-- test/{tests => unittests}/helpers/boring_model.py | 0 test/{tests => unittests}/helpers/dataloaders.py | 0 test/{tests => unittests}/helpers/datamodules.py | 2 +- test/{tests => unittests}/helpers/datasets.py | 0 .../helpers/deterministic_model.py | 0 test/{tests => unittests}/helpers/imports.py | 0 test/{tests => unittests}/helpers/pipelines.py | 4 ++-- test/{tests => unittests}/helpers/runif.py | 0 test/{tests => unittests}/helpers/simple_models.py | 0 test/{tests => unittests}/helpers/test_datasets.py | 4 ++-- test/{tests => unittests}/helpers/test_models.py | 8 ++++---- .../helpers/torchtext_utils.py | 2 +- test/{tests => unittests}/helpers/utils.py | 4 ++-- test/{tests => unittests}/lite/__init__.py | 0 test/{tests => unittests}/lite/test_lite.py | 2 +- test/{tests => unittests}/lite/test_parity.py | 4 ++-- test/{tests => unittests}/lite/test_wrappers.py | 2 +- test/{tests => unittests}/loggers/__init__.py | 0 test/{tests => unittests}/loggers/test_all.py | 12 ++++++------ test/{tests => unittests}/loggers/test_comet.py | 2 +- test/{tests => unittests}/loggers/test_csv.py | 4 ++-- test/{tests => unittests}/loggers/test_logger.py | 2 +- test/{tests => unittests}/loggers/test_mlflow.py | 2 +- test/{tests => unittests}/loggers/test_neptune.py | 2 +- .../loggers/test_tensorboard.py | 4 ++-- test/{tests => unittests}/loggers/test_wandb.py | 4 ++-- test/{tests => unittests}/loops/__init__.py | 0 test/{tests => unittests}/loops/batch/__init__.py | 0 .../loops/batch/test_truncated_bptt.py | 0 test/{tests => unittests}/loops/epoch/__init__.py | 0 .../loops/epoch/test_training_epoch_loop.py | 4 ++-- .../loops/optimization/__init__.py | 0 .../loops/optimization/test_closure.py | 2 +- .../loops/optimization/test_manual_loop.py | 2 +- .../loops/optimization/test_optimizer_loop.py | 2 +- test/{tests => unittests}/loops/test_all.py | 4 ++-- .../loops/test_evaluation_loop.py | 4 ++-- .../loops/test_evaluation_loop_flow.py | 2 +- .../loops/test_flow_warnings.py | 2 +- .../loops/test_loop_state_dict.py | 0 test/{tests => unittests}/loops/test_loops.py | 4 ++-- .../loops/test_training_loop.py | 2 +- .../loops/test_training_loop_flow_dict.py | 2 +- .../loops/test_training_loop_flow_scalar.py | 6 +++--- test/{tests => unittests}/loops/test_utilities.py | 0 test/{tests => unittests}/models/__init__.py | 0 test/{tests => unittests}/models/conf/config.yaml | 0 .../models/conf/training/default.yaml | 0 test/{tests => unittests}/models/data/__init__.py | 0 .../models/data/horovod/__init__.py | 0 .../models/data/horovod/test_train_script.py | 2 +- .../models/data/horovod/train_default_model.py | 4 ++-- test/{tests => unittests}/models/test_amp.py | 6 +++--- test/{tests => unittests}/models/test_cpu.py | 12 ++++++------ test/{tests => unittests}/models/test_gpu.py | 14 +++++++------- test/{tests => unittests}/models/test_grad_norm.py | 4 ++-- test/{tests => unittests}/models/test_hooks.py | 4 ++-- test/{tests => unittests}/models/test_horovod.py | 12 ++++++------ test/{tests => unittests}/models/test_hparams.py | 8 ++++---- test/{tests => unittests}/models/test_onnx.py | 10 +++++----- test/{tests => unittests}/models/test_restore.py | 14 +++++++------- .../models/test_torchscript.py | 6 +++--- test/{tests => unittests}/models/test_tpu.py | 10 +++++----- test/{tests => unittests}/overrides/__init__.py | 0 test/{tests => unittests}/overrides/test_base.py | 2 +- .../overrides/test_data_parallel.py | 4 ++-- .../overrides/test_distributed.py | 0 test/{tests => unittests}/plugins/__init__.py | 0 .../plugins/environments/__init__.py | 0 .../environments/test_kubeflow_environment.py | 0 .../environments/test_lightning_environment.py | 0 .../plugins/environments/test_lsf_environment.py | 0 .../plugins/environments/test_slurm_environment.py | 0 .../environments/test_torchelastic_environment.py | 2 +- .../plugins/environments/torch_elastic_deadlock.py | 2 +- .../plugins/precision/__init__.py | 0 .../plugins/precision/hpu/ops_bf16.txt | 0 .../plugins/precision/hpu/ops_fp32.txt | 0 .../plugins/precision/hpu/test_hpu.py | 4 ++-- .../plugins/precision/test_deepspeed_precision.py | 0 .../plugins/precision/test_sharded_precision.py | 2 +- .../plugins/precision/test_tpu_bf16_plugin.py | 0 .../plugins/test_amp_plugins.py | 4 ++-- .../plugins/test_checkpoint_io_plugin.py | 2 +- .../plugins/test_cluster_integration.py | 2 +- .../plugins/test_double_plugin.py | 4 ++-- test/{tests => unittests}/profiler/__init__.py | 0 .../{tests => unittests}/profiler/test_profiler.py | 4 ++-- .../profiler/test_xla_profiler.py | 4 ++-- test/{tests => unittests}/strategies/__init__.py | 0 test/{tests => unittests}/strategies/ddp_model.py | 4 ++-- .../strategies/test_bagua_strategy.py | 4 ++-- .../strategies/test_collaborative.py | 4 ++-- .../{tests => unittests}/strategies/test_common.py | 10 +++++----- .../strategies/test_custom_plugin.py | 2 +- test/{tests => unittests}/strategies/test_ddp.py | 8 ++++---- .../strategies/test_ddp_fully_sharded_native.py | 4 ++-- .../test_ddp_fully_sharded_with_full_state_dict.py | 4 ++-- .../strategies/test_ddp_spawn.py | 12 ++++++------ .../strategies/test_ddp_spawn_strategy.py | 4 ++-- .../strategies/test_ddp_strategy.py | 4 ++-- .../strategies/test_ddp_strategy_with_comm_hook.py | 4 ++-- .../strategies/test_deepspeed_strategy.py | 6 +++--- test/{tests => unittests}/strategies/test_dp.py | 12 ++++++------ .../strategies/test_sharded_strategy.py | 4 ++-- .../strategies/test_single_device_strategy.py | 4 ++-- .../strategies/test_strategy_registry.py | 2 +- .../strategies/test_tpu_spawn.py | 8 ++++---- test/{tests => unittests}/trainer/__init__.py | 0 .../trainer/connectors/__init__.py | 0 .../trainer/connectors/test_callback_connector.py | 2 +- .../connectors/test_checkpoint_connector.py | 2 +- .../trainer/connectors/test_data_connector.py | 6 +++--- .../trainer/connectors/test_signal_connector.py | 4 ++-- .../trainer/dynamic_args/__init__.py | 0 .../dynamic_args/test_multiple_eval_dataloaders.py | 2 +- .../{tests => unittests}/trainer/flags/__init__.py | 0 .../trainer/flags/test_check_val_every_n_epoch.py | 2 +- .../trainer/flags/test_env_vars.py | 0 .../trainer/flags/test_fast_dev_run.py | 2 +- .../trainer/flags/test_limit_batches.py | 2 +- .../trainer/flags/test_min_max_epochs.py | 2 +- .../trainer/flags/test_overfit_batches.py | 4 ++-- .../trainer/flags/test_val_check_interval.py | 4 ++-- .../trainer/logging_/__init__.py | 0 .../trainer/logging_/test_distributed_logging.py | 4 ++-- .../trainer/logging_/test_eval_loop_logging.py | 4 ++-- .../trainer/logging_/test_logger_connector.py | 6 +++--- .../trainer/logging_/test_loop_logging.py | 2 +- .../trainer/logging_/test_progress_bar_logging.py | 2 +- .../trainer/logging_/test_train_loop_logging.py | 4 ++-- .../trainer/optimization/__init__.py | 0 .../trainer/optimization/test_backward_calls.py | 2 +- .../optimization/test_manual_optimization.py | 4 ++-- .../optimization/test_multiple_optimizers.py | 2 +- .../trainer/optimization/test_optimizers.py | 4 ++-- .../trainer/properties/__init__.py | 0 .../trainer/properties/test_auto_gpu_select.py | 2 +- .../properties/test_estimated_stepping_batches.py | 6 +++--- .../trainer/properties/test_get_model.py | 4 ++-- .../trainer/properties/test_log_dir.py | 2 +- .../trainer/properties/test_loggers.py | 2 +- .../trainer/test_config_validator.py | 2 +- .../trainer/test_dataloaders.py | 11 ++++++++--- test/{tests => unittests}/trainer/test_progress.py | 0 test/{tests => unittests}/trainer/test_states.py | 2 +- .../trainer/test_supporters.py | 4 ++-- test/{tests => unittests}/trainer/test_trainer.py | 12 ++++++------ .../trainer/test_trainer_cli.py | 2 +- test/{tests => unittests}/tuner/__init__.py | 0 test/{tests => unittests}/tuner/test_lr_finder.py | 8 ++++---- .../tuner/test_scale_batch_size.py | 8 ++++---- test/{tests => unittests}/tuner/test_tuning.py | 2 +- test/{tests => unittests}/utilities/__init__.py | 0 test/{tests => unittests}/utilities/distributed.py | 0 .../utilities/test_all_gather_grad.py | 4 ++-- .../utilities/test_apply_func.py | 0 .../utilities/test_apply_func_torchtext.py | 4 ++-- .../utilities/test_argparse.py | 0 .../utilities/test_auto_restart.py | 6 +++--- test/{tests => unittests}/utilities/test_cli.py | 6 +++--- .../utilities/test_cloud_io.py | 0 test/{tests => unittests}/utilities/test_data.py | 4 ++-- .../utilities/test_deepspeed_collate_checkpoint.py | 4 ++-- .../utilities/test_distributed.py | 4 ++-- .../utilities/test_dtype_device_mixin.py | 4 ++-- test/{tests => unittests}/utilities/test_enums.py | 0 .../utilities/test_fetching.py | 4 ++-- .../utilities/test_finite_checks.py | 0 test/{tests => unittests}/utilities/test_grads.py | 0 .../{tests => unittests}/utilities/test_imports.py | 0 test/{tests => unittests}/utilities/test_logger.py | 0 test/{tests => unittests}/utilities/test_memory.py | 2 +- test/{tests => unittests}/utilities/test_meta.py | 4 ++-- .../utilities/test_migration.py | 0 .../utilities/test_model_helpers.py | 2 +- .../utilities/test_model_summary.py | 6 +++--- .../utilities/test_optimizer.py | 0 .../utilities/test_parameter_tying.py | 2 +- .../{tests => unittests}/utilities/test_parsing.py | 0 .../utilities/test_rank_zero.py | 0 .../utilities/test_remote_filesystem.py | 2 +- test/{tests => unittests}/utilities/test_seed.py | 0 test/{tests => unittests}/utilities/test_types.py | 0 .../utilities/test_upgrade_checkpoint.py | 0 .../utilities/test_warnings.py | 0 .../utilities/test_xla_device_utils.py | 2 +- 242 files changed, 371 insertions(+), 366 deletions(-) delete mode 100644 test/tests/helpers/__init__.py rename test/{tests => unittests}/__init__.py (100%) rename test/{tests => unittests}/accelerators/__init__.py (100%) rename test/{tests => unittests}/accelerators/test_accelerator_connector.py (99%) rename test/{tests => unittests}/accelerators/test_accelerator_registry.py (100%) rename test/{tests => unittests}/accelerators/test_common.py (100%) rename test/{tests => unittests}/accelerators/test_cpu.py (98%) rename test/{tests => unittests}/accelerators/test_gpu.py (96%) rename test/{tests => unittests}/accelerators/test_hpu.py (97%) rename test/{tests => unittests}/accelerators/test_ipu.py (99%) rename test/{tests => unittests}/accelerators/test_tpu.py (98%) rename test/{tests => unittests}/benchmarks/__init__.py (100%) rename test/{tests => unittests}/benchmarks/generate_comparison.py (93%) rename test/{tests => unittests}/benchmarks/test_basic_parity.py (98%) rename test/{tests => unittests}/benchmarks/test_sharded_parity.py (98%) rename test/{tests => unittests}/benchmarks/test_sync_batchnorm_parity.py (99%) rename test/{tests => unittests}/callbacks/__init__.py (100%) rename test/{tests => unittests}/callbacks/test_callback_hook_outputs.py (97%) rename test/{tests => unittests}/callbacks/test_callbacks.py (98%) rename test/{tests => unittests}/callbacks/test_device_stats_monitor.py (98%) rename test/{tests => unittests}/callbacks/test_early_stopping.py (98%) rename test/{tests => unittests}/callbacks/test_finetuning_callback.py (99%) rename test/{tests => unittests}/callbacks/test_gradient_accumulation_scheduler.py (98%) rename test/{tests => unittests}/callbacks/test_lambda_function.py (95%) rename test/{tests => unittests}/callbacks/test_lr_monitor.py (99%) rename test/{tests => unittests}/callbacks/test_model_summary.py (97%) rename test/{tests => unittests}/callbacks/test_prediction_writer.py (98%) rename test/{tests => unittests}/callbacks/test_pruning.py (99%) rename test/{tests => unittests}/callbacks/test_quantization.py (97%) rename test/{tests => unittests}/callbacks/test_rich_model_summary.py (96%) rename test/{tests => unittests}/callbacks/test_rich_progress_bar.py (99%) rename test/{tests => unittests}/callbacks/test_stochastic_weight_avg.py (98%) rename test/{tests => unittests}/callbacks/test_timer.py (98%) rename test/{tests => unittests}/callbacks/test_tqdm_progress_bar.py (99%) rename test/{tests => unittests}/checkpointing/__init__.py (100%) rename test/{tests => unittests}/checkpointing/test_checkpoint_callback_frequency.py (98%) rename test/{tests => unittests}/checkpointing/test_legacy_checkpoints.py (98%) rename test/{tests => unittests}/checkpointing/test_model_checkpoint.py (99%) rename test/{tests => unittests}/checkpointing/test_torch_saving.py (96%) rename test/{tests => unittests}/checkpointing/test_trainer_checkpoint.py (99%) rename test/{tests => unittests}/conftest.py (99%) rename test/{tests => unittests}/core/__init__.py (100%) rename test/{tests => unittests}/core/test_datamodules.py (98%) rename test/{tests => unittests}/core/test_lightning_module.py (99%) rename test/{tests => unittests}/core/test_lightning_optimizer.py (99%) rename test/{tests => unittests}/core/test_metric_result_integration.py (99%) rename test/{tests => unittests}/core/test_results.py (94%) rename test/{tests => unittests}/deprecated_api/__init__.py (95%) rename test/{tests => unittests}/deprecated_api/test_remove_1-7.py (97%) rename test/{tests => unittests}/deprecated_api/test_remove_1-8.py (99%) rename test/{tests => unittests}/deprecated_api/test_remove_1-9.py (100%) rename test/{tests => unittests}/deprecated_api/test_remove_2-0.py (97%) create mode 100644 test/unittests/helpers/__init__.py rename test/{tests => unittests}/helpers/advanced_models.py (98%) rename test/{tests => unittests}/helpers/boring_model.py (100%) rename test/{tests => unittests}/helpers/dataloaders.py (100%) rename test/{tests => unittests}/helpers/datamodules.py (98%) rename test/{tests => unittests}/helpers/datasets.py (100%) rename test/{tests => unittests}/helpers/deterministic_model.py (100%) rename test/{tests => unittests}/helpers/imports.py (100%) rename test/{tests => unittests}/helpers/pipelines.py (96%) rename test/{tests => unittests}/helpers/runif.py (100%) rename test/{tests => unittests}/helpers/simple_models.py (100%) rename test/{tests => unittests}/helpers/test_datasets.py (91%) rename test/{tests => unittests}/helpers/test_models.py (82%) rename test/{tests => unittests}/helpers/torchtext_utils.py (95%) rename test/{tests => unittests}/helpers/utils.py (97%) rename test/{tests => unittests}/lite/__init__.py (100%) rename test/{tests => unittests}/lite/test_lite.py (99%) rename test/{tests => unittests}/lite/test_parity.py (98%) rename test/{tests => unittests}/lite/test_wrappers.py (99%) rename test/{tests => unittests}/loggers/__init__.py (100%) rename test/{tests => unittests}/loggers/test_all.py (97%) rename test/{tests => unittests}/loggers/test_comet.py (99%) rename test/{tests => unittests}/loggers/test_csv.py (97%) rename test/{tests => unittests}/loggers/test_logger.py (99%) rename test/{tests => unittests}/loggers/test_mlflow.py (99%) rename test/{tests => unittests}/loggers/test_neptune.py (99%) rename test/{tests => unittests}/loggers/test_tensorboard.py (99%) rename test/{tests => unittests}/loggers/test_wandb.py (99%) rename test/{tests => unittests}/loops/__init__.py (100%) rename test/{tests => unittests}/loops/batch/__init__.py (100%) rename test/{tests => unittests}/loops/batch/test_truncated_bptt.py (100%) rename test/{tests => unittests}/loops/epoch/__init__.py (100%) rename test/{tests => unittests}/loops/epoch/test_training_epoch_loop.py (99%) rename test/{tests => unittests}/loops/optimization/__init__.py (100%) rename test/{tests => unittests}/loops/optimization/test_closure.py (97%) rename test/{tests => unittests}/loops/optimization/test_manual_loop.py (97%) rename test/{tests => unittests}/loops/optimization/test_optimizer_loop.py (99%) rename test/{tests => unittests}/loops/test_all.py (97%) rename test/{tests => unittests}/loops/test_evaluation_loop.py (98%) rename test/{tests => unittests}/loops/test_evaluation_loop_flow.py (99%) rename test/{tests => unittests}/loops/test_flow_warnings.py (95%) rename test/{tests => unittests}/loops/test_loop_state_dict.py (100%) rename test/{tests => unittests}/loops/test_loops.py (99%) rename test/{tests => unittests}/loops/test_training_loop.py (99%) rename test/{tests => unittests}/loops/test_training_loop_flow_dict.py (98%) rename test/{tests => unittests}/loops/test_training_loop_flow_scalar.py (98%) rename test/{tests => unittests}/loops/test_utilities.py (100%) rename test/{tests => unittests}/models/__init__.py (100%) rename test/{tests => unittests}/models/conf/config.yaml (100%) rename test/{tests => unittests}/models/conf/training/default.yaml (100%) rename test/{tests => unittests}/models/data/__init__.py (100%) rename test/{tests => unittests}/models/data/horovod/__init__.py (100%) rename test/{tests => unittests}/models/data/horovod/test_train_script.py (92%) rename test/{tests => unittests}/models/data/horovod/train_default_model.py (96%) rename test/{tests => unittests}/models/test_amp.py (98%) rename test/{tests => unittests}/models/test_cpu.py (96%) rename test/{tests => unittests}/models/test_gpu.py (96%) rename test/{tests => unittests}/models/test_grad_norm.py (97%) rename test/{tests => unittests}/models/test_hooks.py (99%) rename test/{tests => unittests}/models/test_horovod.py (98%) rename test/{tests => unittests}/models/test_hparams.py (99%) rename test/{tests => unittests}/models/test_onnx.py (95%) rename test/{tests => unittests}/models/test_restore.py (98%) rename test/{tests => unittests}/models/test_torchscript.py (97%) rename test/{tests => unittests}/models/test_tpu.py (98%) rename test/{tests => unittests}/overrides/__init__.py (100%) rename test/{tests => unittests}/overrides/test_base.py (97%) rename test/{tests => unittests}/overrides/test_data_parallel.py (98%) rename test/{tests => unittests}/overrides/test_distributed.py (100%) rename test/{tests => unittests}/plugins/__init__.py (100%) rename test/{tests => unittests}/plugins/environments/__init__.py (100%) rename test/{tests => unittests}/plugins/environments/test_kubeflow_environment.py (100%) rename test/{tests => unittests}/plugins/environments/test_lightning_environment.py (100%) rename test/{tests => unittests}/plugins/environments/test_lsf_environment.py (100%) rename test/{tests => unittests}/plugins/environments/test_slurm_environment.py (100%) rename test/{tests => unittests}/plugins/environments/test_torchelastic_environment.py (98%) rename test/{tests => unittests}/plugins/environments/torch_elastic_deadlock.py (95%) rename test/{tests => unittests}/plugins/precision/__init__.py (100%) rename test/{tests => unittests}/plugins/precision/hpu/ops_bf16.txt (100%) rename test/{tests => unittests}/plugins/precision/hpu/ops_fp32.txt (100%) rename test/{tests => unittests}/plugins/precision/hpu/test_hpu.py (97%) rename test/{tests => unittests}/plugins/precision/test_deepspeed_precision.py (100%) rename test/{tests => unittests}/plugins/precision/test_sharded_precision.py (97%) rename test/{tests => unittests}/plugins/precision/test_tpu_bf16_plugin.py (100%) rename test/{tests => unittests}/plugins/test_amp_plugins.py (99%) rename test/{tests => unittests}/plugins/test_checkpoint_io_plugin.py (98%) rename test/{tests => unittests}/plugins/test_cluster_integration.py (99%) rename test/{tests => unittests}/plugins/test_double_plugin.py (98%) rename test/{tests => unittests}/profiler/__init__.py (100%) rename test/{tests => unittests}/profiler/test_profiler.py (99%) rename test/{tests => unittests}/profiler/test_xla_profiler.py (95%) rename test/{tests => unittests}/strategies/__init__.py (100%) rename test/{tests => unittests}/strategies/ddp_model.py (93%) rename test/{tests => unittests}/strategies/test_bagua_strategy.py (97%) rename test/{tests => unittests}/strategies/test_collaborative.py (99%) rename test/{tests => unittests}/strategies/test_common.py (91%) rename test/{tests => unittests}/strategies/test_custom_plugin.py (97%) rename test/{tests => unittests}/strategies/test_ddp.py (97%) rename test/{tests => unittests}/strategies/test_ddp_fully_sharded_native.py (98%) rename test/{tests => unittests}/strategies/test_ddp_fully_sharded_with_full_state_dict.py (98%) rename test/{tests => unittests}/strategies/test_ddp_spawn.py (88%) rename test/{tests => unittests}/strategies/test_ddp_spawn_strategy.py (98%) rename test/{tests => unittests}/strategies/test_ddp_strategy.py (98%) rename test/{tests => unittests}/strategies/test_ddp_strategy_with_comm_hook.py (99%) rename test/{tests => unittests}/strategies/test_deepspeed_strategy.py (99%) rename test/{tests => unittests}/strategies/test_dp.py (95%) rename test/{tests => unittests}/strategies/test_sharded_strategy.py (99%) rename test/{tests => unittests}/strategies/test_single_device_strategy.py (96%) rename test/{tests => unittests}/strategies/test_strategy_registry.py (99%) rename test/{tests => unittests}/strategies/test_tpu_spawn.py (93%) rename test/{tests => unittests}/trainer/__init__.py (100%) rename test/{tests => unittests}/trainer/connectors/__init__.py (100%) rename test/{tests => unittests}/trainer/connectors/test_callback_connector.py (99%) rename test/{tests => unittests}/trainer/connectors/test_checkpoint_connector.py (99%) rename test/{tests => unittests}/trainer/connectors/test_data_connector.py (99%) rename test/{tests => unittests}/trainer/connectors/test_signal_connector.py (98%) rename test/{tests => unittests}/trainer/dynamic_args/__init__.py (100%) rename test/{tests => unittests}/trainer/dynamic_args/test_multiple_eval_dataloaders.py (98%) rename test/{tests => unittests}/trainer/flags/__init__.py (100%) rename test/{tests => unittests}/trainer/flags/test_check_val_every_n_epoch.py (97%) rename test/{tests => unittests}/trainer/flags/test_env_vars.py (100%) rename test/{tests => unittests}/trainer/flags/test_fast_dev_run.py (99%) rename test/{tests => unittests}/trainer/flags/test_limit_batches.py (98%) rename test/{tests => unittests}/trainer/flags/test_min_max_epochs.py (96%) rename test/{tests => unittests}/trainer/flags/test_overfit_batches.py (98%) rename test/{tests => unittests}/trainer/flags/test_val_check_interval.py (97%) rename test/{tests => unittests}/trainer/logging_/__init__.py (100%) rename test/{tests => unittests}/trainer/logging_/test_distributed_logging.py (98%) rename test/{tests => unittests}/trainer/logging_/test_eval_loop_logging.py (99%) rename test/{tests => unittests}/trainer/logging_/test_logger_connector.py (99%) rename test/{tests => unittests}/trainer/logging_/test_loop_logging.py (98%) rename test/{tests => unittests}/trainer/logging_/test_progress_bar_logging.py (94%) rename test/{tests => unittests}/trainer/logging_/test_train_loop_logging.py (99%) rename test/{tests => unittests}/trainer/optimization/__init__.py (100%) rename test/{tests => unittests}/trainer/optimization/test_backward_calls.py (97%) rename test/{tests => unittests}/trainer/optimization/test_manual_optimization.py (99%) rename test/{tests => unittests}/trainer/optimization/test_multiple_optimizers.py (99%) rename test/{tests => unittests}/trainer/optimization/test_optimizers.py (99%) rename test/{tests => unittests}/trainer/properties/__init__.py (100%) rename test/{tests => unittests}/trainer/properties/test_auto_gpu_select.py (98%) rename test/{tests => unittests}/trainer/properties/test_estimated_stepping_batches.py (97%) rename test/{tests => unittests}/trainer/properties/test_get_model.py (95%) rename test/{tests => unittests}/trainer/properties/test_log_dir.py (98%) rename test/{tests => unittests}/trainer/properties/test_loggers.py (98%) rename test/{tests => unittests}/trainer/test_config_validator.py (99%) rename test/{tests => unittests}/trainer/test_dataloaders.py (99%) rename test/{tests => unittests}/trainer/test_progress.py (100%) rename test/{tests => unittests}/trainer/test_states.py (98%) rename test/{tests => unittests}/trainer/test_supporters.py (99%) rename test/{tests => unittests}/trainer/test_trainer.py (99%) rename test/{tests => unittests}/trainer/test_trainer_cli.py (99%) rename test/{tests => unittests}/tuner/__init__.py (100%) rename test/{tests => unittests}/tuner/test_lr_finder.py (98%) rename test/{tests => unittests}/tuner/test_scale_batch_size.py (98%) rename test/{tests => unittests}/tuner/test_tuning.py (95%) rename test/{tests => unittests}/utilities/__init__.py (100%) rename test/{tests => unittests}/utilities/distributed.py (100%) rename test/{tests => unittests}/utilities/test_all_gather_grad.py (98%) rename test/{tests => unittests}/utilities/test_apply_func.py (100%) rename test/{tests => unittests}/utilities/test_apply_func_torchtext.py (94%) rename test/{tests => unittests}/utilities/test_argparse.py (100%) rename test/{tests => unittests}/utilities/test_auto_restart.py (99%) rename test/{tests => unittests}/utilities/test_cli.py (99%) rename test/{tests => unittests}/utilities/test_cloud_io.py (100%) rename test/{tests => unittests}/utilities/test_data.py (98%) rename test/{tests => unittests}/utilities/test_deepspeed_collate_checkpoint.py (95%) rename test/{tests => unittests}/utilities/test_distributed.py (94%) rename test/{tests => unittests}/utilities/test_dtype_device_mixin.py (97%) rename test/{tests => unittests}/utilities/test_enums.py (100%) rename test/{tests => unittests}/utilities/test_fetching.py (99%) rename test/{tests => unittests}/utilities/test_finite_checks.py (100%) rename test/{tests => unittests}/utilities/test_grads.py (100%) rename test/{tests => unittests}/utilities/test_imports.py (100%) rename test/{tests => unittests}/utilities/test_logger.py (100%) rename test/{tests => unittests}/utilities/test_memory.py (97%) rename test/{tests => unittests}/utilities/test_meta.py (96%) rename test/{tests => unittests}/utilities/test_migration.py (100%) rename test/{tests => unittests}/utilities/test_model_helpers.py (97%) rename test/{tests => unittests}/utilities/test_model_summary.py (98%) rename test/{tests => unittests}/utilities/test_optimizer.py (100%) rename test/{tests => unittests}/utilities/test_parameter_tying.py (98%) rename test/{tests => unittests}/utilities/test_parsing.py (100%) rename test/{tests => unittests}/utilities/test_rank_zero.py (100%) rename test/{tests => unittests}/utilities/test_remote_filesystem.py (98%) rename test/{tests => unittests}/utilities/test_seed.py (100%) rename test/{tests => unittests}/utilities/test_types.py (100%) rename test/{tests => unittests}/utilities/test_upgrade_checkpoint.py (100%) rename test/{tests => unittests}/utilities/test_warnings.py (100%) rename test/{tests => unittests}/utilities/test_xla_device_utils.py (97%) diff --git a/pyproject.toml b/pyproject.toml index ae3bc3b1cddd7..a5c9804a52c06 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,10 +7,10 @@ requires = [ [tool.isort] known_first_party = [ - "docs", "pl_examples", "pytorch_lightning", - "tests", + "legacy", + "unittests", ] profile = "black" line_length = 120 diff --git a/test/tests/helpers/__init__.py b/test/tests/helpers/__init__.py deleted file mode 100644 index 13b2e588d6b8d..0000000000000 --- a/test/tests/helpers/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -from tests.helpers.boring_model import ( # noqa: F401 - BoringDataModule, - BoringModel, - ManualOptimBoringModel, - RandomDataset, -) -from tests.helpers.datasets import TrialMNIST # noqa: F401 diff --git a/test/tests/__init__.py b/test/unittests/__init__.py similarity index 100% rename from test/tests/__init__.py rename to test/unittests/__init__.py diff --git a/test/tests/accelerators/__init__.py b/test/unittests/accelerators/__init__.py similarity index 100% rename from test/tests/accelerators/__init__.py rename to test/unittests/accelerators/__init__.py diff --git a/test/tests/accelerators/test_accelerator_connector.py b/test/unittests/accelerators/test_accelerator_connector.py similarity index 99% rename from test/tests/accelerators/test_accelerator_connector.py rename to test/unittests/accelerators/test_accelerator_connector.py index e2d10e0b32551..84b6164311a93 100644 --- a/test/tests/accelerators/test_accelerator_connector.py +++ b/test/unittests/accelerators/test_accelerator_connector.py @@ -45,7 +45,7 @@ SingleDeviceStrategy, ) from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.runif import RunIf +from unittests.helpers.runif import RunIf def test_accelerator_choice_cpu(tmpdir): diff --git a/test/tests/accelerators/test_accelerator_registry.py b/test/unittests/accelerators/test_accelerator_registry.py similarity index 100% rename from test/tests/accelerators/test_accelerator_registry.py rename to test/unittests/accelerators/test_accelerator_registry.py diff --git a/test/tests/accelerators/test_common.py b/test/unittests/accelerators/test_common.py similarity index 100% rename from test/tests/accelerators/test_common.py rename to test/unittests/accelerators/test_common.py diff --git a/test/tests/accelerators/test_cpu.py b/test/unittests/accelerators/test_cpu.py similarity index 98% rename from test/tests/accelerators/test_cpu.py rename to test/unittests/accelerators/test_cpu.py index ce9f6d6b21ca9..a63f0bfb6893a 100644 --- a/test/tests/accelerators/test_cpu.py +++ b/test/unittests/accelerators/test_cpu.py @@ -12,7 +12,7 @@ from pytorch_lightning.plugins.precision.precision_plugin import PrecisionPlugin from pytorch_lightning.strategies import SingleDeviceStrategy from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel def test_restore_checkpoint_after_pre_setup_default(): diff --git a/test/tests/accelerators/test_gpu.py b/test/unittests/accelerators/test_gpu.py similarity index 96% rename from test/tests/accelerators/test_gpu.py rename to test/unittests/accelerators/test_gpu.py index 7cd944826ae55..e14a1f0771db6 100644 --- a/test/tests/accelerators/test_gpu.py +++ b/test/unittests/accelerators/test_gpu.py @@ -19,8 +19,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.accelerators import GPUAccelerator from pytorch_lightning.accelerators.gpu import get_nvidia_gpu_stats -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf @RunIf(min_cuda_gpus=1) diff --git a/test/tests/accelerators/test_hpu.py b/test/unittests/accelerators/test_hpu.py similarity index 97% rename from test/tests/accelerators/test_hpu.py rename to test/unittests/accelerators/test_hpu.py index 45483f167bf43..6b564685c83b5 100644 --- a/test/tests/accelerators/test_hpu.py +++ b/test/unittests/accelerators/test_hpu.py @@ -22,10 +22,10 @@ from pytorch_lightning.strategies.single_hpu import SingleHPUStrategy from pytorch_lightning.utilities import _HPU_AVAILABLE from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.runif import RunIf -from tests.helpers.simple_models import ClassificationModel +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.runif import RunIf +from unittests.helpers.simple_models import ClassificationModel @RunIf(hpu=True) diff --git a/test/tests/accelerators/test_ipu.py b/test/unittests/accelerators/test_ipu.py similarity index 99% rename from test/tests/accelerators/test_ipu.py rename to test/unittests/accelerators/test_ipu.py index 78d25732bfb0e..ec234c1c66aa2 100644 --- a/test/tests/accelerators/test_ipu.py +++ b/test/unittests/accelerators/test_ipu.py @@ -29,10 +29,10 @@ from pytorch_lightning.trainer.supporters import CombinedLoader from pytorch_lightning.utilities import _IPU_AVAILABLE from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.runif import RunIf -from tests.helpers.simple_models import ClassificationModel +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.runif import RunIf +from unittests.helpers.simple_models import ClassificationModel if _IPU_AVAILABLE: import poptorch diff --git a/test/tests/accelerators/test_tpu.py b/test/unittests/accelerators/test_tpu.py similarity index 98% rename from test/tests/accelerators/test_tpu.py rename to test/unittests/accelerators/test_tpu.py index 6cb87065bba64..f4d8cac0634ca 100644 --- a/test/tests/accelerators/test_tpu.py +++ b/test/unittests/accelerators/test_tpu.py @@ -26,9 +26,9 @@ from pytorch_lightning.plugins import PrecisionPlugin, TPUPrecisionPlugin, XLACheckpointIO from pytorch_lightning.strategies import DDPStrategy, TPUSpawnStrategy from pytorch_lightning.utilities import find_shared_parameters -from tests.helpers.boring_model import BoringModel, RandomDataset -from tests.helpers.runif import RunIf -from tests.helpers.utils import pl_multi_process_test +from unittests.helpers.boring_model import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf +from unittests.helpers.utils import pl_multi_process_test class WeightSharingModule(BoringModel): diff --git a/test/tests/benchmarks/__init__.py b/test/unittests/benchmarks/__init__.py similarity index 100% rename from test/tests/benchmarks/__init__.py rename to test/unittests/benchmarks/__init__.py diff --git a/test/tests/benchmarks/generate_comparison.py b/test/unittests/benchmarks/generate_comparison.py similarity index 93% rename from test/tests/benchmarks/generate_comparison.py rename to test/unittests/benchmarks/generate_comparison.py index 984ffdd19c163..9c413b76e3f67 100644 --- a/test/tests/benchmarks/generate_comparison.py +++ b/test/unittests/benchmarks/generate_comparison.py @@ -13,8 +13,8 @@ # limitations under the License. import os -from tests.benchmarks.test_basic_parity import measure_loops -from tests.helpers.advanced_models import ParityModuleMNIST, ParityModuleRNN +from unittests.benchmarks.test_basic_parity import measure_loops +from unittests.helpers.advanced_models import ParityModuleMNIST, ParityModuleRNN NUM_EPOCHS = 20 NUM_RUNS = 50 diff --git a/test/tests/benchmarks/test_basic_parity.py b/test/unittests/benchmarks/test_basic_parity.py similarity index 98% rename from test/tests/benchmarks/test_basic_parity.py rename to test/unittests/benchmarks/test_basic_parity.py index d893262148561..932f6d61c095a 100644 --- a/test/tests/benchmarks/test_basic_parity.py +++ b/test/unittests/benchmarks/test_basic_parity.py @@ -21,7 +21,7 @@ from tqdm import tqdm from pytorch_lightning import LightningModule, seed_everything, Trainer -from tests.helpers.advanced_models import ParityModuleCIFAR, ParityModuleMNIST, ParityModuleRNN +from unittests.helpers.advanced_models import ParityModuleCIFAR, ParityModuleMNIST, ParityModuleRNN _EXTEND_BENCHMARKS = os.getenv("PL_RUNNING_BENCHMARKS", "0") == "1" _SHORT_BENCHMARKS = not _EXTEND_BENCHMARKS diff --git a/test/tests/benchmarks/test_sharded_parity.py b/test/unittests/benchmarks/test_sharded_parity.py similarity index 98% rename from test/tests/benchmarks/test_sharded_parity.py rename to test/unittests/benchmarks/test_sharded_parity.py index 78e90bd0934cc..01ff58a282e1c 100644 --- a/test/tests/benchmarks/test_sharded_parity.py +++ b/test/unittests/benchmarks/test_sharded_parity.py @@ -20,8 +20,8 @@ from pytorch_lightning import seed_everything, Trainer from pytorch_lightning.strategies import DDPSpawnShardedStrategy -from tests.helpers.boring_model import BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf class SeedTrainLoaderModel(BoringModel): diff --git a/test/tests/benchmarks/test_sync_batchnorm_parity.py b/test/unittests/benchmarks/test_sync_batchnorm_parity.py similarity index 99% rename from test/tests/benchmarks/test_sync_batchnorm_parity.py rename to test/unittests/benchmarks/test_sync_batchnorm_parity.py index f80a2a1a67eb2..8eb447ff8bd14 100644 --- a/test/tests/benchmarks/test_sync_batchnorm_parity.py +++ b/test/unittests/benchmarks/test_sync_batchnorm_parity.py @@ -17,7 +17,7 @@ from torch.utils.data import DataLoader, DistributedSampler from pytorch_lightning import LightningModule, seed_everything, Trainer -from tests.helpers.runif import RunIf +from unittests.helpers.runif import RunIf class SyncBNModule(LightningModule): diff --git a/test/tests/callbacks/__init__.py b/test/unittests/callbacks/__init__.py similarity index 100% rename from test/tests/callbacks/__init__.py rename to test/unittests/callbacks/__init__.py diff --git a/test/tests/callbacks/test_callback_hook_outputs.py b/test/unittests/callbacks/test_callback_hook_outputs.py similarity index 97% rename from test/tests/callbacks/test_callback_hook_outputs.py rename to test/unittests/callbacks/test_callback_hook_outputs.py index d4921a3486ec2..cc91dcece57ea 100644 --- a/test/tests/callbacks/test_callback_hook_outputs.py +++ b/test/unittests/callbacks/test_callback_hook_outputs.py @@ -14,7 +14,7 @@ import pytest from pytorch_lightning import Callback, Trainer -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel @pytest.mark.parametrize("single_cb", [False, True]) diff --git a/test/tests/callbacks/test_callbacks.py b/test/unittests/callbacks/test_callbacks.py similarity index 98% rename from test/tests/callbacks/test_callbacks.py rename to test/unittests/callbacks/test_callbacks.py index e225125d8ad45..068c3e6540b1c 100644 --- a/test/tests/callbacks/test_callbacks.py +++ b/test/unittests/callbacks/test_callbacks.py @@ -19,8 +19,8 @@ from pytorch_lightning import Callback, Trainer from pytorch_lightning.callbacks import ModelCheckpoint -from tests.helpers import BoringModel -from tests.helpers.utils import no_warning_call +from unittests.helpers import BoringModel +from unittests.helpers.utils import no_warning_call def test_callbacks_configured_in_model(tmpdir): diff --git a/test/tests/callbacks/test_device_stats_monitor.py b/test/unittests/callbacks/test_device_stats_monitor.py similarity index 98% rename from test/tests/callbacks/test_device_stats_monitor.py rename to test/unittests/callbacks/test_device_stats_monitor.py index b515af08a9417..3d22795c50255 100644 --- a/test/tests/callbacks/test_device_stats_monitor.py +++ b/test/unittests/callbacks/test_device_stats_monitor.py @@ -25,8 +25,8 @@ from pytorch_lightning.loggers import CSVLogger from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.rank_zero import rank_zero_only -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf @RunIf(min_cuda_gpus=1) diff --git a/test/tests/callbacks/test_early_stopping.py b/test/unittests/callbacks/test_early_stopping.py similarity index 98% rename from test/tests/callbacks/test_early_stopping.py rename to test/unittests/callbacks/test_early_stopping.py index 98b088d3fbb87..49cfd7988bab1 100644 --- a/test/tests/callbacks/test_early_stopping.py +++ b/test/unittests/callbacks/test_early_stopping.py @@ -26,10 +26,10 @@ from pytorch_lightning import seed_everything, Trainer from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.runif import RunIf -from tests.helpers.simple_models import ClassificationModel +from unittests.helpers import BoringModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.runif import RunIf +from unittests.helpers.simple_models import ClassificationModel _logger = logging.getLogger(__name__) diff --git a/test/tests/callbacks/test_finetuning_callback.py b/test/unittests/callbacks/test_finetuning_callback.py similarity index 99% rename from test/tests/callbacks/test_finetuning_callback.py rename to test/unittests/callbacks/test_finetuning_callback.py index 3fe9460634c27..7f6847b83085a 100644 --- a/test/tests/callbacks/test_finetuning_callback.py +++ b/test/unittests/callbacks/test_finetuning_callback.py @@ -22,7 +22,7 @@ from pytorch_lightning import LightningModule, seed_everything, Trainer from pytorch_lightning.callbacks import BackboneFinetuning, BaseFinetuning, ModelCheckpoint from pytorch_lightning.utilities.imports import _TORCH_GREATER_EQUAL_1_11 -from tests.helpers import BoringModel, RandomDataset +from unittests.helpers import BoringModel, RandomDataset class TestBackboneFinetuningCallback(BackboneFinetuning): diff --git a/test/tests/callbacks/test_gradient_accumulation_scheduler.py b/test/unittests/callbacks/test_gradient_accumulation_scheduler.py similarity index 98% rename from test/tests/callbacks/test_gradient_accumulation_scheduler.py rename to test/unittests/callbacks/test_gradient_accumulation_scheduler.py index 25ce1e843b80e..1bda299a69adf 100644 --- a/test/tests/callbacks/test_gradient_accumulation_scheduler.py +++ b/test/unittests/callbacks/test_gradient_accumulation_scheduler.py @@ -19,7 +19,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import GradientAccumulationScheduler from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel +from unittests.helpers import BoringModel @pytest.mark.parametrize("accumulate_grad_batches", (1, 2, 3)) diff --git a/test/tests/callbacks/test_lambda_function.py b/test/unittests/callbacks/test_lambda_function.py similarity index 95% rename from test/tests/callbacks/test_lambda_function.py rename to test/unittests/callbacks/test_lambda_function.py index d7ad990484a51..465964e4dcb97 100644 --- a/test/tests/callbacks/test_lambda_function.py +++ b/test/unittests/callbacks/test_lambda_function.py @@ -17,8 +17,8 @@ from pytorch_lightning import seed_everything, Trainer from pytorch_lightning.callbacks import Callback, LambdaCallback -from tests.helpers.boring_model import BoringModel -from tests.models.test_hooks import get_members +from unittests.helpers.boring_model import BoringModel +from unittests.models.test_hooks import get_members def test_lambda_call(tmpdir): diff --git a/test/tests/callbacks/test_lr_monitor.py b/test/unittests/callbacks/test_lr_monitor.py similarity index 99% rename from test/tests/callbacks/test_lr_monitor.py rename to test/unittests/callbacks/test_lr_monitor.py index 8afdcf003f604..5bc0791bee021 100644 --- a/test/tests/callbacks/test_lr_monitor.py +++ b/test/unittests/callbacks/test_lr_monitor.py @@ -15,15 +15,15 @@ import torch from torch import optim -import tests.helpers.utils as tutils +import unittests.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.callbacks import LearningRateMonitor from pytorch_lightning.callbacks.callback import Callback from pytorch_lightning.callbacks.finetuning import BackboneFinetuning from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.simple_models import ClassificationModel +from unittests.helpers import BoringModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.simple_models import ClassificationModel def test_lr_monitor_single_lr(tmpdir): diff --git a/test/tests/callbacks/test_model_summary.py b/test/unittests/callbacks/test_model_summary.py similarity index 97% rename from test/tests/callbacks/test_model_summary.py rename to test/unittests/callbacks/test_model_summary.py index 765911b8be9a1..9677e0e842f5e 100644 --- a/test/tests/callbacks/test_model_summary.py +++ b/test/unittests/callbacks/test_model_summary.py @@ -15,7 +15,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import ModelSummary -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel def test_model_summary_callback_present_trainer(): diff --git a/test/tests/callbacks/test_prediction_writer.py b/test/unittests/callbacks/test_prediction_writer.py similarity index 98% rename from test/tests/callbacks/test_prediction_writer.py rename to test/unittests/callbacks/test_prediction_writer.py index f086316052995..0e7acd0205bab 100644 --- a/test/tests/callbacks/test_prediction_writer.py +++ b/test/unittests/callbacks/test_prediction_writer.py @@ -21,8 +21,8 @@ from pytorch_lightning.callbacks import BasePredictionWriter from pytorch_lightning.trainer.supporters import CombinedLoader from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf class DummyPredictionWriter(BasePredictionWriter): diff --git a/test/tests/callbacks/test_pruning.py b/test/unittests/callbacks/test_pruning.py similarity index 99% rename from test/tests/callbacks/test_pruning.py rename to test/unittests/callbacks/test_pruning.py index 19601979de29d..de27006cc28ca 100644 --- a/test/tests/callbacks/test_pruning.py +++ b/test/unittests/callbacks/test_pruning.py @@ -25,8 +25,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import ModelCheckpoint, ModelPruning from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf class TestModel(BoringModel): diff --git a/test/tests/callbacks/test_quantization.py b/test/unittests/callbacks/test_quantization.py similarity index 97% rename from test/tests/callbacks/test_quantization.py rename to test/unittests/callbacks/test_quantization.py index efd1b6d2f4dcf..38f20f000d099 100644 --- a/test/tests/callbacks/test_quantization.py +++ b/test/unittests/callbacks/test_quantization.py @@ -24,10 +24,10 @@ from pytorch_lightning.callbacks import QuantizationAwareTraining from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.memory import get_model_size_mb -from tests.helpers.boring_model import RandomDataset -from tests.helpers.datamodules import RegressDataModule -from tests.helpers.runif import RunIf -from tests.helpers.simple_models import RegressionModel +from unittests.helpers.boring_model import RandomDataset +from unittests.helpers.datamodules import RegressDataModule +from unittests.helpers.runif import RunIf +from unittests.helpers.simple_models import RegressionModel @pytest.mark.parametrize("observe", ["average", "histogram"]) diff --git a/test/tests/callbacks/test_rich_model_summary.py b/test/unittests/callbacks/test_rich_model_summary.py similarity index 96% rename from test/tests/callbacks/test_rich_model_summary.py rename to test/unittests/callbacks/test_rich_model_summary.py index d9e4ec55902ca..33cf3dd59a543 100644 --- a/test/tests/callbacks/test_rich_model_summary.py +++ b/test/unittests/callbacks/test_rich_model_summary.py @@ -20,8 +20,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import RichModelSummary, RichProgressBar from pytorch_lightning.utilities.model_summary import summarize -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf @RunIf(rich=True) diff --git a/test/tests/callbacks/test_rich_progress_bar.py b/test/unittests/callbacks/test_rich_progress_bar.py similarity index 99% rename from test/tests/callbacks/test_rich_progress_bar.py rename to test/unittests/callbacks/test_rich_progress_bar.py index 8fdcb6c99e331..32c5f30d57b35 100644 --- a/test/tests/callbacks/test_rich_progress_bar.py +++ b/test/unittests/callbacks/test_rich_progress_bar.py @@ -21,8 +21,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import ProgressBarBase, RichProgressBar from pytorch_lightning.callbacks.progress.rich_progress import RichProgressBarTheme -from tests.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset +from unittests.helpers.runif import RunIf @RunIf(rich=True) diff --git a/test/tests/callbacks/test_stochastic_weight_avg.py b/test/unittests/callbacks/test_stochastic_weight_avg.py similarity index 98% rename from test/tests/callbacks/test_stochastic_weight_avg.py rename to test/unittests/callbacks/test_stochastic_weight_avg.py index dc1f59d52234c..7e150da668d97 100644 --- a/test/tests/callbacks/test_stochastic_weight_avg.py +++ b/test/unittests/callbacks/test_stochastic_weight_avg.py @@ -24,8 +24,8 @@ from pytorch_lightning.callbacks import StochasticWeightAveraging from pytorch_lightning.strategies import DDPSpawnStrategy, Strategy from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset +from unittests.helpers.runif import RunIf class SwaTestModel(BoringModel): diff --git a/test/tests/callbacks/test_timer.py b/test/unittests/callbacks/test_timer.py similarity index 98% rename from test/tests/callbacks/test_timer.py rename to test/unittests/callbacks/test_timer.py index 21792b430a35f..07a8901adc938 100644 --- a/test/tests/callbacks/test_timer.py +++ b/test/unittests/callbacks/test_timer.py @@ -22,8 +22,8 @@ from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.callbacks.timer import Timer from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf def test_trainer_flag(caplog): diff --git a/test/tests/callbacks/test_tqdm_progress_bar.py b/test/unittests/callbacks/test_tqdm_progress_bar.py similarity index 99% rename from test/tests/callbacks/test_tqdm_progress_bar.py rename to test/unittests/callbacks/test_tqdm_progress_bar.py index 14da4258a09a9..8b9326504e938 100644 --- a/test/tests/callbacks/test_tqdm_progress_bar.py +++ b/test/unittests/callbacks/test_tqdm_progress_bar.py @@ -29,8 +29,8 @@ from pytorch_lightning.callbacks.progress.tqdm_progress import Tqdm from pytorch_lightning.core.module import LightningModule from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf class MockTqdm(Tqdm): diff --git a/test/tests/checkpointing/__init__.py b/test/unittests/checkpointing/__init__.py similarity index 100% rename from test/tests/checkpointing/__init__.py rename to test/unittests/checkpointing/__init__.py diff --git a/test/tests/checkpointing/test_checkpoint_callback_frequency.py b/test/unittests/checkpointing/test_checkpoint_callback_frequency.py similarity index 98% rename from test/tests/checkpointing/test_checkpoint_callback_frequency.py rename to test/unittests/checkpointing/test_checkpoint_callback_frequency.py index 197349a39867e..80ce080b2dc02 100644 --- a/test/tests/checkpointing/test_checkpoint_callback_frequency.py +++ b/test/unittests/checkpointing/test_checkpoint_callback_frequency.py @@ -18,8 +18,8 @@ import torch from pytorch_lightning import callbacks, Trainer -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf def test_disabled_checkpointing(tmpdir): diff --git a/test/tests/checkpointing/test_legacy_checkpoints.py b/test/unittests/checkpointing/test_legacy_checkpoints.py similarity index 98% rename from test/tests/checkpointing/test_legacy_checkpoints.py rename to test/unittests/checkpointing/test_legacy_checkpoints.py index ac2806cbf3811..2d904fcfa2f1e 100644 --- a/test/tests/checkpointing/test_legacy_checkpoints.py +++ b/test/unittests/checkpointing/test_legacy_checkpoints.py @@ -22,7 +22,7 @@ import pytorch_lightning as pl from pytorch_lightning import Callback, Trainer -from tests import _PATH_LEGACY, _PROJECT_ROOT +from unittests import _PATH_LEGACY, _PROJECT_ROOT LEGACY_CHECKPOINTS_PATH = os.path.join(_PATH_LEGACY, "checkpoints") CHECKPOINT_EXTENSION = ".ckpt" diff --git a/test/tests/checkpointing/test_model_checkpoint.py b/test/unittests/checkpointing/test_model_checkpoint.py similarity index 99% rename from test/tests/checkpointing/test_model_checkpoint.py rename to test/unittests/checkpointing/test_model_checkpoint.py index fc2fa981c9f58..18523550e1971 100644 --- a/test/tests/checkpointing/test_model_checkpoint.py +++ b/test/unittests/checkpointing/test_model_checkpoint.py @@ -31,15 +31,15 @@ from torch import optim import pytorch_lightning as pl -import tests.helpers.utils as tutils +import unittests.helpers.utils as tutils from pytorch_lightning import seed_everything, Trainer from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.loggers import TensorBoardLogger from pytorch_lightning.utilities.cloud_io import load as pl_load from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.imports import _OMEGACONF_AVAILABLE -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf if _OMEGACONF_AVAILABLE: from omegaconf import Container, OmegaConf diff --git a/test/tests/checkpointing/test_torch_saving.py b/test/unittests/checkpointing/test_torch_saving.py similarity index 96% rename from test/tests/checkpointing/test_torch_saving.py rename to test/unittests/checkpointing/test_torch_saving.py index f2f29e0865da4..0eb5ea07b701e 100644 --- a/test/tests/checkpointing/test_torch_saving.py +++ b/test/unittests/checkpointing/test_torch_saving.py @@ -16,8 +16,8 @@ import torch from pytorch_lightning import Trainer -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf def test_model_torch_save(tmpdir): diff --git a/test/tests/checkpointing/test_trainer_checkpoint.py b/test/unittests/checkpointing/test_trainer_checkpoint.py similarity index 99% rename from test/tests/checkpointing/test_trainer_checkpoint.py rename to test/unittests/checkpointing/test_trainer_checkpoint.py index 50b279b98c14b..6063f89f400e4 100644 --- a/test/tests/checkpointing/test_trainer_checkpoint.py +++ b/test/unittests/checkpointing/test_trainer_checkpoint.py @@ -23,7 +23,7 @@ from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.plugins.io.torch_plugin import TorchCheckpointIO from pytorch_lightning.plugins.io.xla_plugin import XLACheckpointIO -from tests.helpers import BoringModel +from unittests.helpers import BoringModel def test_finetuning_with_ckpt_path(tmpdir): diff --git a/test/tests/conftest.py b/test/unittests/conftest.py similarity index 99% rename from test/tests/conftest.py rename to test/unittests/conftest.py index fac9c6de26297..84577ee263a44 100644 --- a/test/tests/conftest.py +++ b/test/unittests/conftest.py @@ -24,7 +24,7 @@ from pytorch_lightning.plugins.environments.lightning_environment import find_free_network_port from pytorch_lightning.trainer.connectors.signal_connector import SignalConnector from pytorch_lightning.utilities.imports import _IS_WINDOWS -from tests import _PATH_DATASETS +from unittests import _PATH_DATASETS @pytest.fixture(scope="session") diff --git a/test/tests/core/__init__.py b/test/unittests/core/__init__.py similarity index 100% rename from test/tests/core/__init__.py rename to test/unittests/core/__init__.py diff --git a/test/tests/core/test_datamodules.py b/test/unittests/core/test_datamodules.py similarity index 98% rename from test/tests/core/test_datamodules.py rename to test/unittests/core/test_datamodules.py index ffab893d7be57..823a96557f839 100644 --- a/test/tests/core/test_datamodules.py +++ b/test/unittests/core/test_datamodules.py @@ -27,11 +27,11 @@ from pytorch_lightning.trainer.states import TrainerFn from pytorch_lightning.utilities import _OMEGACONF_AVAILABLE, AttributeDict from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringDataModule, BoringModel -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.runif import RunIf -from tests.helpers.simple_models import ClassificationModel -from tests.helpers.utils import reset_seed +from unittests.helpers import BoringDataModule, BoringModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.runif import RunIf +from unittests.helpers.simple_models import ClassificationModel +from unittests.helpers.utils import reset_seed if _OMEGACONF_AVAILABLE: from omegaconf import OmegaConf diff --git a/test/tests/core/test_lightning_module.py b/test/unittests/core/test_lightning_module.py similarity index 99% rename from test/tests/core/test_lightning_module.py rename to test/unittests/core/test_lightning_module.py index 9f51bca98e5d1..4253697abeb15 100644 --- a/test/tests/core/test_lightning_module.py +++ b/test/unittests/core/test_lightning_module.py @@ -23,8 +23,8 @@ from pytorch_lightning.loggers import TensorBoardLogger from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.imports import _TORCH_GREATER_EQUAL_1_11 -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf def test_lightning_module_not_abstract(): diff --git a/test/tests/core/test_lightning_optimizer.py b/test/unittests/core/test_lightning_optimizer.py similarity index 99% rename from test/tests/core/test_lightning_optimizer.py rename to test/unittests/core/test_lightning_optimizer.py index 0ee82fcc2e4ec..51db3103cf798 100644 --- a/test/tests/core/test_lightning_optimizer.py +++ b/test/unittests/core/test_lightning_optimizer.py @@ -20,7 +20,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.core.optimizer import LightningOptimizer from pytorch_lightning.loops.optimization.optimizer_loop import Closure -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel @pytest.mark.parametrize("auto", (True, False)) diff --git a/test/tests/core/test_metric_result_integration.py b/test/unittests/core/test_metric_result_integration.py similarity index 99% rename from test/tests/core/test_metric_result_integration.py rename to test/unittests/core/test_metric_result_integration.py index 45fc1291ed9ba..2edf0391337ba 100644 --- a/test/tests/core/test_metric_result_integration.py +++ b/test/unittests/core/test_metric_result_integration.py @@ -24,7 +24,7 @@ from torch.nn import ModuleDict, ModuleList from torchmetrics import Metric, MetricCollection -import tests.helpers.utils as tutils +import unittests.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.trainer.connectors.logger_connector.result import ( @@ -33,8 +33,8 @@ _ResultMetric, _Sync, ) -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf class DummyMetric(Metric): diff --git a/test/tests/core/test_results.py b/test/unittests/core/test_results.py similarity index 94% rename from test/tests/core/test_results.py rename to test/unittests/core/test_results.py index a39ce51788ff9..507f005d3eeba 100644 --- a/test/tests/core/test_results.py +++ b/test/unittests/core/test_results.py @@ -15,10 +15,10 @@ import torch.distributed as dist import torch.multiprocessing as mp -import tests.helpers.utils as tutils +import unittests.helpers.utils as tutils from pytorch_lightning.trainer.connectors.logger_connector.result import _Sync from pytorch_lightning.utilities.distributed import sync_ddp_if_available -from tests.helpers.runif import RunIf +from unittests.helpers.runif import RunIf def _setup_ddp(rank, worldsize): diff --git a/test/tests/deprecated_api/__init__.py b/test/unittests/deprecated_api/__init__.py similarity index 95% rename from test/tests/deprecated_api/__init__.py rename to test/unittests/deprecated_api/__init__.py index 5480f398da341..d1a73c1fa24cc 100644 --- a/test/tests/deprecated_api/__init__.py +++ b/test/unittests/deprecated_api/__init__.py @@ -16,7 +16,7 @@ from contextlib import contextmanager from typing import Optional -from tests.helpers.utils import no_warning_call +from unittests.helpers.utils import no_warning_call def _soft_unimport_module(str_module): diff --git a/test/tests/deprecated_api/test_remove_1-7.py b/test/unittests/deprecated_api/test_remove_1-7.py similarity index 97% rename from test/tests/deprecated_api/test_remove_1-7.py rename to test/unittests/deprecated_api/test_remove_1-7.py index d681a554e7e9c..5d336d2b2ad51 100644 --- a/test/tests/deprecated_api/test_remove_1-7.py +++ b/test/unittests/deprecated_api/test_remove_1-7.py @@ -31,9 +31,9 @@ TorchElasticEnvironment, ) from pytorch_lightning.strategies import SingleDeviceStrategy -from tests.deprecated_api import _soft_unimport_module -from tests.helpers import BoringModel -from tests.plugins.environments.test_lsf_environment import _make_rankfile +from unittests.deprecated_api import _soft_unimport_module +from unittests.helpers import BoringModel +from unittests.plugins.environments.test_lsf_environment import _make_rankfile def test_v1_7_0_on_interrupt(tmpdir): diff --git a/test/tests/deprecated_api/test_remove_1-8.py b/test/unittests/deprecated_api/test_remove_1-8.py similarity index 99% rename from test/tests/deprecated_api/test_remove_1-8.py rename to test/unittests/deprecated_api/test_remove_1-8.py index f168cfcd12f34..8c6b51f538b6a 100644 --- a/test/tests/deprecated_api/test_remove_1-8.py +++ b/test/unittests/deprecated_api/test_remove_1-8.py @@ -47,10 +47,10 @@ from pytorch_lightning.utilities.enums import DeviceType, DistributedType from pytorch_lightning.utilities.imports import _TORCHTEXT_LEGACY from pytorch_lightning.utilities.rank_zero import rank_zero_only, rank_zero_warn -from tests.deprecated_api import no_deprecated_call -from tests.helpers.boring_model import BoringDataModule, BoringModel -from tests.helpers.runif import RunIf -from tests.helpers.torchtext_utils import get_dummy_torchtext_data_iterator +from unittests.deprecated_api import no_deprecated_call +from unittests.helpers.boring_model import BoringDataModule, BoringModel +from unittests.helpers.runif import RunIf +from unittests.helpers.torchtext_utils import get_dummy_torchtext_data_iterator def test_v1_8_0_deprecated_distributed_type_enum(): diff --git a/test/tests/deprecated_api/test_remove_1-9.py b/test/unittests/deprecated_api/test_remove_1-9.py similarity index 100% rename from test/tests/deprecated_api/test_remove_1-9.py rename to test/unittests/deprecated_api/test_remove_1-9.py diff --git a/test/tests/deprecated_api/test_remove_2-0.py b/test/unittests/deprecated_api/test_remove_2-0.py similarity index 97% rename from test/tests/deprecated_api/test_remove_2-0.py rename to test/unittests/deprecated_api/test_remove_2-0.py index 88eb8c985dbc7..f378d8a5c2d0c 100644 --- a/test/tests/deprecated_api/test_remove_2-0.py +++ b/test/unittests/deprecated_api/test_remove_2-0.py @@ -18,8 +18,8 @@ import pytorch_lightning from pytorch_lightning import Trainer -from tests.callbacks.test_callbacks import OldStatefulCallback -from tests.helpers import BoringModel +from unittests.callbacks.test_callbacks import OldStatefulCallback +from unittests.helpers import BoringModel def test_v2_0_0_deprecated_num_processes(): diff --git a/test/unittests/helpers/__init__.py b/test/unittests/helpers/__init__.py new file mode 100644 index 0000000000000..aec39b5bc6e24 --- /dev/null +++ b/test/unittests/helpers/__init__.py @@ -0,0 +1,7 @@ +from unittests.helpers.boring_model import ( # noqa: F401 + BoringDataModule, + BoringModel, + ManualOptimBoringModel, + RandomDataset, +) +from unittests.helpers.datasets import TrialMNIST # noqa: F401 diff --git a/test/tests/helpers/advanced_models.py b/test/unittests/helpers/advanced_models.py similarity index 98% rename from test/tests/helpers/advanced_models.py rename to test/unittests/helpers/advanced_models.py index ba69c22286408..a524c47d060be 100644 --- a/test/tests/helpers/advanced_models.py +++ b/test/unittests/helpers/advanced_models.py @@ -20,8 +20,8 @@ from pytorch_lightning.core.module import LightningModule from pytorch_lightning.utilities.imports import _TORCHVISION_AVAILABLE -from tests import _PATH_DATASETS -from tests.helpers.datasets import AverageDataset, MNIST, TrialMNIST +from unittests import _PATH_DATASETS +from unittests.helpers.datasets import AverageDataset, MNIST, TrialMNIST if _TORCHVISION_AVAILABLE: from torchvision import models, transforms diff --git a/test/tests/helpers/boring_model.py b/test/unittests/helpers/boring_model.py similarity index 100% rename from test/tests/helpers/boring_model.py rename to test/unittests/helpers/boring_model.py diff --git a/test/tests/helpers/dataloaders.py b/test/unittests/helpers/dataloaders.py similarity index 100% rename from test/tests/helpers/dataloaders.py rename to test/unittests/helpers/dataloaders.py diff --git a/test/tests/helpers/datamodules.py b/test/unittests/helpers/datamodules.py similarity index 98% rename from test/tests/helpers/datamodules.py rename to test/unittests/helpers/datamodules.py index 2d2d1190472c5..c9e1262ed16f4 100644 --- a/test/tests/helpers/datamodules.py +++ b/test/unittests/helpers/datamodules.py @@ -19,7 +19,7 @@ from pytorch_lightning.core.datamodule import LightningDataModule from pytorch_lightning.utilities import _module_available -from tests.helpers.datasets import MNIST, SklearnDataset, TrialMNIST +from unittests.helpers.datasets import MNIST, SklearnDataset, TrialMNIST _SKLEARN_AVAILABLE = _module_available("sklearn") if _SKLEARN_AVAILABLE: diff --git a/test/tests/helpers/datasets.py b/test/unittests/helpers/datasets.py similarity index 100% rename from test/tests/helpers/datasets.py rename to test/unittests/helpers/datasets.py diff --git a/test/tests/helpers/deterministic_model.py b/test/unittests/helpers/deterministic_model.py similarity index 100% rename from test/tests/helpers/deterministic_model.py rename to test/unittests/helpers/deterministic_model.py diff --git a/test/tests/helpers/imports.py b/test/unittests/helpers/imports.py similarity index 100% rename from test/tests/helpers/imports.py rename to test/unittests/helpers/imports.py diff --git a/test/tests/helpers/pipelines.py b/test/unittests/helpers/pipelines.py similarity index 96% rename from test/tests/helpers/pipelines.py rename to test/unittests/helpers/pipelines.py index 00a07ab496088..aae50a3e64a63 100644 --- a/test/tests/helpers/pipelines.py +++ b/test/unittests/helpers/pipelines.py @@ -15,8 +15,8 @@ from torchmetrics.functional import accuracy from pytorch_lightning import LightningDataModule, LightningModule, Trainer -from tests.helpers import BoringModel -from tests.helpers.utils import get_default_logger, load_model_from_checkpoint, reset_seed +from unittests.helpers import BoringModel +from unittests.helpers.utils import get_default_logger, load_model_from_checkpoint, reset_seed def run_model_test_without_loggers( diff --git a/test/tests/helpers/runif.py b/test/unittests/helpers/runif.py similarity index 100% rename from test/tests/helpers/runif.py rename to test/unittests/helpers/runif.py diff --git a/test/tests/helpers/simple_models.py b/test/unittests/helpers/simple_models.py similarity index 100% rename from test/tests/helpers/simple_models.py rename to test/unittests/helpers/simple_models.py diff --git a/test/tests/helpers/test_datasets.py b/test/unittests/helpers/test_datasets.py similarity index 91% rename from test/tests/helpers/test_datasets.py rename to test/unittests/helpers/test_datasets.py index 76669ae0e480d..aa79db8fc7ce0 100644 --- a/test/tests/helpers/test_datasets.py +++ b/test/unittests/helpers/test_datasets.py @@ -16,8 +16,8 @@ import cloudpickle import pytest -from tests import _PATH_DATASETS -from tests.helpers.datasets import AverageDataset, MNIST, TrialMNIST +from unittests import _PATH_DATASETS +from unittests.helpers.datasets import AverageDataset, MNIST, TrialMNIST @pytest.mark.parametrize( diff --git a/test/tests/helpers/test_models.py b/test/unittests/helpers/test_models.py similarity index 82% rename from test/tests/helpers/test_models.py rename to test/unittests/helpers/test_models.py index a6e5437115d5e..a1dca802c79d5 100644 --- a/test/tests/helpers/test_models.py +++ b/test/unittests/helpers/test_models.py @@ -16,10 +16,10 @@ import pytest from pytorch_lightning import Trainer -from tests.helpers.advanced_models import BasicGAN, ParityModuleMNIST, ParityModuleRNN -from tests.helpers.boring_model import BoringModel -from tests.helpers.datamodules import ClassifDataModule, RegressDataModule -from tests.helpers.simple_models import ClassificationModel, RegressionModel +from unittests.helpers.advanced_models import BasicGAN, ParityModuleMNIST, ParityModuleRNN +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.datamodules import ClassifDataModule, RegressDataModule +from unittests.helpers.simple_models import ClassificationModel, RegressionModel @pytest.mark.parametrize( diff --git a/test/tests/helpers/torchtext_utils.py b/test/unittests/helpers/torchtext_utils.py similarity index 95% rename from test/tests/helpers/torchtext_utils.py rename to test/unittests/helpers/torchtext_utils.py index c166ba8c8df7e..86693f316be79 100644 --- a/test/tests/helpers/torchtext_utils.py +++ b/test/unittests/helpers/torchtext_utils.py @@ -14,7 +14,7 @@ import random import string -from tests.helpers.imports import Dataset, Example, Field, Iterator +from unittests.helpers.imports import Dataset, Example, Field, Iterator def _generate_random_string(length: int = 10): diff --git a/test/tests/helpers/utils.py b/test/unittests/helpers/utils.py similarity index 97% rename from test/tests/helpers/utils.py rename to test/unittests/helpers/utils.py index 0e62c4b109ef5..645d84b3eb432 100644 --- a/test/tests/helpers/utils.py +++ b/test/unittests/helpers/utils.py @@ -23,8 +23,8 @@ from pytorch_lightning import seed_everything from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.loggers import TensorBoardLogger -from tests import _TEMP_PATH, RANDOM_PORTS -from tests.helpers.boring_model import BoringModel +from unittests import _TEMP_PATH, RANDOM_PORTS +from unittests.helpers.boring_model import BoringModel def get_default_logger(save_dir, version=None): diff --git a/test/tests/lite/__init__.py b/test/unittests/lite/__init__.py similarity index 100% rename from test/tests/lite/__init__.py rename to test/unittests/lite/__init__.py diff --git a/test/tests/lite/test_lite.py b/test/unittests/lite/test_lite.py similarity index 99% rename from test/tests/lite/test_lite.py rename to test/unittests/lite/test_lite.py index d59d87bdede40..65609ba615b32 100644 --- a/test/tests/lite/test_lite.py +++ b/test/unittests/lite/test_lite.py @@ -30,7 +30,7 @@ from pytorch_lightning.utilities import _StrategyType from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.seed import pl_worker_init_function -from tests.helpers.runif import RunIf +from unittests.helpers.runif import RunIf class EmptyLite(LightningLite): diff --git a/test/tests/lite/test_parity.py b/test/unittests/lite/test_parity.py similarity index 98% rename from test/tests/lite/test_parity.py rename to test/unittests/lite/test_parity.py index 537ed67c31bc0..597727f633c62 100644 --- a/test/tests/lite/test_parity.py +++ b/test/unittests/lite/test_parity.py @@ -32,8 +32,8 @@ from pytorch_lightning.strategies.ddp_spawn import DDPSpawnStrategy from pytorch_lightning.utilities.apply_func import apply_to_collection, move_data_to_device from pytorch_lightning.utilities.cloud_io import atomic_save -from tests.helpers.boring_model import RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import RandomDataset +from unittests.helpers.runif import RunIf class BoringModel(nn.Module): diff --git a/test/tests/lite/test_wrappers.py b/test/unittests/lite/test_wrappers.py similarity index 99% rename from test/tests/lite/test_wrappers.py rename to test/unittests/lite/test_wrappers.py index 23b179d30b237..b38431caebfd9 100644 --- a/test/tests/lite/test_wrappers.py +++ b/test/unittests/lite/test_wrappers.py @@ -20,7 +20,7 @@ from pytorch_lightning.core.mixins import DeviceDtypeModuleMixin from pytorch_lightning.lite import LightningLite from pytorch_lightning.lite.wrappers import _LiteDataLoader, _LiteModule, _LiteOptimizer -from tests.helpers.runif import RunIf +from unittests.helpers.runif import RunIf class EmptyLite(LightningLite): diff --git a/test/tests/loggers/__init__.py b/test/unittests/loggers/__init__.py similarity index 100% rename from test/tests/loggers/__init__.py rename to test/unittests/loggers/__init__.py diff --git a/test/tests/loggers/test_all.py b/test/unittests/loggers/test_all.py similarity index 97% rename from test/tests/loggers/test_all.py rename to test/unittests/loggers/test_all.py index d72bb8cc51ae4..30d078a578c37 100644 --- a/test/tests/loggers/test_all.py +++ b/test/unittests/loggers/test_all.py @@ -21,7 +21,7 @@ import pytest import torch -import tests.helpers.utils as tutils +import unittests.helpers.utils as tutils from pytorch_lightning import Callback, Trainer from pytorch_lightning.loggers import ( CometLogger, @@ -32,11 +32,11 @@ WandbLogger, ) from pytorch_lightning.loggers.logger import DummyExperiment -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf -from tests.loggers.test_comet import _patch_comet_atexit -from tests.loggers.test_mlflow import mock_mlflow_run_creation -from tests.loggers.test_neptune import create_neptune_mock +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf +from unittests.loggers.test_comet import _patch_comet_atexit +from unittests.loggers.test_mlflow import mock_mlflow_run_creation +from unittests.loggers.test_neptune import create_neptune_mock LOGGER_CTX_MANAGERS = ( mock.patch("pytorch_lightning.loggers.comet.comet_ml"), diff --git a/test/tests/loggers/test_comet.py b/test/unittests/loggers/test_comet.py similarity index 99% rename from test/tests/loggers/test_comet.py rename to test/unittests/loggers/test_comet.py index e09b954a61a6a..40a3558a48b1a 100644 --- a/test/tests/loggers/test_comet.py +++ b/test/unittests/loggers/test_comet.py @@ -20,7 +20,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.loggers import CometLogger from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel +from unittests.helpers import BoringModel def _patch_comet_atexit(monkeypatch): diff --git a/test/tests/loggers/test_csv.py b/test/unittests/loggers/test_csv.py similarity index 97% rename from test/tests/loggers/test_csv.py rename to test/unittests/loggers/test_csv.py index bd859ad1f5ebb..a1e1d0dd39de4 100644 --- a/test/tests/loggers/test_csv.py +++ b/test/unittests/loggers/test_csv.py @@ -21,8 +21,8 @@ from pytorch_lightning.core.saving import load_hparams_from_yaml from pytorch_lightning.loggers import CSVLogger from pytorch_lightning.loggers.csv_logs import ExperimentWriter -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.simple_models import ClassificationModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.simple_models import ClassificationModel def test_file_logger_automatic_versioning(tmpdir): diff --git a/test/tests/loggers/test_logger.py b/test/unittests/loggers/test_logger.py similarity index 99% rename from test/tests/loggers/test_logger.py rename to test/unittests/loggers/test_logger.py index 250ec7861c5b6..698ec9ef15eb9 100644 --- a/test/tests/loggers/test_logger.py +++ b/test/unittests/loggers/test_logger.py @@ -27,7 +27,7 @@ from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.logger import _convert_params, _sanitize_params from pytorch_lightning.utilities.rank_zero import rank_zero_only -from tests.helpers.boring_model import BoringDataModule, BoringModel +from unittests.helpers.boring_model import BoringDataModule, BoringModel def test_logger_collection(): diff --git a/test/tests/loggers/test_mlflow.py b/test/unittests/loggers/test_mlflow.py similarity index 99% rename from test/tests/loggers/test_mlflow.py rename to test/unittests/loggers/test_mlflow.py index 1e9e8ec271bd5..8df8ece24f0f4 100644 --- a/test/tests/loggers/test_mlflow.py +++ b/test/unittests/loggers/test_mlflow.py @@ -20,7 +20,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.loggers import _MLFLOW_AVAILABLE, MLFlowLogger from pytorch_lightning.loggers.mlflow import MLFLOW_RUN_NAME, resolve_tags -from tests.helpers import BoringModel +from unittests.helpers import BoringModel def mock_mlflow_run_creation(logger, experiment_name=None, experiment_id=None, run_id=None): diff --git a/test/tests/loggers/test_neptune.py b/test/unittests/loggers/test_neptune.py similarity index 99% rename from test/tests/loggers/test_neptune.py rename to test/unittests/loggers/test_neptune.py index 87e52159b61d6..528ca53f909e7 100644 --- a/test/tests/loggers/test_neptune.py +++ b/test/unittests/loggers/test_neptune.py @@ -22,7 +22,7 @@ from pytorch_lightning import __version__, Trainer from pytorch_lightning.loggers import NeptuneLogger -from tests.helpers import BoringModel +from unittests.helpers import BoringModel def fetchable_paths(value): diff --git a/test/tests/loggers/test_tensorboard.py b/test/unittests/loggers/test_tensorboard.py similarity index 99% rename from test/tests/loggers/test_tensorboard.py rename to test/unittests/loggers/test_tensorboard.py index 1c3af727a745f..cb058d0ca85c3 100644 --- a/test/tests/loggers/test_tensorboard.py +++ b/test/unittests/loggers/test_tensorboard.py @@ -25,8 +25,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.loggers import TensorBoardLogger from pytorch_lightning.utilities.imports import _compare_version, _OMEGACONF_AVAILABLE -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf if _OMEGACONF_AVAILABLE: from omegaconf import OmegaConf diff --git a/test/tests/loggers/test_wandb.py b/test/unittests/loggers/test_wandb.py similarity index 99% rename from test/tests/loggers/test_wandb.py rename to test/unittests/loggers/test_wandb.py index adb91aab6da32..d0416e45b86c7 100644 --- a/test/tests/loggers/test_wandb.py +++ b/test/unittests/loggers/test_wandb.py @@ -20,8 +20,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.loggers import WandbLogger from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel -from tests.helpers.utils import no_warning_call +from unittests.helpers import BoringModel +from unittests.helpers.utils import no_warning_call @mock.patch("pytorch_lightning.loggers.wandb.wandb") diff --git a/test/tests/loops/__init__.py b/test/unittests/loops/__init__.py similarity index 100% rename from test/tests/loops/__init__.py rename to test/unittests/loops/__init__.py diff --git a/test/tests/loops/batch/__init__.py b/test/unittests/loops/batch/__init__.py similarity index 100% rename from test/tests/loops/batch/__init__.py rename to test/unittests/loops/batch/__init__.py diff --git a/test/tests/loops/batch/test_truncated_bptt.py b/test/unittests/loops/batch/test_truncated_bptt.py similarity index 100% rename from test/tests/loops/batch/test_truncated_bptt.py rename to test/unittests/loops/batch/test_truncated_bptt.py diff --git a/test/tests/loops/epoch/__init__.py b/test/unittests/loops/epoch/__init__.py similarity index 100% rename from test/tests/loops/epoch/__init__.py rename to test/unittests/loops/epoch/__init__.py diff --git a/test/tests/loops/epoch/test_training_epoch_loop.py b/test/unittests/loops/epoch/test_training_epoch_loop.py similarity index 99% rename from test/tests/loops/epoch/test_training_epoch_loop.py rename to test/unittests/loops/epoch/test_training_epoch_loop.py index d6f6a906cc053..25096971b95ce 100644 --- a/test/tests/loops/epoch/test_training_epoch_loop.py +++ b/test/unittests/loops/epoch/test_training_epoch_loop.py @@ -19,8 +19,8 @@ from pytorch_lightning import LightningModule from pytorch_lightning.loops import TrainingEpochLoop from pytorch_lightning.trainer.trainer import Trainer -from tests.deprecated_api import no_deprecated_call -from tests.helpers.boring_model import BoringModel +from unittests.deprecated_api import no_deprecated_call +from unittests.helpers.boring_model import BoringModel _out00 = {"loss": 0.0} _out01 = {"loss": 0.1} diff --git a/test/tests/loops/optimization/__init__.py b/test/unittests/loops/optimization/__init__.py similarity index 100% rename from test/tests/loops/optimization/__init__.py rename to test/unittests/loops/optimization/__init__.py diff --git a/test/tests/loops/optimization/test_closure.py b/test/unittests/loops/optimization/test_closure.py similarity index 97% rename from test/tests/loops/optimization/test_closure.py rename to test/unittests/loops/optimization/test_closure.py index 996d9d83b9948..306ae143a894e 100644 --- a/test/tests/loops/optimization/test_closure.py +++ b/test/unittests/loops/optimization/test_closure.py @@ -16,7 +16,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel +from unittests.helpers import BoringModel def test_optimizer_step_no_closure_raises(tmpdir): diff --git a/test/tests/loops/optimization/test_manual_loop.py b/test/unittests/loops/optimization/test_manual_loop.py similarity index 97% rename from test/tests/loops/optimization/test_manual_loop.py rename to test/unittests/loops/optimization/test_manual_loop.py index 04b517eb99334..ec7006c82d4da 100644 --- a/test/tests/loops/optimization/test_manual_loop.py +++ b/test/unittests/loops/optimization/test_manual_loop.py @@ -17,7 +17,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.loops.optimization.manual_loop import ManualResult from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel +from unittests.helpers import BoringModel def test_manual_result(): diff --git a/test/tests/loops/optimization/test_optimizer_loop.py b/test/unittests/loops/optimization/test_optimizer_loop.py similarity index 99% rename from test/tests/loops/optimization/test_optimizer_loop.py rename to test/unittests/loops/optimization/test_optimizer_loop.py index d04cc7343c9eb..f59db8d4159fa 100644 --- a/test/tests/loops/optimization/test_optimizer_loop.py +++ b/test/unittests/loops/optimization/test_optimizer_loop.py @@ -23,7 +23,7 @@ from pytorch_lightning.core.optimizer import LightningOptimizer from pytorch_lightning.loops.optimization.optimizer_loop import ClosureResult from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel +from unittests.helpers import BoringModel def test_closure_result_deepcopy(): diff --git a/test/tests/loops/test_all.py b/test/unittests/loops/test_all.py similarity index 97% rename from test/tests/loops/test_all.py rename to test/unittests/loops/test_all.py index e1a5db3082ed1..877ea288e82ce 100644 --- a/test/tests/loops/test_all.py +++ b/test/unittests/loops/test_all.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. from pytorch_lightning import Callback, Trainer -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf class BatchHookObserverCallback(Callback): diff --git a/test/tests/loops/test_evaluation_loop.py b/test/unittests/loops/test_evaluation_loop.py similarity index 98% rename from test/tests/loops/test_evaluation_loop.py rename to test/unittests/loops/test_evaluation_loop.py index 01a75fa8d2456..1dffb9f456baa 100644 --- a/test/tests/loops/test_evaluation_loop.py +++ b/test/unittests/loops/test_evaluation_loop.py @@ -21,8 +21,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.loops import EvaluationEpochLoop from pytorch_lightning.utilities.model_helpers import is_overridden -from tests.helpers.boring_model import BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf @mock.patch("pytorch_lightning.loops.dataloader.evaluation_loop.EvaluationLoop._on_evaluation_epoch_end") diff --git a/test/tests/loops/test_evaluation_loop_flow.py b/test/unittests/loops/test_evaluation_loop_flow.py similarity index 99% rename from test/tests/loops/test_evaluation_loop_flow.py rename to test/unittests/loops/test_evaluation_loop_flow.py index 07a24ee3e20b0..cf35e4e3fda90 100644 --- a/test/tests/loops/test_evaluation_loop_flow.py +++ b/test/unittests/loops/test_evaluation_loop_flow.py @@ -18,7 +18,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.core.module import LightningModule from pytorch_lightning.trainer.states import RunningStage -from tests.helpers.deterministic_model import DeterministicModel +from unittests.helpers.deterministic_model import DeterministicModel def test__eval_step__flow(tmpdir): diff --git a/test/tests/loops/test_flow_warnings.py b/test/unittests/loops/test_flow_warnings.py similarity index 95% rename from test/tests/loops/test_flow_warnings.py rename to test/unittests/loops/test_flow_warnings.py index 02cdf309f6801..67a8207d867bf 100644 --- a/test/tests/loops/test_flow_warnings.py +++ b/test/unittests/loops/test_flow_warnings.py @@ -14,7 +14,7 @@ import warnings from pytorch_lightning import Trainer -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel class TestModel(BoringModel): diff --git a/test/tests/loops/test_loop_state_dict.py b/test/unittests/loops/test_loop_state_dict.py similarity index 100% rename from test/tests/loops/test_loop_state_dict.py rename to test/unittests/loops/test_loop_state_dict.py diff --git a/test/tests/loops/test_loops.py b/test/unittests/loops/test_loops.py similarity index 99% rename from test/tests/loops/test_loops.py rename to test/unittests/loops/test_loops.py index 792cac22a394e..1f97ed29b6d38 100644 --- a/test/tests/loops/test_loops.py +++ b/test/unittests/loops/test_loops.py @@ -27,8 +27,8 @@ from pytorch_lightning.loops import EvaluationLoop, Loop, TrainingBatchLoop, TrainingEpochLoop from pytorch_lightning.trainer.progress import BaseProgress from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf class NestedLoop(Loop): diff --git a/test/tests/loops/test_training_loop.py b/test/unittests/loops/test_training_loop.py similarity index 99% rename from test/tests/loops/test_training_loop.py rename to test/unittests/loops/test_training_loop.py index 3de02d5f8bb1c..6c612e5472aa4 100644 --- a/test/tests/loops/test_training_loop.py +++ b/test/unittests/loops/test_training_loop.py @@ -15,7 +15,7 @@ import torch from pytorch_lightning import seed_everything, Trainer -from tests.helpers import BoringModel +from unittests.helpers import BoringModel def test_outputs_format(tmpdir): diff --git a/test/tests/loops/test_training_loop_flow_dict.py b/test/unittests/loops/test_training_loop_flow_dict.py similarity index 98% rename from test/tests/loops/test_training_loop_flow_dict.py rename to test/unittests/loops/test_training_loop_flow_dict.py index e04ca4c55c6fc..b5311946c3d11 100644 --- a/test/tests/loops/test_training_loop_flow_dict.py +++ b/test/unittests/loops/test_training_loop_flow_dict.py @@ -17,7 +17,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.core.module import LightningModule -from tests.helpers.deterministic_model import DeterministicModel +from unittests.helpers.deterministic_model import DeterministicModel def test__training_step__flow_dict(tmpdir): diff --git a/test/tests/loops/test_training_loop_flow_scalar.py b/test/unittests/loops/test_training_loop_flow_scalar.py similarity index 98% rename from test/tests/loops/test_training_loop_flow_scalar.py rename to test/unittests/loops/test_training_loop_flow_scalar.py index 20f5d917d97c9..bdfcfa7756be1 100644 --- a/test/tests/loops/test_training_loop_flow_scalar.py +++ b/test/unittests/loops/test_training_loop_flow_scalar.py @@ -20,9 +20,9 @@ from pytorch_lightning.core.module import LightningModule from pytorch_lightning.loops.optimization.optimizer_loop import Closure from pytorch_lightning.trainer.states import RunningStage -from tests.helpers.boring_model import BoringModel, RandomDataset -from tests.helpers.deterministic_model import DeterministicModel -from tests.helpers.utils import no_warning_call +from unittests.helpers.boring_model import BoringModel, RandomDataset +from unittests.helpers.deterministic_model import DeterministicModel +from unittests.helpers.utils import no_warning_call def test__training_step__flow_scalar(tmpdir): diff --git a/test/tests/loops/test_utilities.py b/test/unittests/loops/test_utilities.py similarity index 100% rename from test/tests/loops/test_utilities.py rename to test/unittests/loops/test_utilities.py diff --git a/test/tests/models/__init__.py b/test/unittests/models/__init__.py similarity index 100% rename from test/tests/models/__init__.py rename to test/unittests/models/__init__.py diff --git a/test/tests/models/conf/config.yaml b/test/unittests/models/conf/config.yaml similarity index 100% rename from test/tests/models/conf/config.yaml rename to test/unittests/models/conf/config.yaml diff --git a/test/tests/models/conf/training/default.yaml b/test/unittests/models/conf/training/default.yaml similarity index 100% rename from test/tests/models/conf/training/default.yaml rename to test/unittests/models/conf/training/default.yaml diff --git a/test/tests/models/data/__init__.py b/test/unittests/models/data/__init__.py similarity index 100% rename from test/tests/models/data/__init__.py rename to test/unittests/models/data/__init__.py diff --git a/test/tests/models/data/horovod/__init__.py b/test/unittests/models/data/horovod/__init__.py similarity index 100% rename from test/tests/models/data/horovod/__init__.py rename to test/unittests/models/data/horovod/__init__.py diff --git a/test/tests/models/data/horovod/test_train_script.py b/test/unittests/models/data/horovod/test_train_script.py similarity index 92% rename from test/tests/models/data/horovod/test_train_script.py rename to test/unittests/models/data/horovod/test_train_script.py index 1d32b9ce9d29a..50da1c2c6c3ed 100644 --- a/test/tests/models/data/horovod/test_train_script.py +++ b/test/unittests/models/data/horovod/test_train_script.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from tests.models.data.horovod.train_default_model import run_test_from_config +from unittests.models.data.horovod.train_default_model import run_test_from_config def test_horovod_model_script(tmpdir): diff --git a/test/tests/models/data/horovod/train_default_model.py b/test/unittests/models/data/horovod/train_default_model.py similarity index 96% rename from test/tests/models/data/horovod/train_default_model.py rename to test/unittests/models/data/horovod/train_default_model.py index ab692d379a7f2..65e016372104c 100644 --- a/test/tests/models/data/horovod/train_default_model.py +++ b/test/unittests/models/data/horovod/train_default_model.py @@ -36,8 +36,8 @@ else: print("You requested to import Horovod which is missing or not supported for your OS.") -from tests.helpers import BoringModel # noqa: E402 -from tests.helpers.utils import reset_seed, set_random_main_port # noqa: E402 +from unittests.helpers import BoringModel # noqa: E402 +from unittests.helpers.utils import reset_seed, set_random_main_port # noqa: E402 parser = argparse.ArgumentParser() parser.add_argument("--trainer-options", required=True) diff --git a/test/tests/models/test_amp.py b/test/unittests/models/test_amp.py similarity index 98% rename from test/tests/models/test_amp.py rename to test/unittests/models/test_amp.py index e391321de18fb..708deb730fb89 100644 --- a/test/tests/models/test_amp.py +++ b/test/unittests/models/test_amp.py @@ -19,11 +19,11 @@ from torch import optim from torch.utils.data import DataLoader -import tests.helpers.utils as tutils +import unittests.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.plugins.environments import SLURMEnvironment -from tests.helpers import BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf class AMPTestModel(BoringModel): diff --git a/test/tests/models/test_cpu.py b/test/unittests/models/test_cpu.py similarity index 96% rename from test/tests/models/test_cpu.py rename to test/unittests/models/test_cpu.py index 48359522b7030..49670e4dc2d86 100644 --- a/test/tests/models/test_cpu.py +++ b/test/unittests/models/test_cpu.py @@ -15,14 +15,14 @@ import torch -import tests.helpers.pipelines as tpipes -import tests.helpers.utils as tutils +import unittests.helpers.pipelines as tpipes +import unittests.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.callbacks import Callback, EarlyStopping, ModelCheckpoint -from tests.helpers import BoringModel -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.runif import RunIf -from tests.helpers.simple_models import ClassificationModel +from unittests.helpers import BoringModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.runif import RunIf +from unittests.helpers.simple_models import ClassificationModel def test_cpu_slurm_save_load(tmpdir): diff --git a/test/tests/models/test_gpu.py b/test/unittests/models/test_gpu.py similarity index 96% rename from test/tests/models/test_gpu.py rename to test/unittests/models/test_gpu.py index fd3cc14945144..b408d3c26e7de 100644 --- a/test/tests/models/test_gpu.py +++ b/test/unittests/models/test_gpu.py @@ -20,19 +20,19 @@ import pytest import torch -import tests.helpers.pipelines as tpipes -import tests.helpers.utils as tutils +import unittests.helpers.pipelines as tpipes +import unittests.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.accelerators import CPUAccelerator, GPUAccelerator from pytorch_lightning.plugins.environments import TorchElasticEnvironment from pytorch_lightning.utilities import device_parser from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.imports import _compare_version, _TORCHTEXT_LEGACY -from tests.helpers import BoringModel -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.imports import Batch, Dataset, Example, Field, LabelField -from tests.helpers.runif import RunIf -from tests.helpers.simple_models import ClassificationModel +from unittests.helpers import BoringModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.imports import Batch, Dataset, Example, Field, LabelField +from unittests.helpers.runif import RunIf +from unittests.helpers.simple_models import ClassificationModel PL_VERSION_LT_1_5 = _compare_version("pytorch_lightning", operator.lt, "1.5") PRETEND_N_OF_GPUS = 16 diff --git a/test/tests/models/test_grad_norm.py b/test/unittests/models/test_grad_norm.py similarity index 97% rename from test/tests/models/test_grad_norm.py rename to test/unittests/models/test_grad_norm.py index ae8494b6c672e..f01937ca2fadd 100644 --- a/test/tests/models/test_grad_norm.py +++ b/test/unittests/models/test_grad_norm.py @@ -17,8 +17,8 @@ import pytest from pytorch_lightning import Trainer -from tests.helpers import BoringModel -from tests.helpers.utils import reset_seed +from unittests.helpers import BoringModel +from unittests.helpers.utils import reset_seed class ModelWithManualGradTracker(BoringModel): diff --git a/test/tests/models/test_hooks.py b/test/unittests/models/test_hooks.py similarity index 99% rename from test/tests/models/test_hooks.py rename to test/unittests/models/test_hooks.py index 5f33fd8a6654a..66be46ab87124 100644 --- a/test/tests/models/test_hooks.py +++ b/test/unittests/models/test_hooks.py @@ -21,8 +21,8 @@ from torch.utils.data import DataLoader from pytorch_lightning import __version__, Callback, LightningDataModule, LightningModule, Trainer -from tests.helpers import BoringDataModule, BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers import BoringDataModule, BoringModel, RandomDataset +from unittests.helpers.runif import RunIf @pytest.mark.parametrize("max_steps", [1, 2, 3]) diff --git a/test/tests/models/test_horovod.py b/test/unittests/models/test_horovod.py similarity index 98% rename from test/tests/models/test_horovod.py rename to test/unittests/models/test_horovod.py index 14a652ce0c8e2..6da2f0d54ff30 100644 --- a/test/tests/models/test_horovod.py +++ b/test/unittests/models/test_horovod.py @@ -25,15 +25,15 @@ from torch import optim from torchmetrics.classification.accuracy import Accuracy -import tests.helpers.pipelines as tpipes -import tests.helpers.utils as tutils +import unittests.helpers.pipelines as tpipes +import unittests.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.accelerators import CPUAccelerator from pytorch_lightning.utilities import _HOROVOD_AVAILABLE from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel -from tests.helpers.advanced_models import BasicGAN -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.advanced_models import BasicGAN +from unittests.helpers.runif import RunIf if _HOROVOD_AVAILABLE: import horovod @@ -42,7 +42,7 @@ @RunIf(min_cuda_gpus=1, horovod=True) def test_nccl_is_available_on_gpu_environment(): - from tests.helpers.runif import _HOROVOD_NCCL_AVAILABLE + from unittests.helpers.runif import _HOROVOD_NCCL_AVAILABLE # the GPU environment should always install Horovod NCCL assert _HOROVOD_NCCL_AVAILABLE diff --git a/test/tests/models/test_hparams.py b/test/unittests/models/test_hparams.py similarity index 99% rename from test/tests/models/test_hparams.py rename to test/unittests/models/test_hparams.py index b09a816d11d72..51e0cefd96281 100644 --- a/test/tests/models/test_hparams.py +++ b/test/unittests/models/test_hparams.py @@ -32,10 +32,10 @@ from pytorch_lightning.core.saving import load_hparams_from_yaml, save_hparams_to_yaml from pytorch_lightning.utilities import _HYDRA_EXPERIMENTAL_AVAILABLE, _OMEGACONF_AVAILABLE, AttributeDict, is_picklable from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel, RandomDataset -from tests.helpers.boring_model import BoringDataModule -from tests.helpers.runif import RunIf -from tests.helpers.utils import no_warning_call +from unittests.helpers import BoringModel, RandomDataset +from unittests.helpers.boring_model import BoringDataModule +from unittests.helpers.runif import RunIf +from unittests.helpers.utils import no_warning_call if _HYDRA_EXPERIMENTAL_AVAILABLE: from hydra.experimental import compose, initialize diff --git a/test/tests/models/test_onnx.py b/test/unittests/models/test_onnx.py similarity index 95% rename from test/tests/models/test_onnx.py rename to test/unittests/models/test_onnx.py index 7b305b768074b..1dea692bd474c 100644 --- a/test/tests/models/test_onnx.py +++ b/test/unittests/models/test_onnx.py @@ -18,12 +18,12 @@ import pytest import torch -import tests.helpers.pipelines as tpipes -import tests.helpers.utils as tutils +import unittests.helpers.pipelines as tpipes +import unittests.helpers.utils as tutils from pytorch_lightning import Trainer -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf -from tests.utilities.test_model_summary import UnorderedModel +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf +from unittests.utilities.test_model_summary import UnorderedModel def test_model_saves_with_input_sample(tmpdir): diff --git a/test/tests/models/test_restore.py b/test/unittests/models/test_restore.py similarity index 98% rename from test/tests/models/test_restore.py rename to test/unittests/models/test_restore.py index 149d96385987b..f2c00a01443b4 100644 --- a/test/tests/models/test_restore.py +++ b/test/unittests/models/test_restore.py @@ -24,16 +24,16 @@ import torch import torch.nn.functional as F -import tests.helpers.pipelines as tpipes -import tests.helpers.utils as tutils +import unittests.helpers.pipelines as tpipes +import unittests.helpers.utils as tutils from pytorch_lightning import Callback, Trainer from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.trainer.states import TrainerFn -from tests.helpers import BoringModel -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.runif import RunIf -from tests.helpers.simple_models import ClassificationModel -from tests.loops.test_loops import CustomException +from unittests.helpers import BoringModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.runif import RunIf +from unittests.helpers.simple_models import ClassificationModel +from unittests.loops.test_loops import CustomException class ModelTrainerPropertyParity(Callback): diff --git a/test/tests/models/test_torchscript.py b/test/unittests/models/test_torchscript.py similarity index 97% rename from test/tests/models/test_torchscript.py rename to test/unittests/models/test_torchscript.py index 6b82eca43aab9..d7d0b26247767 100644 --- a/test/tests/models/test_torchscript.py +++ b/test/unittests/models/test_torchscript.py @@ -20,9 +20,9 @@ from fsspec.implementations.local import LocalFileSystem from pytorch_lightning.utilities.cloud_io import get_filesystem -from tests.helpers import BoringModel -from tests.helpers.advanced_models import BasicGAN, ParityModuleRNN -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.advanced_models import BasicGAN, ParityModuleRNN +from unittests.helpers.runif import RunIf @pytest.mark.parametrize("modelclass", [BoringModel, ParityModuleRNN, BasicGAN]) diff --git a/test/tests/models/test_tpu.py b/test/unittests/models/test_tpu.py similarity index 98% rename from test/tests/models/test_tpu.py rename to test/unittests/models/test_tpu.py index 82f10875a1dec..2ee217447c01e 100644 --- a/test/tests/models/test_tpu.py +++ b/test/unittests/models/test_tpu.py @@ -19,8 +19,8 @@ import torch from torch.utils.data import DataLoader -import tests.helpers.pipelines as tpipes -import tests.helpers.utils as tutils +import unittests.helpers.pipelines as tpipes +import unittests.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.accelerators import TPUAccelerator from pytorch_lightning.callbacks import EarlyStopping @@ -29,9 +29,9 @@ from pytorch_lightning.utilities import _TPU_AVAILABLE from pytorch_lightning.utilities.distributed import ReduceOp from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel, RandomDataset -from tests.helpers.runif import RunIf -from tests.helpers.utils import pl_multi_process_test +from unittests.helpers import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf +from unittests.helpers.utils import pl_multi_process_test if _TPU_AVAILABLE: import torch_xla diff --git a/test/tests/overrides/__init__.py b/test/unittests/overrides/__init__.py similarity index 100% rename from test/tests/overrides/__init__.py rename to test/unittests/overrides/__init__.py diff --git a/test/tests/overrides/test_base.py b/test/unittests/overrides/test_base.py similarity index 97% rename from test/tests/overrides/test_base.py rename to test/unittests/overrides/test_base.py index 4b76fd028af66..b1847e20c5da2 100644 --- a/test/tests/overrides/test_base.py +++ b/test/unittests/overrides/test_base.py @@ -20,7 +20,7 @@ _LightningPrecisionModuleWrapperBase, unwrap_lightning_module, ) -from tests.helpers import BoringModel +from unittests.helpers import BoringModel @pytest.mark.parametrize("wrapper_class", [_LightningModuleWrapperBase, _LightningPrecisionModuleWrapperBase]) diff --git a/test/tests/overrides/test_data_parallel.py b/test/unittests/overrides/test_data_parallel.py similarity index 98% rename from test/tests/overrides/test_data_parallel.py rename to test/unittests/overrides/test_data_parallel.py index 0bc6646c7ccd2..d415e11b22aa9 100644 --- a/test/tests/overrides/test_data_parallel.py +++ b/test/unittests/overrides/test_data_parallel.py @@ -26,8 +26,8 @@ unsqueeze_scalar_tensor, ) from pytorch_lightning.trainer.states import RunningStage -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf @pytest.mark.parametrize("wrapper_class", [LightningParallelModule, LightningDistributedModule]) diff --git a/test/tests/overrides/test_distributed.py b/test/unittests/overrides/test_distributed.py similarity index 100% rename from test/tests/overrides/test_distributed.py rename to test/unittests/overrides/test_distributed.py diff --git a/test/tests/plugins/__init__.py b/test/unittests/plugins/__init__.py similarity index 100% rename from test/tests/plugins/__init__.py rename to test/unittests/plugins/__init__.py diff --git a/test/tests/plugins/environments/__init__.py b/test/unittests/plugins/environments/__init__.py similarity index 100% rename from test/tests/plugins/environments/__init__.py rename to test/unittests/plugins/environments/__init__.py diff --git a/test/tests/plugins/environments/test_kubeflow_environment.py b/test/unittests/plugins/environments/test_kubeflow_environment.py similarity index 100% rename from test/tests/plugins/environments/test_kubeflow_environment.py rename to test/unittests/plugins/environments/test_kubeflow_environment.py diff --git a/test/tests/plugins/environments/test_lightning_environment.py b/test/unittests/plugins/environments/test_lightning_environment.py similarity index 100% rename from test/tests/plugins/environments/test_lightning_environment.py rename to test/unittests/plugins/environments/test_lightning_environment.py diff --git a/test/tests/plugins/environments/test_lsf_environment.py b/test/unittests/plugins/environments/test_lsf_environment.py similarity index 100% rename from test/tests/plugins/environments/test_lsf_environment.py rename to test/unittests/plugins/environments/test_lsf_environment.py diff --git a/test/tests/plugins/environments/test_slurm_environment.py b/test/unittests/plugins/environments/test_slurm_environment.py similarity index 100% rename from test/tests/plugins/environments/test_slurm_environment.py rename to test/unittests/plugins/environments/test_slurm_environment.py diff --git a/test/tests/plugins/environments/test_torchelastic_environment.py b/test/unittests/plugins/environments/test_torchelastic_environment.py similarity index 98% rename from test/tests/plugins/environments/test_torchelastic_environment.py rename to test/unittests/plugins/environments/test_torchelastic_environment.py index 9b9d83a4d84e5..c590486ba11f1 100644 --- a/test/tests/plugins/environments/test_torchelastic_environment.py +++ b/test/unittests/plugins/environments/test_torchelastic_environment.py @@ -18,7 +18,7 @@ import pytest from pytorch_lightning.plugins.environments import TorchElasticEnvironment -from tests.helpers.runif import RunIf +from unittests.helpers.runif import RunIf @mock.patch.dict(os.environ, {}, clear=True) diff --git a/test/tests/plugins/environments/torch_elastic_deadlock.py b/test/unittests/plugins/environments/torch_elastic_deadlock.py similarity index 95% rename from test/tests/plugins/environments/torch_elastic_deadlock.py rename to test/unittests/plugins/environments/torch_elastic_deadlock.py index 287f1b00bb2a0..4913f33bafd38 100644 --- a/test/tests/plugins/environments/torch_elastic_deadlock.py +++ b/test/unittests/plugins/environments/torch_elastic_deadlock.py @@ -5,7 +5,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.strategies.ddp import DDPStrategy from pytorch_lightning.utilities.exceptions import DeadlockDetectedException -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel if os.getenv("PL_RUN_STANDALONE_TESTS", "0") == "1" and os.getenv("PL_RECONCILE_PROCESS", "0") == "1": diff --git a/test/tests/plugins/precision/__init__.py b/test/unittests/plugins/precision/__init__.py similarity index 100% rename from test/tests/plugins/precision/__init__.py rename to test/unittests/plugins/precision/__init__.py diff --git a/test/tests/plugins/precision/hpu/ops_bf16.txt b/test/unittests/plugins/precision/hpu/ops_bf16.txt similarity index 100% rename from test/tests/plugins/precision/hpu/ops_bf16.txt rename to test/unittests/plugins/precision/hpu/ops_bf16.txt diff --git a/test/tests/plugins/precision/hpu/ops_fp32.txt b/test/unittests/plugins/precision/hpu/ops_fp32.txt similarity index 100% rename from test/tests/plugins/precision/hpu/ops_fp32.txt rename to test/unittests/plugins/precision/hpu/ops_fp32.txt diff --git a/test/tests/plugins/precision/hpu/test_hpu.py b/test/unittests/plugins/precision/hpu/test_hpu.py similarity index 97% rename from test/tests/plugins/precision/hpu/test_hpu.py rename to test/unittests/plugins/precision/hpu/test_hpu.py index 5701bf2dc2caa..7be34493e59da 100644 --- a/test/tests/plugins/precision/hpu/test_hpu.py +++ b/test/unittests/plugins/precision/hpu/test_hpu.py @@ -19,8 +19,8 @@ from pytorch_lightning import Callback, LightningModule, Trainer from pytorch_lightning.plugins import HPUPrecisionPlugin from pytorch_lightning.strategies.single_hpu import SingleHPUStrategy -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf @pytest.fixture diff --git a/test/tests/plugins/precision/test_deepspeed_precision.py b/test/unittests/plugins/precision/test_deepspeed_precision.py similarity index 100% rename from test/tests/plugins/precision/test_deepspeed_precision.py rename to test/unittests/plugins/precision/test_deepspeed_precision.py diff --git a/test/tests/plugins/precision/test_sharded_precision.py b/test/unittests/plugins/precision/test_sharded_precision.py similarity index 97% rename from test/tests/plugins/precision/test_sharded_precision.py rename to test/unittests/plugins/precision/test_sharded_precision.py index 754095912fb53..3734d1ca3c1e9 100644 --- a/test/tests/plugins/precision/test_sharded_precision.py +++ b/test/unittests/plugins/precision/test_sharded_precision.py @@ -17,7 +17,7 @@ from pytorch_lightning.plugins import ShardedNativeMixedPrecisionPlugin from pytorch_lightning.utilities import _FAIRSCALE_AVAILABLE -from tests.helpers.runif import RunIf +from unittests.helpers.runif import RunIf ShardedGradScaler = None if _FAIRSCALE_AVAILABLE: diff --git a/test/tests/plugins/precision/test_tpu_bf16_plugin.py b/test/unittests/plugins/precision/test_tpu_bf16_plugin.py similarity index 100% rename from test/tests/plugins/precision/test_tpu_bf16_plugin.py rename to test/unittests/plugins/precision/test_tpu_bf16_plugin.py diff --git a/test/tests/plugins/test_amp_plugins.py b/test/unittests/plugins/test_amp_plugins.py similarity index 99% rename from test/tests/plugins/test_amp_plugins.py rename to test/unittests/plugins/test_amp_plugins.py index c71041fc335b9..36cffc5931e1d 100644 --- a/test/tests/plugins/test_amp_plugins.py +++ b/test/unittests/plugins/test_amp_plugins.py @@ -21,8 +21,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.plugins import ApexMixedPrecisionPlugin, NativeMixedPrecisionPlugin from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf class MyNativeAMP(NativeMixedPrecisionPlugin): diff --git a/test/tests/plugins/test_checkpoint_io_plugin.py b/test/unittests/plugins/test_checkpoint_io_plugin.py similarity index 98% rename from test/tests/plugins/test_checkpoint_io_plugin.py rename to test/unittests/plugins/test_checkpoint_io_plugin.py index 4ac26261e5682..1918428433c2d 100644 --- a/test/tests/plugins/test_checkpoint_io_plugin.py +++ b/test/unittests/plugins/test_checkpoint_io_plugin.py @@ -22,7 +22,7 @@ from pytorch_lightning.plugins import CheckpointIO from pytorch_lightning.strategies import SingleDeviceStrategy from pytorch_lightning.utilities.types import _PATH -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel class CustomCheckpointIO(CheckpointIO): diff --git a/test/tests/plugins/test_cluster_integration.py b/test/unittests/plugins/test_cluster_integration.py similarity index 99% rename from test/tests/plugins/test_cluster_integration.py rename to test/unittests/plugins/test_cluster_integration.py index ad99087fd8b5b..d34643779bdb5 100644 --- a/test/tests/plugins/test_cluster_integration.py +++ b/test/unittests/plugins/test_cluster_integration.py @@ -21,7 +21,7 @@ from pytorch_lightning.plugins.environments import LightningEnvironment, SLURMEnvironment, TorchElasticEnvironment from pytorch_lightning.strategies import DDP2Strategy, DDPShardedStrategy, DDPStrategy, DeepSpeedStrategy from pytorch_lightning.utilities.rank_zero import rank_zero_only -from tests.helpers.runif import RunIf +from unittests.helpers.runif import RunIf def environment_combinations(): diff --git a/test/tests/plugins/test_double_plugin.py b/test/unittests/plugins/test_double_plugin.py similarity index 98% rename from test/tests/plugins/test_double_plugin.py rename to test/unittests/plugins/test_double_plugin.py index afa57bf666818..0d7731b6afa88 100644 --- a/test/tests/plugins/test_double_plugin.py +++ b/test/unittests/plugins/test_double_plugin.py @@ -20,8 +20,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.plugins import DoublePrecisionPlugin -from tests.helpers.boring_model import BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf class RandomFloatIntDataset(Dataset): diff --git a/test/tests/profiler/__init__.py b/test/unittests/profiler/__init__.py similarity index 100% rename from test/tests/profiler/__init__.py rename to test/unittests/profiler/__init__.py diff --git a/test/tests/profiler/test_profiler.py b/test/unittests/profiler/test_profiler.py similarity index 99% rename from test/tests/profiler/test_profiler.py rename to test/unittests/profiler/test_profiler.py index ab1cf7c8ab7f9..35081dc248f34 100644 --- a/test/tests/profiler/test_profiler.py +++ b/test/unittests/profiler/test_profiler.py @@ -29,8 +29,8 @@ from pytorch_lightning.profiler.pytorch import RegisterRecordFunction, warning_cache from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.imports import _KINETO_AVAILABLE -from tests.helpers import BoringModel, ManualOptimBoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel, ManualOptimBoringModel +from unittests.helpers.runif import RunIf PROFILER_OVERHEAD_MAX_TOLERANCE = 0.0005 diff --git a/test/tests/profiler/test_xla_profiler.py b/test/unittests/profiler/test_xla_profiler.py similarity index 95% rename from test/tests/profiler/test_xla_profiler.py rename to test/unittests/profiler/test_xla_profiler.py index d2234c56b7fe7..cac7ac711f70e 100644 --- a/test/tests/profiler/test_xla_profiler.py +++ b/test/unittests/profiler/test_xla_profiler.py @@ -19,8 +19,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.profiler import XLAProfiler from pytorch_lightning.utilities import _TPU_AVAILABLE -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf if _TPU_AVAILABLE: import torch_xla.debug.profiler as xp diff --git a/test/tests/strategies/__init__.py b/test/unittests/strategies/__init__.py similarity index 100% rename from test/tests/strategies/__init__.py rename to test/unittests/strategies/__init__.py diff --git a/test/tests/strategies/ddp_model.py b/test/unittests/strategies/ddp_model.py similarity index 93% rename from test/tests/strategies/ddp_model.py rename to test/unittests/strategies/ddp_model.py index c35e1475de309..28bd23a51d152 100644 --- a/test/tests/strategies/ddp_model.py +++ b/test/unittests/strategies/ddp_model.py @@ -18,8 +18,8 @@ import torch from pytorch_lightning import seed_everything, Trainer -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.simple_models import ClassificationModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.simple_models import ClassificationModel def main(): diff --git a/test/tests/strategies/test_bagua_strategy.py b/test/unittests/strategies/test_bagua_strategy.py similarity index 97% rename from test/tests/strategies/test_bagua_strategy.py rename to test/unittests/strategies/test_bagua_strategy.py index 40b2a964a5ad0..6fcbd81768f85 100644 --- a/test/tests/strategies/test_bagua_strategy.py +++ b/test/unittests/strategies/test_bagua_strategy.py @@ -20,8 +20,8 @@ from pytorch_lightning.strategies import BaguaStrategy from pytorch_lightning.trainer.states import TrainerFn from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf class BoringModel4QAdam(BoringModel): diff --git a/test/tests/strategies/test_collaborative.py b/test/unittests/strategies/test_collaborative.py similarity index 99% rename from test/tests/strategies/test_collaborative.py rename to test/unittests/strategies/test_collaborative.py index 89711fed27efc..3622d597bbb06 100644 --- a/test/tests/strategies/test_collaborative.py +++ b/test/unittests/strategies/test_collaborative.py @@ -17,8 +17,8 @@ from pytorch_lightning.utilities import _HIVEMIND_AVAILABLE from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.types import STEP_OUTPUT -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf if _HIVEMIND_AVAILABLE: import hivemind diff --git a/test/tests/strategies/test_common.py b/test/unittests/strategies/test_common.py similarity index 91% rename from test/tests/strategies/test_common.py rename to test/unittests/strategies/test_common.py index d9ef50da57a33..3296e1c0436be 100644 --- a/test/tests/strategies/test_common.py +++ b/test/unittests/strategies/test_common.py @@ -14,14 +14,14 @@ import pytest import torch -import tests.helpers.utils as tutils +import unittests.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.strategies import DDPStrategy from pytorch_lightning.utilities.seed import seed_everything -from tests.helpers.boring_model import BoringModel -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.runif import RunIf -from tests.strategies.test_dp import CustomClassificationModelDP +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.runif import RunIf +from unittests.strategies.test_dp import CustomClassificationModelDP @pytest.mark.parametrize( diff --git a/test/tests/strategies/test_custom_plugin.py b/test/unittests/strategies/test_custom_plugin.py similarity index 97% rename from test/tests/strategies/test_custom_plugin.py rename to test/unittests/strategies/test_custom_plugin.py index 7a8550627084e..b91423ff01218 100644 --- a/test/tests/strategies/test_custom_plugin.py +++ b/test/unittests/strategies/test_custom_plugin.py @@ -19,7 +19,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.strategies import SingleDeviceStrategy -from tests.helpers import BoringModel +from unittests.helpers import BoringModel @pytest.mark.parametrize("restore_optimizer_and_schedulers", [True, False]) diff --git a/test/tests/strategies/test_ddp.py b/test/unittests/strategies/test_ddp.py similarity index 97% rename from test/tests/strategies/test_ddp.py rename to test/unittests/strategies/test_ddp.py index 7eb383d3812da..94fc43c386138 100644 --- a/test/tests/strategies/test_ddp.py +++ b/test/unittests/strategies/test_ddp.py @@ -24,10 +24,10 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import Callback from pytorch_lightning.strategies import DDPStrategy -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf -from tests.strategies import ddp_model -from tests.utilities.distributed import call_training_script +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf +from unittests.strategies import ddp_model +from unittests.utilities.distributed import call_training_script CLI_ARGS = "--max_epochs 1 --accelerator gpu --devices 2 --strategy ddp" diff --git a/test/tests/strategies/test_ddp_fully_sharded_native.py b/test/unittests/strategies/test_ddp_fully_sharded_native.py similarity index 98% rename from test/tests/strategies/test_ddp_fully_sharded_native.py rename to test/unittests/strategies/test_ddp_fully_sharded_native.py index ab8e04b5f360b..5775351b143ed 100644 --- a/test/tests/strategies/test_ddp_fully_sharded_native.py +++ b/test/unittests/strategies/test_ddp_fully_sharded_native.py @@ -10,8 +10,8 @@ from pytorch_lightning.strategies import DDPFullyShardedNativeStrategy from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.imports import _TORCH_GREATER_EQUAL_1_12 -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf if _TORCH_GREATER_EQUAL_1_12: from torch.distributed.fsdp.fully_sharded_data_parallel import FullyShardedDataParallel diff --git a/test/tests/strategies/test_ddp_fully_sharded_with_full_state_dict.py b/test/unittests/strategies/test_ddp_fully_sharded_with_full_state_dict.py similarity index 98% rename from test/tests/strategies/test_ddp_fully_sharded_with_full_state_dict.py rename to test/unittests/strategies/test_ddp_fully_sharded_with_full_state_dict.py index 239ecf1c0923a..2d4ca824326be 100644 --- a/test/tests/strategies/test_ddp_fully_sharded_with_full_state_dict.py +++ b/test/unittests/strategies/test_ddp_fully_sharded_with_full_state_dict.py @@ -11,8 +11,8 @@ from pytorch_lightning.strategies import DDPFullyShardedStrategy from pytorch_lightning.utilities import _FAIRSCALE_FULLY_SHARDED_AVAILABLE from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf if _FAIRSCALE_FULLY_SHARDED_AVAILABLE: from fairscale.nn import FullyShardedDataParallel, wrap diff --git a/test/tests/strategies/test_ddp_spawn.py b/test/unittests/strategies/test_ddp_spawn.py similarity index 88% rename from test/tests/strategies/test_ddp_spawn.py rename to test/unittests/strategies/test_ddp_spawn.py index 3220095e1d064..8c1740de54e51 100644 --- a/test/tests/strategies/test_ddp_spawn.py +++ b/test/unittests/strategies/test_ddp_spawn.py @@ -11,14 +11,14 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import tests.helpers.pipelines as tpipes -import tests.helpers.utils as tutils +import unittests.helpers.pipelines as tpipes +import unittests.helpers.utils as tutils from pytorch_lightning.callbacks import EarlyStopping from pytorch_lightning.trainer import Trainer -from tests.helpers import BoringModel -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.runif import RunIf -from tests.helpers.simple_models import ClassificationModel +from unittests.helpers import BoringModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.runif import RunIf +from unittests.helpers.simple_models import ClassificationModel @RunIf(min_cuda_gpus=2) diff --git a/test/tests/strategies/test_ddp_spawn_strategy.py b/test/unittests/strategies/test_ddp_spawn_strategy.py similarity index 98% rename from test/tests/strategies/test_ddp_spawn_strategy.py rename to test/unittests/strategies/test_ddp_spawn_strategy.py index 5964a7cc39423..bb94acb92b01f 100644 --- a/test/tests/strategies/test_ddp_spawn_strategy.py +++ b/test/unittests/strategies/test_ddp_spawn_strategy.py @@ -22,8 +22,8 @@ from pytorch_lightning.strategies import DDPSpawnStrategy from pytorch_lightning.strategies.launchers.spawn import _SpawnLauncher from pytorch_lightning.trainer.states import TrainerFn -from tests.helpers.boring_model import BoringDataModule, BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringDataModule, BoringModel +from unittests.helpers.runif import RunIf class BoringModelDDPCPU(BoringModel): diff --git a/test/tests/strategies/test_ddp_strategy.py b/test/unittests/strategies/test_ddp_strategy.py similarity index 98% rename from test/tests/strategies/test_ddp_strategy.py rename to test/unittests/strategies/test_ddp_strategy.py index 5ee17e8a8d831..b4b9e7f34e361 100644 --- a/test/tests/strategies/test_ddp_strategy.py +++ b/test/unittests/strategies/test_ddp_strategy.py @@ -22,8 +22,8 @@ from pytorch_lightning.plugins.environments import ClusterEnvironment, LightningEnvironment from pytorch_lightning.strategies import DDPStrategy from pytorch_lightning.trainer.states import TrainerFn -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf class BoringModelGPU(BoringModel): diff --git a/test/tests/strategies/test_ddp_strategy_with_comm_hook.py b/test/unittests/strategies/test_ddp_strategy_with_comm_hook.py similarity index 99% rename from test/tests/strategies/test_ddp_strategy_with_comm_hook.py rename to test/unittests/strategies/test_ddp_strategy_with_comm_hook.py index f707741208aa7..0ae4ae6c6b2ef 100644 --- a/test/tests/strategies/test_ddp_strategy_with_comm_hook.py +++ b/test/unittests/strategies/test_ddp_strategy_with_comm_hook.py @@ -19,8 +19,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.strategies import DDPSpawnStrategy, DDPStrategy from pytorch_lightning.utilities import _TORCH_GREATER_EQUAL_1_10 -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf if torch.distributed.is_available(): from torch.distributed.algorithms.ddp_comm_hooks import default_hooks as default diff --git a/test/tests/strategies/test_deepspeed_strategy.py b/test/unittests/strategies/test_deepspeed_strategy.py similarity index 99% rename from test/tests/strategies/test_deepspeed_strategy.py rename to test/unittests/strategies/test_deepspeed_strategy.py index 86fb5396c25a5..bda5bb427d018 100644 --- a/test/tests/strategies/test_deepspeed_strategy.py +++ b/test/unittests/strategies/test_deepspeed_strategy.py @@ -38,9 +38,9 @@ _DEEPSPEED_GREATER_EQUAL_0_6, ) from pytorch_lightning.utilities.meta import init_meta_context -from tests.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.runif import RunIf if _DEEPSPEED_AVAILABLE: import deepspeed diff --git a/test/tests/strategies/test_dp.py b/test/unittests/strategies/test_dp.py similarity index 95% rename from test/tests/strategies/test_dp.py rename to test/unittests/strategies/test_dp.py index 07bf7097247a1..d8342e27c3456 100644 --- a/test/tests/strategies/test_dp.py +++ b/test/unittests/strategies/test_dp.py @@ -19,15 +19,15 @@ from torch.utils.data import DataLoader import pytorch_lightning as pl -import tests.helpers.pipelines as tpipes -import tests.helpers.utils as tutils +import unittests.helpers.pipelines as tpipes +import unittests.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.callbacks import EarlyStopping from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel, RandomDataset -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.runif import RunIf -from tests.helpers.simple_models import ClassificationModel +from unittests.helpers import BoringModel, RandomDataset +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.runif import RunIf +from unittests.helpers.simple_models import ClassificationModel class CustomClassificationModelDP(ClassificationModel): diff --git a/test/tests/strategies/test_sharded_strategy.py b/test/unittests/strategies/test_sharded_strategy.py similarity index 99% rename from test/tests/strategies/test_sharded_strategy.py rename to test/unittests/strategies/test_sharded_strategy.py index b433de7a08ff1..3673b467ba775 100644 --- a/test/tests/strategies/test_sharded_strategy.py +++ b/test/unittests/strategies/test_sharded_strategy.py @@ -9,8 +9,8 @@ from pytorch_lightning.strategies import DDPShardedStrategy, DDPSpawnShardedStrategy from pytorch_lightning.trainer.states import TrainerFn from pytorch_lightning.utilities import _FAIRSCALE_AVAILABLE -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf if _FAIRSCALE_AVAILABLE: from fairscale.nn.data_parallel.sharded_ddp import ShardedDataParallel diff --git a/test/tests/strategies/test_single_device_strategy.py b/test/unittests/strategies/test_single_device_strategy.py similarity index 96% rename from test/tests/strategies/test_single_device_strategy.py rename to test/unittests/strategies/test_single_device_strategy.py index babc710f0e65b..408bb22347048 100644 --- a/test/tests/strategies/test_single_device_strategy.py +++ b/test/unittests/strategies/test_single_device_strategy.py @@ -18,8 +18,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.core.optimizer import LightningOptimizer from pytorch_lightning.strategies import SingleDeviceStrategy -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf def test_single_cpu(): diff --git a/test/tests/strategies/test_strategy_registry.py b/test/unittests/strategies/test_strategy_registry.py similarity index 99% rename from test/tests/strategies/test_strategy_registry.py rename to test/unittests/strategies/test_strategy_registry.py index 89422b3719a29..3cbfaa2c9bbed 100644 --- a/test/tests/strategies/test_strategy_registry.py +++ b/test/unittests/strategies/test_strategy_registry.py @@ -25,7 +25,7 @@ StrategyRegistry, TPUSpawnStrategy, ) -from tests.helpers.runif import RunIf +from unittests.helpers.runif import RunIf def test_strategy_registry_with_new_strategy(): diff --git a/test/tests/strategies/test_tpu_spawn.py b/test/unittests/strategies/test_tpu_spawn.py similarity index 93% rename from test/tests/strategies/test_tpu_spawn.py rename to test/unittests/strategies/test_tpu_spawn.py index 407c8d646502d..b63bf4bfccb6a 100644 --- a/test/tests/strategies/test_tpu_spawn.py +++ b/test/unittests/strategies/test_tpu_spawn.py @@ -22,10 +22,10 @@ from pytorch_lightning import Trainer from pytorch_lightning.strategies import TPUSpawnStrategy from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel, RandomDataset -from tests.helpers.dataloaders import CustomNotImplementedErrorDataloader -from tests.helpers.runif import RunIf -from tests.helpers.utils import pl_multi_process_test +from unittests.helpers.boring_model import BoringModel, RandomDataset +from unittests.helpers.dataloaders import CustomNotImplementedErrorDataloader +from unittests.helpers.runif import RunIf +from unittests.helpers.utils import pl_multi_process_test class BoringModelNoDataloaders(BoringModel): diff --git a/test/tests/trainer/__init__.py b/test/unittests/trainer/__init__.py similarity index 100% rename from test/tests/trainer/__init__.py rename to test/unittests/trainer/__init__.py diff --git a/test/tests/trainer/connectors/__init__.py b/test/unittests/trainer/connectors/__init__.py similarity index 100% rename from test/tests/trainer/connectors/__init__.py rename to test/unittests/trainer/connectors/__init__.py diff --git a/test/tests/trainer/connectors/test_callback_connector.py b/test/unittests/trainer/connectors/test_callback_connector.py similarity index 99% rename from test/tests/trainer/connectors/test_callback_connector.py rename to test/unittests/trainer/connectors/test_callback_connector.py index d5d6bb9191108..03d4f6ec54bac 100644 --- a/test/tests/trainer/connectors/test_callback_connector.py +++ b/test/unittests/trainer/connectors/test_callback_connector.py @@ -30,7 +30,7 @@ ) from pytorch_lightning.trainer.connectors.callback_connector import CallbackConnector from pytorch_lightning.utilities.imports import _PYTHON_GREATER_EQUAL_3_8_0 -from tests.helpers import BoringModel +from unittests.helpers import BoringModel def test_checkpoint_callbacks_are_last(tmpdir): diff --git a/test/tests/trainer/connectors/test_checkpoint_connector.py b/test/unittests/trainer/connectors/test_checkpoint_connector.py similarity index 99% rename from test/tests/trainer/connectors/test_checkpoint_connector.py rename to test/unittests/trainer/connectors/test_checkpoint_connector.py index 0ba21dea404fa..7906ec956dcd4 100644 --- a/test/tests/trainer/connectors/test_checkpoint_connector.py +++ b/test/unittests/trainer/connectors/test_checkpoint_connector.py @@ -22,7 +22,7 @@ from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.plugins.environments import SLURMEnvironment from pytorch_lightning.trainer.states import TrainerFn -from tests.helpers import BoringModel +from unittests.helpers import BoringModel # TODO: remove HPCHookedModel in v1.8 diff --git a/test/tests/trainer/connectors/test_data_connector.py b/test/unittests/trainer/connectors/test_data_connector.py similarity index 99% rename from test/tests/trainer/connectors/test_data_connector.py rename to test/unittests/trainer/connectors/test_data_connector.py index 7d1b6f0a23bb4..090e43914a12c 100644 --- a/test/tests/trainer/connectors/test_data_connector.py +++ b/test/unittests/trainer/connectors/test_data_connector.py @@ -27,9 +27,9 @@ from pytorch_lightning.utilities.data import _update_dataloader from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.warnings import PossibleUserWarning -from tests.helpers.boring_model import BoringDataModule, BoringModel, RandomDataset -from tests.helpers.runif import RunIf -from tests.helpers.utils import no_warning_call +from unittests.helpers.boring_model import BoringDataModule, BoringModel, RandomDataset +from unittests.helpers.runif import RunIf +from unittests.helpers.utils import no_warning_call @RunIf(skip_windows=True) diff --git a/test/tests/trainer/connectors/test_signal_connector.py b/test/unittests/trainer/connectors/test_signal_connector.py similarity index 98% rename from test/tests/trainer/connectors/test_signal_connector.py rename to test/unittests/trainer/connectors/test_signal_connector.py index 5988809af420d..d1b3e4d474cae 100644 --- a/test/tests/trainer/connectors/test_signal_connector.py +++ b/test/unittests/trainer/connectors/test_signal_connector.py @@ -23,8 +23,8 @@ from pytorch_lightning.plugins.environments import SLURMEnvironment from pytorch_lightning.trainer.connectors.signal_connector import SignalConnector from pytorch_lightning.utilities.exceptions import ExitGracefullyException -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf @RunIf(skip_windows=True) diff --git a/test/tests/trainer/dynamic_args/__init__.py b/test/unittests/trainer/dynamic_args/__init__.py similarity index 100% rename from test/tests/trainer/dynamic_args/__init__.py rename to test/unittests/trainer/dynamic_args/__init__.py diff --git a/test/tests/trainer/dynamic_args/test_multiple_eval_dataloaders.py b/test/unittests/trainer/dynamic_args/test_multiple_eval_dataloaders.py similarity index 98% rename from test/tests/trainer/dynamic_args/test_multiple_eval_dataloaders.py rename to test/unittests/trainer/dynamic_args/test_multiple_eval_dataloaders.py index b4378f34c1211..0e48968710ae0 100644 --- a/test/tests/trainer/dynamic_args/test_multiple_eval_dataloaders.py +++ b/test/unittests/trainer/dynamic_args/test_multiple_eval_dataloaders.py @@ -15,7 +15,7 @@ from torch.utils.data import Dataset from pytorch_lightning import Trainer -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel class RandomDatasetA(Dataset): diff --git a/test/tests/trainer/flags/__init__.py b/test/unittests/trainer/flags/__init__.py similarity index 100% rename from test/tests/trainer/flags/__init__.py rename to test/unittests/trainer/flags/__init__.py diff --git a/test/tests/trainer/flags/test_check_val_every_n_epoch.py b/test/unittests/trainer/flags/test_check_val_every_n_epoch.py similarity index 97% rename from test/tests/trainer/flags/test_check_val_every_n_epoch.py rename to test/unittests/trainer/flags/test_check_val_every_n_epoch.py index ca2537b829cd7..8ff7c9c74ac40 100644 --- a/test/tests/trainer/flags/test_check_val_every_n_epoch.py +++ b/test/unittests/trainer/flags/test_check_val_every_n_epoch.py @@ -15,7 +15,7 @@ from torch.utils.data import DataLoader from pytorch_lightning.trainer.trainer import Trainer -from tests.helpers import BoringModel, RandomDataset +from unittests.helpers import BoringModel, RandomDataset @pytest.mark.parametrize( diff --git a/test/tests/trainer/flags/test_env_vars.py b/test/unittests/trainer/flags/test_env_vars.py similarity index 100% rename from test/tests/trainer/flags/test_env_vars.py rename to test/unittests/trainer/flags/test_env_vars.py diff --git a/test/tests/trainer/flags/test_fast_dev_run.py b/test/unittests/trainer/flags/test_fast_dev_run.py similarity index 99% rename from test/tests/trainer/flags/test_fast_dev_run.py rename to test/unittests/trainer/flags/test_fast_dev_run.py index 413fa6b09ae21..16a1db328148e 100644 --- a/test/tests/trainer/flags/test_fast_dev_run.py +++ b/test/unittests/trainer/flags/test_fast_dev_run.py @@ -7,7 +7,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.loggers.logger import DummyLogger -from tests.helpers import BoringModel +from unittests.helpers import BoringModel @pytest.mark.parametrize("tuner_alg", ["batch size scaler", "learning rate finder"]) diff --git a/test/tests/trainer/flags/test_limit_batches.py b/test/unittests/trainer/flags/test_limit_batches.py similarity index 98% rename from test/tests/trainer/flags/test_limit_batches.py rename to test/unittests/trainer/flags/test_limit_batches.py index f46eb3acb10ff..da50a1d896ca2 100644 --- a/test/tests/trainer/flags/test_limit_batches.py +++ b/test/unittests/trainer/flags/test_limit_batches.py @@ -17,7 +17,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.trainer.states import RunningStage -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel def test_num_dataloader_batches(tmpdir): diff --git a/test/tests/trainer/flags/test_min_max_epochs.py b/test/unittests/trainer/flags/test_min_max_epochs.py similarity index 96% rename from test/tests/trainer/flags/test_min_max_epochs.py rename to test/unittests/trainer/flags/test_min_max_epochs.py index e410e806ea2db..f31e6a9c7a6eb 100644 --- a/test/tests/trainer/flags/test_min_max_epochs.py +++ b/test/unittests/trainer/flags/test_min_max_epochs.py @@ -2,7 +2,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.utilities.warnings import PossibleUserWarning -from tests.helpers import BoringModel +from unittests.helpers import BoringModel @pytest.mark.parametrize( diff --git a/test/tests/trainer/flags/test_overfit_batches.py b/test/unittests/trainer/flags/test_overfit_batches.py similarity index 98% rename from test/tests/trainer/flags/test_overfit_batches.py rename to test/unittests/trainer/flags/test_overfit_batches.py index b6e5ad0a292c6..3433717bd4566 100644 --- a/test/tests/trainer/flags/test_overfit_batches.py +++ b/test/unittests/trainer/flags/test_overfit_batches.py @@ -18,8 +18,8 @@ from legacy.simple_classif_training import ClassifDataModule, ClassificationModel from pytorch_lightning import Trainer from pytorch_lightning.trainer.states import RunningStage -from tests.helpers.boring_model import BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf @pytest.mark.parametrize("overfit_batches", [1, 2, 0.1, 0.25, 1.0]) diff --git a/test/tests/trainer/flags/test_val_check_interval.py b/test/unittests/trainer/flags/test_val_check_interval.py similarity index 97% rename from test/tests/trainer/flags/test_val_check_interval.py rename to test/unittests/trainer/flags/test_val_check_interval.py index b575faa81203c..33fadf1cc4878 100644 --- a/test/tests/trainer/flags/test_val_check_interval.py +++ b/test/unittests/trainer/flags/test_val_check_interval.py @@ -18,8 +18,8 @@ from pytorch_lightning.trainer.trainer import Trainer from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel, RandomDataset -from tests.helpers.boring_model import RandomIterableDataset +from unittests.helpers import BoringModel, RandomDataset +from unittests.helpers.boring_model import RandomIterableDataset @pytest.mark.parametrize("max_epochs", [1, 2, 3]) diff --git a/test/tests/trainer/logging_/__init__.py b/test/unittests/trainer/logging_/__init__.py similarity index 100% rename from test/tests/trainer/logging_/__init__.py rename to test/unittests/trainer/logging_/__init__.py diff --git a/test/tests/trainer/logging_/test_distributed_logging.py b/test/unittests/trainer/logging_/test_distributed_logging.py similarity index 98% rename from test/tests/trainer/logging_/test_distributed_logging.py rename to test/unittests/trainer/logging_/test_distributed_logging.py index 25e8958fe54e6..d8ad154dedbc1 100644 --- a/test/tests/trainer/logging_/test_distributed_logging.py +++ b/test/unittests/trainer/logging_/test_distributed_logging.py @@ -18,8 +18,8 @@ import pytorch_lightning as pl from pytorch_lightning import Callback, Trainer from pytorch_lightning.loggers.logger import Logger -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf class AllRankLogger(Logger): diff --git a/test/tests/trainer/logging_/test_eval_loop_logging.py b/test/unittests/trainer/logging_/test_eval_loop_logging.py similarity index 99% rename from test/tests/trainer/logging_/test_eval_loop_logging.py rename to test/unittests/trainer/logging_/test_eval_loop_logging.py index 9f94b38b5c0f1..9142272dcfe7a 100644 --- a/test/tests/trainer/logging_/test_eval_loop_logging.py +++ b/test/unittests/trainer/logging_/test_eval_loop_logging.py @@ -30,8 +30,8 @@ from pytorch_lightning.trainer.states import RunningStage from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.imports import _PYTHON_GREATER_EQUAL_3_8_0, _RICH_AVAILABLE -from tests.helpers import BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf if _RICH_AVAILABLE: from rich import get_console diff --git a/test/tests/trainer/logging_/test_logger_connector.py b/test/unittests/trainer/logging_/test_logger_connector.py similarity index 99% rename from test/tests/trainer/logging_/test_logger_connector.py rename to test/unittests/trainer/logging_/test_logger_connector.py index c535e23ac7c26..1e5b1eff5f097 100644 --- a/test/tests/trainer/logging_/test_logger_connector.py +++ b/test/unittests/trainer/logging_/test_logger_connector.py @@ -25,9 +25,9 @@ from pytorch_lightning.trainer.connectors.logger_connector.fx_validator import _FxValidator from pytorch_lightning.trainer.connectors.logger_connector.result import _ResultCollection from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel, RandomDataset -from tests.helpers.runif import RunIf -from tests.models.test_hooks import get_members +from unittests.helpers.boring_model import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf +from unittests.models.test_hooks import get_members def test_fx_validator(): diff --git a/test/tests/trainer/logging_/test_loop_logging.py b/test/unittests/trainer/logging_/test_loop_logging.py similarity index 98% rename from test/tests/trainer/logging_/test_loop_logging.py rename to test/unittests/trainer/logging_/test_loop_logging.py index fca7a8546c3e5..895cf9cdcba44 100644 --- a/test/tests/trainer/logging_/test_loop_logging.py +++ b/test/unittests/trainer/logging_/test_loop_logging.py @@ -22,7 +22,7 @@ from pytorch_lightning.trainer.connectors.logger_connector.fx_validator import _FxValidator from pytorch_lightning.trainer.connectors.logger_connector.result import _ResultCollection from pytorch_lightning.trainer.states import RunningStage, TrainerFn -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel def test_default_level_for_hooks_that_support_logging(): diff --git a/test/tests/trainer/logging_/test_progress_bar_logging.py b/test/unittests/trainer/logging_/test_progress_bar_logging.py similarity index 94% rename from test/tests/trainer/logging_/test_progress_bar_logging.py rename to test/unittests/trainer/logging_/test_progress_bar_logging.py index d19251c02d37c..c545bd9d22898 100644 --- a/test/tests/trainer/logging_/test_progress_bar_logging.py +++ b/test/unittests/trainer/logging_/test_progress_bar_logging.py @@ -1,7 +1,7 @@ import pytest from pytorch_lightning import Trainer -from tests.helpers import BoringModel +from unittests.helpers import BoringModel def test_logging_to_progress_bar_with_reserved_key(tmpdir): diff --git a/test/tests/trainer/logging_/test_train_loop_logging.py b/test/unittests/trainer/logging_/test_train_loop_logging.py similarity index 99% rename from test/tests/trainer/logging_/test_train_loop_logging.py rename to test/unittests/trainer/logging_/test_train_loop_logging.py index 23c81dfa78c09..f56900b149578 100644 --- a/test/tests/trainer/logging_/test_train_loop_logging.py +++ b/test/unittests/trainer/logging_/test_train_loop_logging.py @@ -29,8 +29,8 @@ from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint, TQDMProgressBar from pytorch_lightning.core.module import LightningModule from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel, RandomDataset, RandomDictDataset -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel, RandomDataset, RandomDictDataset +from unittests.helpers.runif import RunIf def test__training_step__log(tmpdir): diff --git a/test/tests/trainer/optimization/__init__.py b/test/unittests/trainer/optimization/__init__.py similarity index 100% rename from test/tests/trainer/optimization/__init__.py rename to test/unittests/trainer/optimization/__init__.py diff --git a/test/tests/trainer/optimization/test_backward_calls.py b/test/unittests/trainer/optimization/test_backward_calls.py similarity index 97% rename from test/tests/trainer/optimization/test_backward_calls.py rename to test/unittests/trainer/optimization/test_backward_calls.py index fbe01375b2db9..55b25384f3791 100644 --- a/test/tests/trainer/optimization/test_backward_calls.py +++ b/test/unittests/trainer/optimization/test_backward_calls.py @@ -4,7 +4,7 @@ import torch from pytorch_lightning import Trainer -from tests.helpers import BoringModel +from unittests.helpers import BoringModel @pytest.mark.parametrize("num_steps", [1, 2, 3]) diff --git a/test/tests/trainer/optimization/test_manual_optimization.py b/test/unittests/trainer/optimization/test_manual_optimization.py similarity index 99% rename from test/tests/trainer/optimization/test_manual_optimization.py rename to test/unittests/trainer/optimization/test_manual_optimization.py index b0fe01ccadf4a..683c0fe59560d 100644 --- a/test/tests/trainer/optimization/test_manual_optimization.py +++ b/test/unittests/trainer/optimization/test_manual_optimization.py @@ -23,8 +23,8 @@ from pytorch_lightning import seed_everything, Trainer from pytorch_lightning.strategies import Strategy -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf class ManualOptModel(BoringModel): diff --git a/test/tests/trainer/optimization/test_multiple_optimizers.py b/test/unittests/trainer/optimization/test_multiple_optimizers.py similarity index 99% rename from test/tests/trainer/optimization/test_multiple_optimizers.py rename to test/unittests/trainer/optimization/test_multiple_optimizers.py index 41d380b4aa8a7..362a6bb76f2f2 100644 --- a/test/tests/trainer/optimization/test_multiple_optimizers.py +++ b/test/unittests/trainer/optimization/test_multiple_optimizers.py @@ -16,7 +16,7 @@ import torch import pytorch_lightning as pl -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel class MultiOptModel(BoringModel): diff --git a/test/tests/trainer/optimization/test_optimizers.py b/test/unittests/trainer/optimization/test_optimizers.py similarity index 99% rename from test/tests/trainer/optimization/test_optimizers.py rename to test/unittests/trainer/optimization/test_optimizers.py index d60340bfeac87..a8dfed63d272f 100644 --- a/test/tests/trainer/optimization/test_optimizers.py +++ b/test/unittests/trainer/optimization/test_optimizers.py @@ -27,8 +27,8 @@ ) from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.types import LRSchedulerConfig -from tests.helpers.boring_model import BoringDataModule, BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringDataModule, BoringModel +from unittests.helpers.runif import RunIf def test_optimizer_with_scheduling(tmpdir): diff --git a/test/tests/trainer/properties/__init__.py b/test/unittests/trainer/properties/__init__.py similarity index 100% rename from test/tests/trainer/properties/__init__.py rename to test/unittests/trainer/properties/__init__.py diff --git a/test/tests/trainer/properties/test_auto_gpu_select.py b/test/unittests/trainer/properties/test_auto_gpu_select.py similarity index 98% rename from test/tests/trainer/properties/test_auto_gpu_select.py rename to test/unittests/trainer/properties/test_auto_gpu_select.py index 4413666ae3972..afe07f48880b8 100644 --- a/test/tests/trainer/properties/test_auto_gpu_select.py +++ b/test/unittests/trainer/properties/test_auto_gpu_select.py @@ -20,7 +20,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.tuner.auto_gpu_select import pick_multiple_gpus from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.runif import RunIf +from unittests.helpers.runif import RunIf @RunIf(min_cuda_gpus=2) diff --git a/test/tests/trainer/properties/test_estimated_stepping_batches.py b/test/unittests/trainer/properties/test_estimated_stepping_batches.py similarity index 97% rename from test/tests/trainer/properties/test_estimated_stepping_batches.py rename to test/unittests/trainer/properties/test_estimated_stepping_batches.py index 203aaff65ef53..523f3bbf5fa35 100644 --- a/test/tests/trainer/properties/test_estimated_stepping_batches.py +++ b/test/unittests/trainer/properties/test_estimated_stepping_batches.py @@ -23,9 +23,9 @@ from pytorch_lightning.callbacks.gradient_accumulation_scheduler import GradientAccumulationScheduler from pytorch_lightning.strategies.ipu import IPUStrategy from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel, RandomIterableDataset -from tests.helpers.runif import RunIf -from tests.helpers.utils import pl_multi_process_test +from unittests.helpers.boring_model import BoringModel, RandomIterableDataset +from unittests.helpers.runif import RunIf +from unittests.helpers.utils import pl_multi_process_test def test_num_stepping_batches_basic(): diff --git a/test/tests/trainer/properties/test_get_model.py b/test/unittests/trainer/properties/test_get_model.py similarity index 95% rename from test/tests/trainer/properties/test_get_model.py rename to test/unittests/trainer/properties/test_get_model.py index e7fa5df3352c8..8eb23ff72a5bb 100644 --- a/test/tests/trainer/properties/test_get_model.py +++ b/test/unittests/trainer/properties/test_get_model.py @@ -13,8 +13,8 @@ # limitations under the License. from pytorch_lightning import Trainer -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf class TrainerGetModel(BoringModel): diff --git a/test/tests/trainer/properties/test_log_dir.py b/test/unittests/trainer/properties/test_log_dir.py similarity index 98% rename from test/tests/trainer/properties/test_log_dir.py rename to test/unittests/trainer/properties/test_log_dir.py index db2f862f82e7b..9567957704baf 100644 --- a/test/tests/trainer/properties/test_log_dir.py +++ b/test/unittests/trainer/properties/test_log_dir.py @@ -16,7 +16,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.loggers import CSVLogger, TensorBoardLogger -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel class TestModel(BoringModel): diff --git a/test/tests/trainer/properties/test_loggers.py b/test/unittests/trainer/properties/test_loggers.py similarity index 98% rename from test/tests/trainer/properties/test_loggers.py rename to test/unittests/trainer/properties/test_loggers.py index ac3a01cba3698..f0c17920c46af 100644 --- a/test/tests/trainer/properties/test_loggers.py +++ b/test/unittests/trainer/properties/test_loggers.py @@ -16,7 +16,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.loggers import LoggerCollection, TensorBoardLogger -from tests.loggers.test_logger import CustomLogger +from unittests.loggers.test_logger import CustomLogger def test_trainer_loggers_property(): diff --git a/test/tests/trainer/test_config_validator.py b/test/unittests/trainer/test_config_validator.py similarity index 99% rename from test/tests/trainer/test_config_validator.py rename to test/unittests/trainer/test_config_validator.py index 92e67c7e1dde6..26414e9339444 100644 --- a/test/tests/trainer/test_config_validator.py +++ b/test/unittests/trainer/test_config_validator.py @@ -18,7 +18,7 @@ from pytorch_lightning.callbacks.callback import Callback from pytorch_lightning.demos.boring_classes import BoringDataModule from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel, RandomDataset +from unittests.helpers import BoringModel, RandomDataset def test_wrong_train_setting(tmpdir): diff --git a/test/tests/trainer/test_dataloaders.py b/test/unittests/trainer/test_dataloaders.py similarity index 99% rename from test/tests/trainer/test_dataloaders.py rename to test/unittests/trainer/test_dataloaders.py index 27667f7b2e043..d4b2b257b977c 100644 --- a/test/tests/trainer/test_dataloaders.py +++ b/test/unittests/trainer/test_dataloaders.py @@ -28,9 +28,14 @@ from pytorch_lightning.trainer.states import RunningStage from pytorch_lightning.utilities.data import _auto_add_worker_init_fn, has_iterable_dataset, has_len_all_ranks from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset, RandomIterableDatasetWithLen -from tests.helpers.dataloaders import CustomInfDataloader, CustomNotImplementedErrorDataloader -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import ( + BoringModel, + RandomDataset, + RandomIterableDataset, + RandomIterableDatasetWithLen, +) +from unittests.helpers.dataloaders import CustomInfDataloader, CustomNotImplementedErrorDataloader +from unittests.helpers.runif import RunIf class MultiValDataLoaderBoringModel(BoringModel): diff --git a/test/tests/trainer/test_progress.py b/test/unittests/trainer/test_progress.py similarity index 100% rename from test/tests/trainer/test_progress.py rename to test/unittests/trainer/test_progress.py diff --git a/test/tests/trainer/test_states.py b/test/unittests/trainer/test_states.py similarity index 98% rename from test/tests/trainer/test_states.py rename to test/unittests/trainer/test_states.py index b6b7e44722fb2..a456d9e554cab 100644 --- a/test/tests/trainer/test_states.py +++ b/test/unittests/trainer/test_states.py @@ -15,7 +15,7 @@ from pytorch_lightning import Callback, Trainer from pytorch_lightning.trainer.states import RunningStage, TrainerFn, TrainerState, TrainerStatus -from tests.helpers import BoringModel +from unittests.helpers import BoringModel def test_initialize_state(): diff --git a/test/tests/trainer/test_supporters.py b/test/unittests/trainer/test_supporters.py similarity index 99% rename from test/tests/trainer/test_supporters.py rename to test/unittests/trainer/test_supporters.py index ccf74b6fe9f47..690fec004695a 100644 --- a/test/tests/trainer/test_supporters.py +++ b/test/unittests/trainer/test_supporters.py @@ -36,8 +36,8 @@ from pytorch_lightning.utilities.auto_restart import CaptureMapDataset, FastForwardSampler from pytorch_lightning.utilities.data import get_len from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf def test_tensor_running_accum_reset(): diff --git a/test/tests/trainer/test_trainer.py b/test/unittests/trainer/test_trainer.py similarity index 99% rename from test/tests/trainer/test_trainer.py rename to test/unittests/trainer/test_trainer.py index 8e4f812a24ec1..8663d6cb13d30 100644 --- a/test/tests/trainer/test_trainer.py +++ b/test/unittests/trainer/test_trainer.py @@ -33,7 +33,7 @@ from torch.utils.data import DataLoader, IterableDataset import pytorch_lightning -import tests.helpers.utils as tutils +import unittests.helpers.utils as tutils from pytorch_lightning import Callback, LightningDataModule, LightningModule, Trainer from pytorch_lightning.accelerators import CPUAccelerator, GPUAccelerator from pytorch_lightning.callbacks import EarlyStopping, GradientAccumulationScheduler, ModelCheckpoint, Timer @@ -57,11 +57,11 @@ from pytorch_lightning.utilities.exceptions import DeadlockDetectedException, MisconfigurationException from pytorch_lightning.utilities.imports import _OMEGACONF_AVAILABLE from pytorch_lightning.utilities.seed import seed_everything -from tests.helpers import BoringModel, RandomDataset -from tests.helpers.boring_model import RandomIterableDataset, RandomIterableDatasetWithLen -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.runif import RunIf -from tests.helpers.simple_models import ClassificationModel +from unittests.helpers import BoringModel, RandomDataset +from unittests.helpers.boring_model import RandomIterableDataset, RandomIterableDatasetWithLen +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.runif import RunIf +from unittests.helpers.simple_models import ClassificationModel if _OMEGACONF_AVAILABLE: from omegaconf import OmegaConf diff --git a/test/tests/trainer/test_trainer_cli.py b/test/unittests/trainer/test_trainer_cli.py similarity index 99% rename from test/tests/trainer/test_trainer_cli.py rename to test/unittests/trainer/test_trainer_cli.py index 37a02e895d560..f3f03201694a2 100644 --- a/test/tests/trainer/test_trainer_cli.py +++ b/test/unittests/trainer/test_trainer_cli.py @@ -19,7 +19,7 @@ import pytest import torch -import tests.helpers.utils as tutils +import unittests.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.utilities import argparse diff --git a/test/tests/tuner/__init__.py b/test/unittests/tuner/__init__.py similarity index 100% rename from test/tests/tuner/__init__.py rename to test/unittests/tuner/__init__.py diff --git a/test/tests/tuner/test_lr_finder.py b/test/unittests/tuner/test_lr_finder.py similarity index 98% rename from test/tests/tuner/test_lr_finder.py rename to test/unittests/tuner/test_lr_finder.py index daf2ecde2cc16..77cb389c0e72f 100644 --- a/test/tests/tuner/test_lr_finder.py +++ b/test/unittests/tuner/test_lr_finder.py @@ -19,10 +19,10 @@ from pytorch_lightning import seed_everything, Trainer from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.simple_models import ClassificationModel -from tests.helpers.utils import no_warning_call +from unittests.helpers import BoringModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.simple_models import ClassificationModel +from unittests.helpers.utils import no_warning_call def test_error_on_more_than_1_optimizer(tmpdir): diff --git a/test/tests/tuner/test_scale_batch_size.py b/test/unittests/tuner/test_scale_batch_size.py similarity index 98% rename from test/tests/tuner/test_scale_batch_size.py rename to test/unittests/tuner/test_scale_batch_size.py index d22162dd948d3..93e6c9182da41 100644 --- a/test/tests/tuner/test_scale_batch_size.py +++ b/test/unittests/tuner/test_scale_batch_size.py @@ -18,14 +18,14 @@ import torch from torch.utils.data import DataLoader -import tests.helpers.utils as tutils +import unittests.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.tuner.tuning import Tuner from pytorch_lightning.utilities import AMPType from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringDataModule, BoringModel, RandomDataset -from tests.helpers.runif import RunIf -from tests.helpers.utils import no_warning_call +from unittests.helpers import BoringDataModule, BoringModel, RandomDataset +from unittests.helpers.runif import RunIf +from unittests.helpers.utils import no_warning_call class BatchSizeDataModule(BoringDataModule): diff --git a/test/tests/tuner/test_tuning.py b/test/unittests/tuner/test_tuning.py similarity index 95% rename from test/tests/tuner/test_tuning.py rename to test/unittests/tuner/test_tuning.py index aadacb6440fc2..8748c592b78ed 100644 --- a/test/tests/tuner/test_tuning.py +++ b/test/unittests/tuner/test_tuning.py @@ -15,7 +15,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel def test_tuner_with_distributed_strategies(): diff --git a/test/tests/utilities/__init__.py b/test/unittests/utilities/__init__.py similarity index 100% rename from test/tests/utilities/__init__.py rename to test/unittests/utilities/__init__.py diff --git a/test/tests/utilities/distributed.py b/test/unittests/utilities/distributed.py similarity index 100% rename from test/tests/utilities/distributed.py rename to test/unittests/utilities/distributed.py diff --git a/test/tests/utilities/test_all_gather_grad.py b/test/unittests/utilities/test_all_gather_grad.py similarity index 98% rename from test/tests/utilities/test_all_gather_grad.py rename to test/unittests/utilities/test_all_gather_grad.py index c10a3626ad6d8..949fdb3926de0 100644 --- a/test/tests/utilities/test_all_gather_grad.py +++ b/test/unittests/utilities/test_all_gather_grad.py @@ -19,8 +19,8 @@ from pytorch_lightning import seed_everything, Trainer from pytorch_lightning.utilities import AllGatherGrad -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf def setup_ddp(rank, world_size): diff --git a/test/tests/utilities/test_apply_func.py b/test/unittests/utilities/test_apply_func.py similarity index 100% rename from test/tests/utilities/test_apply_func.py rename to test/unittests/utilities/test_apply_func.py diff --git a/test/tests/utilities/test_apply_func_torchtext.py b/test/unittests/utilities/test_apply_func_torchtext.py similarity index 94% rename from test/tests/utilities/test_apply_func_torchtext.py rename to test/unittests/utilities/test_apply_func_torchtext.py index f76c1bf70cced..c5386f97f1868 100644 --- a/test/tests/utilities/test_apply_func_torchtext.py +++ b/test/unittests/utilities/test_apply_func_torchtext.py @@ -16,8 +16,8 @@ from pytorch_lightning.utilities.apply_func import move_data_to_device from pytorch_lightning.utilities.imports import _TORCHTEXT_LEGACY -from tests.helpers.runif import RunIf -from tests.helpers.torchtext_utils import get_dummy_torchtext_data_iterator +from unittests.helpers.runif import RunIf +from unittests.helpers.torchtext_utils import get_dummy_torchtext_data_iterator @pytest.mark.parametrize("include_lengths", [False, True]) diff --git a/test/tests/utilities/test_argparse.py b/test/unittests/utilities/test_argparse.py similarity index 100% rename from test/tests/utilities/test_argparse.py rename to test/unittests/utilities/test_argparse.py diff --git a/test/tests/utilities/test_auto_restart.py b/test/unittests/utilities/test_auto_restart.py similarity index 99% rename from test/tests/utilities/test_auto_restart.py rename to test/unittests/utilities/test_auto_restart.py index 2849aee531f18..8de569319be34 100644 --- a/test/tests/utilities/test_auto_restart.py +++ b/test/unittests/utilities/test_auto_restart.py @@ -36,7 +36,7 @@ from torch.utils.data.dataset import Dataset, IterableDataset from torch.utils.data.sampler import Sampler -import tests.helpers.utils as tutils +import unittests.helpers.utils as tutils from pytorch_lightning import Callback, LightningModule, seed_everything, Trainer from pytorch_lightning.trainer.states import RunningStage, TrainerState from pytorch_lightning.trainer.supporters import CombinedLoader @@ -59,8 +59,8 @@ from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.fetching import DataFetcher from pytorch_lightning.utilities.imports import _fault_tolerant_training -from tests.helpers.boring_model import BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf # Credit to PyTorch Team. diff --git a/test/tests/utilities/test_cli.py b/test/unittests/utilities/test_cli.py similarity index 99% rename from test/tests/utilities/test_cli.py rename to test/unittests/utilities/test_cli.py index c31e65db33680..1d690be8e6017 100644 --- a/test/tests/utilities/test_cli.py +++ b/test/unittests/utilities/test_cli.py @@ -53,9 +53,9 @@ ) from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.imports import _TORCHVISION_AVAILABLE -from tests.helpers import BoringDataModule, BoringModel -from tests.helpers.runif import RunIf -from tests.helpers.utils import no_warning_call +from unittests.helpers import BoringDataModule, BoringModel +from unittests.helpers.runif import RunIf +from unittests.helpers.utils import no_warning_call torchvision_version = version.parse("0") if _TORCHVISION_AVAILABLE: diff --git a/test/tests/utilities/test_cloud_io.py b/test/unittests/utilities/test_cloud_io.py similarity index 100% rename from test/tests/utilities/test_cloud_io.py rename to test/unittests/utilities/test_cloud_io.py diff --git a/test/tests/utilities/test_data.py b/test/unittests/utilities/test_data.py similarity index 98% rename from test/tests/utilities/test_data.py rename to test/unittests/utilities/test_data.py index ced076540b970..a4aaf17337a57 100644 --- a/test/tests/utilities/test_data.py +++ b/test/unittests/utilities/test_data.py @@ -19,8 +19,8 @@ warning_cache, ) from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset -from tests.helpers.utils import no_warning_call +from unittests.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset +from unittests.helpers.utils import no_warning_call def test_extract_batch_size(): diff --git a/test/tests/utilities/test_deepspeed_collate_checkpoint.py b/test/unittests/utilities/test_deepspeed_collate_checkpoint.py similarity index 95% rename from test/tests/utilities/test_deepspeed_collate_checkpoint.py rename to test/unittests/utilities/test_deepspeed_collate_checkpoint.py index dac0db4a74be7..ba3cce04ba2db 100644 --- a/test/tests/utilities/test_deepspeed_collate_checkpoint.py +++ b/test/unittests/utilities/test_deepspeed_collate_checkpoint.py @@ -18,8 +18,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.strategies import DeepSpeedStrategy from pytorch_lightning.utilities.deepspeed import convert_zero_checkpoint_to_fp32_state_dict -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf @RunIf(min_cuda_gpus=2, standalone=True, deepspeed=True) diff --git a/test/tests/utilities/test_distributed.py b/test/unittests/utilities/test_distributed.py similarity index 94% rename from test/tests/utilities/test_distributed.py rename to test/unittests/utilities/test_distributed.py index 269123b6ad4d4..f2abe391b350d 100644 --- a/test/tests/utilities/test_distributed.py +++ b/test/unittests/utilities/test_distributed.py @@ -16,9 +16,9 @@ import torch import torch.multiprocessing as mp -import tests.helpers.utils as tutils +import unittests.helpers.utils as tutils from pytorch_lightning.utilities.distributed import _collect_states_on_rank_zero -from tests.helpers.runif import RunIf +from unittests.helpers.runif import RunIf def _test_collect_states(rank, world_size): diff --git a/test/tests/utilities/test_dtype_device_mixin.py b/test/unittests/utilities/test_dtype_device_mixin.py similarity index 97% rename from test/tests/utilities/test_dtype_device_mixin.py rename to test/unittests/utilities/test_dtype_device_mixin.py index 21374384a7d50..44ddc89844b1e 100644 --- a/test/tests/utilities/test_dtype_device_mixin.py +++ b/test/unittests/utilities/test_dtype_device_mixin.py @@ -17,8 +17,8 @@ from pytorch_lightning import Callback, Trainer from pytorch_lightning.core.mixins import DeviceDtypeModuleMixin -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf class SubSubModule(DeviceDtypeModuleMixin): diff --git a/test/tests/utilities/test_enums.py b/test/unittests/utilities/test_enums.py similarity index 100% rename from test/tests/utilities/test_enums.py rename to test/unittests/utilities/test_enums.py diff --git a/test/tests/utilities/test_fetching.py b/test/unittests/utilities/test_fetching.py similarity index 99% rename from test/tests/utilities/test_fetching.py rename to test/unittests/utilities/test_fetching.py index 2275400781a5b..eb1a7556c332f 100644 --- a/test/tests/utilities/test_fetching.py +++ b/test/unittests/utilities/test_fetching.py @@ -26,8 +26,8 @@ from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.fetching import DataFetcher, DataLoaderIterDataFetcher, InterBatchParallelDataFetcher from pytorch_lightning.utilities.types import STEP_OUTPUT -from tests.helpers import BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf class IterDataset(IterableDataset): diff --git a/test/tests/utilities/test_finite_checks.py b/test/unittests/utilities/test_finite_checks.py similarity index 100% rename from test/tests/utilities/test_finite_checks.py rename to test/unittests/utilities/test_finite_checks.py diff --git a/test/tests/utilities/test_grads.py b/test/unittests/utilities/test_grads.py similarity index 100% rename from test/tests/utilities/test_grads.py rename to test/unittests/utilities/test_grads.py diff --git a/test/tests/utilities/test_imports.py b/test/unittests/utilities/test_imports.py similarity index 100% rename from test/tests/utilities/test_imports.py rename to test/unittests/utilities/test_imports.py diff --git a/test/tests/utilities/test_logger.py b/test/unittests/utilities/test_logger.py similarity index 100% rename from test/tests/utilities/test_logger.py rename to test/unittests/utilities/test_logger.py diff --git a/test/tests/utilities/test_memory.py b/test/unittests/utilities/test_memory.py similarity index 97% rename from test/tests/utilities/test_memory.py rename to test/unittests/utilities/test_memory.py index b486157480877..d532a24da56ae 100644 --- a/test/tests/utilities/test_memory.py +++ b/test/unittests/utilities/test_memory.py @@ -17,7 +17,7 @@ import torch.nn as nn from pytorch_lightning.utilities.memory import get_model_size_mb, recursive_detach -from tests.helpers import BoringModel +from unittests.helpers import BoringModel def test_recursive_detach(): diff --git a/test/tests/utilities/test_meta.py b/test/unittests/utilities/test_meta.py similarity index 96% rename from test/tests/utilities/test_meta.py rename to test/unittests/utilities/test_meta.py index 4a3194961026d..a788b986b3e18 100644 --- a/test/tests/utilities/test_meta.py +++ b/test/unittests/utilities/test_meta.py @@ -16,8 +16,8 @@ from pytorch_lightning.core.module import LightningModule from pytorch_lightning.utilities.meta import init_meta_context, is_on_meta_device, materialize_module -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf class MLP(nn.Module): diff --git a/test/tests/utilities/test_migration.py b/test/unittests/utilities/test_migration.py similarity index 100% rename from test/tests/utilities/test_migration.py rename to test/unittests/utilities/test_migration.py diff --git a/test/tests/utilities/test_model_helpers.py b/test/unittests/utilities/test_model_helpers.py similarity index 97% rename from test/tests/utilities/test_model_helpers.py rename to test/unittests/utilities/test_model_helpers.py index 74239becf506f..ebe7ad7d7c3e7 100644 --- a/test/tests/utilities/test_model_helpers.py +++ b/test/unittests/utilities/test_model_helpers.py @@ -18,7 +18,7 @@ from pytorch_lightning import LightningDataModule from pytorch_lightning.utilities.model_helpers import is_overridden -from tests.helpers import BoringDataModule, BoringModel +from unittests.helpers import BoringDataModule, BoringModel def test_is_overridden(): diff --git a/test/tests/utilities/test_model_summary.py b/test/unittests/utilities/test_model_summary.py similarity index 98% rename from test/tests/utilities/test_model_summary.py rename to test/unittests/utilities/test_model_summary.py index 9cf126aeaced8..30cbfc5b9bb4a 100644 --- a/test/tests/utilities/test_model_summary.py +++ b/test/unittests/utilities/test_model_summary.py @@ -20,9 +20,9 @@ from pytorch_lightning import LightningModule, Trainer from pytorch_lightning.utilities import _TORCH_GREATER_EQUAL_1_9 from pytorch_lightning.utilities.model_summary import ModelSummary, summarize, UNKNOWN_SIZE -from tests.helpers import BoringModel -from tests.helpers.advanced_models import ParityModuleRNN -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.advanced_models import ParityModuleRNN +from unittests.helpers.runif import RunIf class EmptyModule(LightningModule): diff --git a/test/tests/utilities/test_optimizer.py b/test/unittests/utilities/test_optimizer.py similarity index 100% rename from test/tests/utilities/test_optimizer.py rename to test/unittests/utilities/test_optimizer.py diff --git a/test/tests/utilities/test_parameter_tying.py b/test/unittests/utilities/test_parameter_tying.py similarity index 98% rename from test/tests/utilities/test_parameter_tying.py rename to test/unittests/utilities/test_parameter_tying.py index f0217c548b5a0..e8d455539b9d9 100644 --- a/test/tests/utilities/test_parameter_tying.py +++ b/test/unittests/utilities/test_parameter_tying.py @@ -16,7 +16,7 @@ from torch import nn from pytorch_lightning.utilities import find_shared_parameters, set_shared_parameters -from tests.helpers import BoringModel +from unittests.helpers import BoringModel class ParameterSharingModule(BoringModel): diff --git a/test/tests/utilities/test_parsing.py b/test/unittests/utilities/test_parsing.py similarity index 100% rename from test/tests/utilities/test_parsing.py rename to test/unittests/utilities/test_parsing.py diff --git a/test/tests/utilities/test_rank_zero.py b/test/unittests/utilities/test_rank_zero.py similarity index 100% rename from test/tests/utilities/test_rank_zero.py rename to test/unittests/utilities/test_rank_zero.py diff --git a/test/tests/utilities/test_remote_filesystem.py b/test/unittests/utilities/test_remote_filesystem.py similarity index 98% rename from test/tests/utilities/test_remote_filesystem.py rename to test/unittests/utilities/test_remote_filesystem.py index 75173a69ae84c..76e918a264aa6 100644 --- a/test/tests/utilities/test_remote_filesystem.py +++ b/test/unittests/utilities/test_remote_filesystem.py @@ -19,7 +19,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.loggers import TensorBoardLogger -from tests.helpers import BoringModel +from unittests.helpers import BoringModel GCS_BUCKET_PATH = os.getenv("GCS_BUCKET_PATH", None) _GCS_BUCKET_PATH_AVAILABLE = GCS_BUCKET_PATH is not None diff --git a/test/tests/utilities/test_seed.py b/test/unittests/utilities/test_seed.py similarity index 100% rename from test/tests/utilities/test_seed.py rename to test/unittests/utilities/test_seed.py diff --git a/test/tests/utilities/test_types.py b/test/unittests/utilities/test_types.py similarity index 100% rename from test/tests/utilities/test_types.py rename to test/unittests/utilities/test_types.py diff --git a/test/tests/utilities/test_upgrade_checkpoint.py b/test/unittests/utilities/test_upgrade_checkpoint.py similarity index 100% rename from test/tests/utilities/test_upgrade_checkpoint.py rename to test/unittests/utilities/test_upgrade_checkpoint.py diff --git a/test/tests/utilities/test_warnings.py b/test/unittests/utilities/test_warnings.py similarity index 100% rename from test/tests/utilities/test_warnings.py rename to test/unittests/utilities/test_warnings.py diff --git a/test/tests/utilities/test_xla_device_utils.py b/test/unittests/utilities/test_xla_device_utils.py similarity index 97% rename from test/tests/utilities/test_xla_device_utils.py rename to test/unittests/utilities/test_xla_device_utils.py index 8c1c92e7021c8..d69af561536ca 100644 --- a/test/tests/utilities/test_xla_device_utils.py +++ b/test/unittests/utilities/test_xla_device_utils.py @@ -18,7 +18,7 @@ import pytorch_lightning.utilities.xla_device as xla_utils from pytorch_lightning.utilities import _XLA_AVAILABLE -from tests.helpers.runif import RunIf +from unittests.helpers.runif import RunIf @pytest.mark.skipif(_XLA_AVAILABLE, reason="test requires torch_xla to be absent") From b01c18ac57ba1ffa4a64687b3fff34c52daeea3c Mon Sep 17 00:00:00 2001 From: Jirka Date: Tue, 7 Jun 2022 09:02:24 +0200 Subject: [PATCH 06/20] ci: trigger future --- .azure-pipelines/gpu-benchmark.yml | 1 + .azure-pipelines/gpu-tests.yml | 2 ++ .azure-pipelines/hpu-tests.yml | 2 ++ .azure-pipelines/ipu-tests.yml | 8 +++++--- .circleci/config.yml | 1 + .github/workflows/ci_dockers.yml | 4 ++-- .github/workflows/ci_pkg-install.yml | 4 ++-- .github/workflows/ci_schema.yml | 2 +- .github/workflows/ci_test-conda.yml | 4 ++-- .github/workflows/ci_test-full.yml | 4 ++-- .github/workflows/ci_test-slow.yml | 4 ++-- .github/workflows/code-checks.yml | 4 ++-- .github/workflows/docs-checks.yml | 4 ++-- .github/workflows/release-docker.yml | 2 +- .github/workflows/release-pypi.yml | 2 +- 15 files changed, 28 insertions(+), 20 deletions(-) diff --git a/.azure-pipelines/gpu-benchmark.yml b/.azure-pipelines/gpu-benchmark.yml index 451f5b5646dca..3abd75f30d9f5 100644 --- a/.azure-pipelines/gpu-benchmark.yml +++ b/.azure-pipelines/gpu-benchmark.yml @@ -11,6 +11,7 @@ trigger: include: - "master" - "release/*" + - "future/*" - "refs/tags/*" pr: none diff --git a/.azure-pipelines/gpu-tests.yml b/.azure-pipelines/gpu-tests.yml index 5ec9db1297b43..30286d45be741 100644 --- a/.azure-pipelines/gpu-tests.yml +++ b/.azure-pipelines/gpu-tests.yml @@ -11,10 +11,12 @@ trigger: include: - "master" - "release/*" + - "future/*" - "refs/tags/*" pr: - "master" - "release/*" + - "future/*" jobs: - job: pytest diff --git a/.azure-pipelines/hpu-tests.yml b/.azure-pipelines/hpu-tests.yml index c4abbe3c949fd..8fc6de45d6dfc 100644 --- a/.azure-pipelines/hpu-tests.yml +++ b/.azure-pipelines/hpu-tests.yml @@ -8,10 +8,12 @@ trigger: include: - "master" - "release/*" + - "future/*" - "refs/tags/*" pr: - "master" - "release/*" + - "future/*" jobs: - job: tests diff --git a/.azure-pipelines/ipu-tests.yml b/.azure-pipelines/ipu-tests.yml index 80d49f9da3e78..e314c6d1bf58a 100644 --- a/.azure-pipelines/ipu-tests.yml +++ b/.azure-pipelines/ipu-tests.yml @@ -5,11 +5,13 @@ trigger: branches: include: - master - - release/* - - refs/tags/* + - "release/*" + - "future/*" + - "refs/tags/*" pr: - master - - release/* + - "release/*" + - "future/*" variables: - name: poplar_sdk diff --git a/.circleci/config.yml b/.circleci/config.yml index 73e658d304c8c..c54d24d920607 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,6 +13,7 @@ trigger: include: - "master" - "release/*" + - "future/*" - "refs/tags/*" pr: - "master" diff --git a/.github/workflows/ci_dockers.yml b/.github/workflows/ci_dockers.yml index ccd3fd27aaf8d..bf78ce33947fb 100644 --- a/.github/workflows/ci_dockers.yml +++ b/.github/workflows/ci_dockers.yml @@ -4,9 +4,9 @@ name: Docker # see: https://help.github.com/en/actions/reference/events-that-trigger-workflows on: # Trigger the workflow on push or pull request, but only for the master branch push: - branches: [master, "release/*"] # include release branches like release/1.0.x + branches: [master, "release/*", "future/*"] # include release branches like release/1.0.x pull_request: - branches: [master, "release/*"] + branches: [master, "release/*", "future/*"] paths: - "dockers/**" - "!dockers/README.md" diff --git a/.github/workflows/ci_pkg-install.yml b/.github/workflows/ci_pkg-install.yml index 9937a0eb73e87..6862732c9d79d 100644 --- a/.github/workflows/ci_pkg-install.yml +++ b/.github/workflows/ci_pkg-install.yml @@ -3,9 +3,9 @@ name: Package # see: https://help.github.com/en/actions/reference/events-that-trigger-workflows on: # Trigger the workflow on push or pull request, but only for the master branch push: - branches: [master, "release/*"] + branches: [master, "release/*", "future/*"] pull_request: - branches: [master, "release/*"] + branches: [master, "release/*", "future/*"] concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }} diff --git a/.github/workflows/ci_schema.yml b/.github/workflows/ci_schema.yml index 54efaff27a201..01640b430940e 100644 --- a/.github/workflows/ci_schema.yml +++ b/.github/workflows/ci_schema.yml @@ -2,7 +2,7 @@ name: Schema on: # Trigger the workflow on push or pull request, but only for the master branch push: {} pull_request: - branches: [master, "release/*"] + branches: [master, "release/*", "future/*"] jobs: check: diff --git a/.github/workflows/ci_test-conda.yml b/.github/workflows/ci_test-conda.yml index 0466a83760338..7e28911bf28ff 100644 --- a/.github/workflows/ci_test-conda.yml +++ b/.github/workflows/ci_test-conda.yml @@ -3,9 +3,9 @@ name: Test with Conda # see: https://help.github.com/en/actions/reference/events-that-trigger-workflows on: # Trigger the workflow on push or pull request, but only for the master branch push: - branches: [master, "release/*"] + branches: [master, "release/*", "future/*"] pull_request: - branches: [master, "release/*"] + branches: [master, "release/*", "future/*"] concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }} diff --git a/.github/workflows/ci_test-full.yml b/.github/workflows/ci_test-full.yml index bca5699d43029..32f9286348ddc 100644 --- a/.github/workflows/ci_test-full.yml +++ b/.github/workflows/ci_test-full.yml @@ -3,9 +3,9 @@ name: Test full # see: https://help.github.com/en/actions/reference/events-that-trigger-workflows on: # Trigger the workflow on push or pull request, but only for the master branch push: - branches: [master, "release/*"] + branches: [master, "release/*", "future/*"] pull_request: - branches: [master, "release/*"] + branches: [master, "release/*", "future/*"] types: [opened, reopened, ready_for_review, synchronize] concurrency: diff --git a/.github/workflows/ci_test-slow.yml b/.github/workflows/ci_test-slow.yml index e2b5ca20b2f95..3b8c7a6d89816 100644 --- a/.github/workflows/ci_test-slow.yml +++ b/.github/workflows/ci_test-slow.yml @@ -3,9 +3,9 @@ name: Test slow # see: https://help.github.com/en/actions/reference/events-that-trigger-workflows on: # Trigger the workflow on push or pull request, but only for the master branch push: - branches: [master, "release/*"] + branches: [master, "release/*", "future/*"] pull_request: - branches: [master, "release/*"] + branches: [master, "release/*", "future/*"] concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }} diff --git a/.github/workflows/code-checks.yml b/.github/workflows/code-checks.yml index 8f4aa133372fb..76dcfd6069b0d 100644 --- a/.github/workflows/code-checks.yml +++ b/.github/workflows/code-checks.yml @@ -2,9 +2,9 @@ name: Code check on: # Trigger the workflow on push or pull request, but only for the master branch push: - branches: [master, "release/*"] + branches: [master, "release/*", "future/*"] pull_request: - branches: [master, "release/*"] + branches: [master, "release/*", "future/*"] concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }} diff --git a/.github/workflows/docs-checks.yml b/.github/workflows/docs-checks.yml index d41ad44047294..f6b2311e17c97 100644 --- a/.github/workflows/docs-checks.yml +++ b/.github/workflows/docs-checks.yml @@ -3,9 +3,9 @@ name: Check Docs on: # Trigger the workflow on push or pull request, but only for the master branch push: - branches: [master, "release/*"] + branches: [master, "release/*", "future/*"] pull_request: - branches: [master, "release/*"] + branches: [master, "release/*", "future/*"] concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }} diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index 936373e83884c..6a8f403611e7c 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -3,7 +3,7 @@ name: Docker # https://github.com/docker/build-push-action on: push: - branches: [master, "release/*"] + branches: [master, "release/*", "future/*"] release: types: [published] diff --git a/.github/workflows/release-pypi.yml b/.github/workflows/release-pypi.yml index d7398e8e142e2..397b6a64823be 100644 --- a/.github/workflows/release-pypi.yml +++ b/.github/workflows/release-pypi.yml @@ -3,7 +3,7 @@ name: PyPI # https://help.github.com/en/actions/reference/events-that-trigger-workflows on: # Trigger the workflow on push or pull request, but only for the master branch push: - branches: [master, "release/*"] + branches: [master, "release/*", "future/*"] release: types: [published] From c4d737ce0038491d304547f96d6bafca180eb47e Mon Sep 17 00:00:00 2001 From: Jirka Date: Wed, 8 Jun 2022 00:56:55 +0200 Subject: [PATCH 07/20] update setup & install --- .github/workflows/ci_pkg-install.yml | 6 +- setup.py | 178 +++++++++++++++++++-------- src/pytorch_lightning/setup_tools.py | 88 ------------- 3 files changed, 128 insertions(+), 144 deletions(-) delete mode 100644 src/pytorch_lightning/setup_tools.py diff --git a/.github/workflows/ci_pkg-install.yml b/.github/workflows/ci_pkg-install.yml index 6862732c9d79d..0307e8a63fd82 100644 --- a/.github/workflows/ci_pkg-install.yml +++ b/.github/workflows/ci_pkg-install.yml @@ -49,17 +49,19 @@ jobs: pip install -r requirements.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html - name: Install | Uninstall package - archive + working-directory: ./dist run: | # install as archive - pip install dist/*.tar.gz + pip install *.tar.gz cd .. python -c "import pytorch_lightning as pl ; print(pl.__version__)" pip uninstall -y pytorch-lightning - name: Install | Uninstall package - wheel + working-directory: ./dist run: | # install as wheel - pip install dist/*.whl + pip install *.whl cd .. python -c "import pytorch_lightning as pl ; print(pl.__version__)" pip uninstall -y pytorch-lightning diff --git a/setup.py b/setup.py index 57f59045ed256..ba744ffee2936 100755 --- a/setup.py +++ b/setup.py @@ -14,7 +14,9 @@ # limitations under the License. import os +import re from importlib.util import module_from_spec, spec_from_file_location +from typing import List from pkg_resources import parse_requirements from setuptools import find_packages, setup @@ -26,14 +28,82 @@ def _load_py_module(fname, pkg="pytorch_lightning"): - spec = spec_from_file_location(os.path.join(pkg, fname), os.path.join(_PATH_ROOT, pkg, fname)) + spec = spec_from_file_location(os.path.join(pkg, fname), os.path.join(_PATH_ROOT, "src", pkg, fname)) py = module_from_spec(spec) spec.loader.exec_module(py) return py -about = _load_py_module("__about__.py") -setup_tools = _load_py_module("setup_tools.py") +def _load_requirements( + path_dir: str, file_name: str = "base.txt", comment_char: str = "#", unfreeze: bool = True +) -> List[str]: + """Load requirements from a file. + + >>> _load_requirements(os.path.join(_PATH_ROOT, "requirements")) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE + ['numpy...', 'torch...', ...] + """ + with open(os.path.join(path_dir, file_name)) as file: + lines = [ln.strip() for ln in file.readlines()] + reqs = [] + for ln in lines: + # filer all comments + comment = "" + if comment_char in ln: + comment = ln[ln.index(comment_char) :] + ln = ln[: ln.index(comment_char)] + req = ln.strip() + # skip directly installed dependencies + if not req or req.startswith("http") or "@http" in req: + continue + # remove version restrictions unless they are strict + if unfreeze and "<" in req and "strict" not in comment: + req = re.sub(r",? *<=? *[\d\.\*]+", "", req).strip() + reqs.append(req) + return reqs + + +def _load_readme_description(path_dir: str, homepage: str, version: str) -> str: + """Load readme as decribtion. + + >>> _load_readme_description(_PATH_ROOT, "", "") # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE + '
...' + """ + path_readme = os.path.join(path_dir, "README.md") + text = open(path_readme, encoding="utf-8").read() + + # drop images from readme + text = text.replace("![PT to PL](docs/source/_static/images/general/pl_quick_start_full_compressed.gif)", "") + + # https://github.com/PyTorchLightning/pytorch-lightning/raw/master/docs/source/_static/images/lightning_module/pt_to_pl.png + github_source_url = os.path.join(homepage, "raw", version) + # replace relative repository path to absolute link to the release + # do not replace all "docs" as in the readme we reger some other sources with particular path to docs + text = text.replace("docs/source/_static/", f"{os.path.join(github_source_url, 'docs/source/_static/')}") + + # readthedocs badge + text = text.replace("badge/?version=stable", f"badge/?version={version}") + text = text.replace("pytorch-lightning.readthedocs.io/en/stable/", f"pytorch-lightning.readthedocs.io/en/{version}") + # codecov badge + text = text.replace("/branch/master/graph/badge.svg", f"/release/{version}/graph/badge.svg") + # replace github badges for release ones + text = text.replace("badge.svg?branch=master&event=push", f"badge.svg?tag={version}") + # Azure... + text = text.replace("?branchName=master", f"?branchName=refs%2Ftags%2F{version}") + text = re.sub(r"\?definitionId=\d+&branchName=master", f"?definitionId=2&branchName=refs%2Ftags%2F{version}", text) + + skip_begin = r"" + skip_end = r"" + # todo: wrap content as commented description + text = re.sub(rf"{skip_begin}.+?{skip_end}", "", text, flags=re.IGNORECASE + re.DOTALL) + + # # https://github.com/Borda/pytorch-lightning/releases/download/1.1.0a6/codecov_badge.png + # github_release_url = os.path.join(homepage, "releases", "download", version) + # # download badge and replace url with local file + # text = _parse_for_badge(text, github_release_url) + return text + + +PKG_ABOUT = _load_py_module("__about__.py") # https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-extras # Define package extras. These are only installed if you specify them. @@ -41,11 +111,11 @@ def _load_py_module(fname, pkg="pytorch_lightning"): # From local copy of repo, use like `pip install ".[dev, docs]"` extras = { # 'docs': load_requirements(file_name='docs.txt'), - "examples": setup_tools._load_requirements(path_dir=_PATH_REQUIRE, file_name="examples.txt"), - "loggers": setup_tools._load_requirements(path_dir=_PATH_REQUIRE, file_name="loggers.txt"), - "extra": setup_tools._load_requirements(path_dir=_PATH_REQUIRE, file_name="extra.txt"), - "strategies": setup_tools._load_requirements(path_dir=_PATH_REQUIRE, file_name="strategies.txt"), - "test": setup_tools._load_requirements(path_dir=_PATH_REQUIRE, file_name="test.txt"), + "examples": _load_requirements(path_dir=_PATH_REQUIRE, file_name="examples.txt"), + "loggers": _load_requirements(path_dir=_PATH_REQUIRE, file_name="loggers.txt"), + "extra": _load_requirements(path_dir=_PATH_REQUIRE, file_name="extra.txt"), + "strategies": _load_requirements(path_dir=_PATH_REQUIRE, file_name="strategies.txt"), + "test": _load_requirements(path_dir=_PATH_REQUIRE, file_name="test.txt"), } for req in parse_requirements(extras["strategies"]): @@ -53,55 +123,55 @@ def _load_py_module(fname, pkg="pytorch_lightning"): extras["dev"] = extras["extra"] + extras["loggers"] + extras["test"] extras["all"] = extras["dev"] + extras["examples"] + extras["strategies"] # + extras['docs'] -long_description = setup_tools._load_readme_description( - _PATH_ROOT, homepage=about.__homepage__, version=about.__version__ -) +long_description = _load_readme_description(_PATH_ROOT, homepage=PKG_ABOUT.__homepage__, version=PKG_ABOUT.__version__) # https://packaging.python.org/discussions/install-requires-vs-requirements / # keep the meta-data here for simplicity in reading this file... it's not obvious # what happens and to non-engineers they won't know to look in init ... # the goal of the project is simplicity for researchers, don't want to add too much # engineer specific practices -setup( - name="pytorch-lightning", - version=about.__version__, - description=about.__docs__, - author=about.__author__, - author_email=about.__author_email__, - url=about.__homepage__, - download_url="https://github.com/PyTorchLightning/pytorch-lightning", - license=about.__license__, - packages=find_packages(exclude=["tests*", "pl_examples*", "legacy*"]), - include_package_data=True, - long_description=long_description, - long_description_content_type="text/markdown", - zip_safe=False, - keywords=["deep learning", "pytorch", "AI"], - python_requires=">=3.7", - setup_requires=[], - install_requires=setup_tools._load_requirements(_PATH_REQUIRE), - extras_require=extras, - project_urls={ - "Bug Tracker": "https://github.com/PyTorchLightning/pytorch-lightning/issues", - "Documentation": "https://pytorch-lightning.rtfd.io/en/latest/", - "Source Code": "https://github.com/PyTorchLightning/pytorch-lightning", - }, - classifiers=[ - "Environment :: Console", - "Natural Language :: English", - "Development Status :: 5 - Production/Stable", - # Indicate who your project is intended for - "Intended Audience :: Developers", - "Topic :: Scientific/Engineering :: Artificial Intelligence", - "Topic :: Scientific/Engineering :: Image Recognition", - "Topic :: Scientific/Engineering :: Information Analysis", - # Pick your license as you wish - "License :: OSI Approved :: Apache Software License", - "Operating System :: OS Independent", - # Specify the Python versions you support here. - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - ], -) +if __name__ == "__main__": + setup( + name="pytorch-lightning", + version=PKG_ABOUT.__version__, + description=PKG_ABOUT.__docs__, + author=PKG_ABOUT.__author__, + author_email=PKG_ABOUT.__author_email__, + url=PKG_ABOUT.__homepage__, + download_url="https://github.com/PyTorchLightning/pytorch-lightning", + license=PKG_ABOUT.__license__, + packages=find_packages(where="src"), + package_dir={"": "src"}, + include_package_data=True, + long_description=long_description, + long_description_content_type="text/markdown", + zip_safe=False, + keywords=["deep learning", "pytorch", "AI"], + python_requires=">=3.7", + setup_requires=[], + install_requires=_load_requirements(_PATH_REQUIRE), + extras_require=extras, + project_urls={ + "Bug Tracker": "https://github.com/PyTorchLightning/pytorch-lightning/issues", + "Documentation": "https://pytorch-lightning.rtfd.io/en/latest/", + "Source Code": "https://github.com/PyTorchLightning/pytorch-lightning", + }, + classifiers=[ + "Environment :: Console", + "Natural Language :: English", + "Development Status :: 5 - Production/Stable", + # Indicate who your project is intended for + "Intended Audience :: Developers", + "Topic :: Scientific/Engineering :: Artificial Intelligence", + "Topic :: Scientific/Engineering :: Image Recognition", + "Topic :: Scientific/Engineering :: Information Analysis", + # Pick your license as you wish + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", + # Specify the Python versions you support here. + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + ], + ) diff --git a/src/pytorch_lightning/setup_tools.py b/src/pytorch_lightning/setup_tools.py deleted file mode 100644 index 2df3c7946b4d9..0000000000000 --- a/src/pytorch_lightning/setup_tools.py +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env python -# Copyright The PyTorch Lightning team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -import os -import re -from typing import List - -_PROJECT_ROOT = os.path.dirname(os.path.dirname(__file__)) - - -def _load_requirements( - path_dir: str, file_name: str = "base.txt", comment_char: str = "#", unfreeze: bool = True -) -> List[str]: - """Load requirements from a file. - - >>> _load_requirements(os.path.join(_PROJECT_ROOT, "requirements")) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE - ['numpy...', 'torch...', ...] - """ - with open(os.path.join(path_dir, file_name)) as file: - lines = [ln.strip() for ln in file.readlines()] - reqs = [] - for ln in lines: - # filer all comments - comment = "" - if comment_char in ln: - comment = ln[ln.index(comment_char) :] - ln = ln[: ln.index(comment_char)] - req = ln.strip() - # skip directly installed dependencies - if not req or req.startswith("http") or "@http" in req: - continue - # remove version restrictions unless they are strict - if unfreeze and "<" in req and "strict" not in comment: - req = re.sub(r",? *<=? *[\d\.\*]+", "", req).strip() - reqs.append(req) - return reqs - - -def _load_readme_description(path_dir: str, homepage: str, version: str) -> str: - """Load readme as decribtion. - - >>> _load_readme_description(_PROJECT_ROOT, "", "") # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE - '
...' - """ - path_readme = os.path.join(path_dir, "README.md") - text = open(path_readme, encoding="utf-8").read() - - # drop images from readme - text = text.replace("![PT to PL](docs/source/_static/images/general/pl_quick_start_full_compressed.gif)", "") - - # https://github.com/PyTorchLightning/pytorch-lightning/raw/master/docs/source/_static/images/lightning_module/pt_to_pl.png - github_source_url = os.path.join(homepage, "raw", version) - # replace relative repository path to absolute link to the release - # do not replace all "docs" as in the readme we reger some other sources with particular path to docs - text = text.replace("docs/source/_static/", f"{os.path.join(github_source_url, 'docs/source/_static/')}") - - # readthedocs badge - text = text.replace("badge/?version=stable", f"badge/?version={version}") - text = text.replace("pytorch-lightning.readthedocs.io/en/stable/", f"pytorch-lightning.readthedocs.io/en/{version}") - # codecov badge - text = text.replace("/branch/master/graph/badge.svg", f"/release/{version}/graph/badge.svg") - # replace github badges for release ones - text = text.replace("badge.svg?branch=master&event=push", f"badge.svg?tag={version}") - # Azure... - text = text.replace("?branchName=master", f"?branchName=refs%2Ftags%2F{version}") - text = re.sub(r"\?definitionId=\d+&branchName=master", f"?definitionId=2&branchName=refs%2Ftags%2F{version}", text) - - skip_begin = r"" - skip_end = r"" - # todo: wrap content as commented description - text = re.sub(rf"{skip_begin}.+?{skip_end}", "", text, flags=re.IGNORECASE + re.DOTALL) - - # # https://github.com/Borda/pytorch-lightning/releases/download/1.1.0a6/codecov_badge.png - # github_release_url = os.path.join(homepage, "releases", "download", version) - # # download badge and replace url with local file - # text = _parse_for_badge(text, github_release_url) - return text From 5fa7f0edee4f83bc58a4dcd1d802eae35652cc3b Mon Sep 17 00:00:00 2001 From: Jirka Date: Wed, 8 Jun 2022 00:23:43 +0200 Subject: [PATCH 08/20] GHA: update paths --- .actions/pull_legacy_checkpoints.sh | 10 +++--- .github/workflows/ci_pkg-install.yml | 8 ++--- .github/workflows/ci_test-conda.yml | 19 ++++++------ .github/workflows/ci_test-full.yml | 31 ++++++++++--------- .github/workflows/ci_test-slow.yml | 16 +++++----- .github/workflows/code-checks.yml | 2 +- .github/workflows/docs-checks.yml | 3 +- .github/workflows/legacy-checkpoints.yml | 8 ++--- .github/workflows/release-pypi.yml | 5 +-- requirements/test.txt | 3 +- .../basic_examples/mnist_datamodule.py | 2 +- test/unittests/__init__.py | 14 ++++----- .../checkpointing/test_legacy_checkpoints.py | 4 +-- test/unittests/utilities/test_cli.py | 12 +++---- 14 files changed, 72 insertions(+), 65 deletions(-) diff --git a/.actions/pull_legacy_checkpoints.sh b/.actions/pull_legacy_checkpoints.sh index 8b3f791297b66..c1a88067c8d98 100644 --- a/.actions/pull_legacy_checkpoints.sh +++ b/.actions/pull_legacy_checkpoints.sh @@ -1,9 +1,9 @@ #!/bin/bash # Run this script from the project root. URL="https://pl-public-data.s3.amazonaws.com/legacy/checkpoints.zip" -mkdir -p legacy +mkdir -p test/legacy # wget is simpler but does not work on Windows -python -c "from urllib.request import urlretrieve; urlretrieve('$URL', 'legacy/checkpoints.zip')" -ls -l legacy/ -unzip -o legacy/checkpoints.zip -d legacy/ -ls -l legacy/checkpoints/ +python -c "from urllib.request import urlretrieve; urlretrieve('$URL', 'test/legacy/checkpoints.zip')" +ls -l test/legacy/ +unzip -o test/legacy/checkpoints.zip -d test/legacy/ +ls -l test/legacy/checkpoints/ diff --git a/.github/workflows/ci_pkg-install.yml b/.github/workflows/ci_pkg-install.yml index 0307e8a63fd82..8c7e188504783 100644 --- a/.github/workflows/ci_pkg-install.yml +++ b/.github/workflows/ci_pkg-install.yml @@ -54,8 +54,8 @@ jobs: # install as archive pip install *.tar.gz cd .. - python -c "import pytorch_lightning as pl ; print(pl.__version__)" - pip uninstall -y pytorch-lightning + python -c "import pytorch_lightning ; print(pytorch_lightning.__version__)" + pip uninstall -y pytorch_lightning - name: Install | Uninstall package - wheel working-directory: ./dist @@ -63,5 +63,5 @@ jobs: # install as wheel pip install *.whl cd .. - python -c "import pytorch_lightning as pl ; print(pl.__version__)" - pip uninstall -y pytorch-lightning + python -c "import pytorch_lightning ; print(pytorch_lightning.__version__)" + pip uninstall -y pytorch_lightning diff --git a/.github/workflows/ci_test-conda.yml b/.github/workflows/ci_test-conda.yml index 7e28911bf28ff..ed989d6833354 100644 --- a/.github/workflows/ci_test-conda.yml +++ b/.github/workflows/ci_test-conda.yml @@ -39,11 +39,12 @@ jobs: run: | conda info conda list + pip install -e . pip install -r requirements/test.txt - name: DocTests - run: | - coverage run --source pytorch_lightning -m pytest pytorch_lightning + working-directory: ./src + run: pytest pytorch_lightning --cov=pytorch_lightning - name: Update all dependencies env: @@ -67,19 +68,19 @@ jobs: run: bash .actions/pull_legacy_checkpoints.sh - name: UnitTests - run: | - coverage run --source pytorch_lightning -m pytest --timeout 150 tests -v --durations=50 --junitxml=junit/test-results-${{ runner.os }}-torch${{ matrix.pytorch-version }}.xml + working-directory: ./test + run: coverage run --source pytorch_lightning -m pytest unittests -v --timeout 150 --durations=50 --junitxml=results-${{ runner.os }}-torch${{ matrix.pytorch-version }}.xml - name: Upload pytest results uses: actions/upload-artifact@v2 with: - name: pytest-results-${{ runner.os }}-torch${{ matrix.pytorch-version }} - path: junit/test-results-${{ runner.os }}-torch${{ matrix.pytorch-version }}.xml - if-no-files-found: error + name: unittest-results-${{ runner.os }}-torch${{ matrix.pytorch-version }} + path: test/results-${{ runner.os }}-torch${{ matrix.pytorch-version }}.xml if: failure() - name: Statistics if: success() + working-directory: ./test run: | coverage report coverage xml @@ -91,7 +92,7 @@ jobs: continue-on-error: true with: token: ${{ secrets.CODECOV_TOKEN }} - file: coverage.xml - flags: cpu,pytest,torch${{ matrix.pytorch-version }} + file: test/coverage.xml + flags: cpu,unittests,conda,torch${{ matrix.pytorch-version }} name: CPU-coverage fail_ci_if_error: false diff --git a/.github/workflows/ci_test-full.yml b/.github/workflows/ci_test-full.yml index 32f9286348ddc..8fcbfb7f3a240 100644 --- a/.github/workflows/ci_test-full.yml +++ b/.github/workflows/ci_test-full.yml @@ -83,13 +83,14 @@ jobs: run: | flag=$(python -c "print('--pre' if '${{matrix.release}}' == 'pre' else '')" 2>&1) url=$(python -c "print('test/cpu/torch_test.html' if '${{matrix.release}}' == 'pre' else 'cpu/torch_stable.html')" 2>&1) - pip install -r requirements.txt --upgrade $flag --find-links "https://download.pytorch.org/whl/${url}" + pip install -e . --upgrade $flag --find-links "https://download.pytorch.org/whl/${url}" pip install -r requirements/test.txt --upgrade pip list shell: bash - name: DocTests - run: coverage run --source pytorch_lightning -m pytest pytorch_lightning + working-directory: ./src + run: pytest pytorch_lightning --cov=pytorch_lightning - name: Install extra dependencies run: | @@ -123,31 +124,33 @@ jobs: key: pl-dataset - name: Sanity check - run: | - python requirements/check-avail-extras.py + run: python requirements/check-avail-extras.py - name: UnitTests - run: | - # NOTE: do not include coverage report here, see: https://github.com/nedbat/coveragepy/issues/1003 - coverage run --source pytorch_lightning -m pytest pytorch_lightning tests -v --durations=50 --junitxml=junit/test-results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}.xml + working-directory: ./test + # NOTE: do not include coverage report here, see: https://github.com/nedbat/coveragepy/issues/1003 + run: coverage run --source pytorch_lightning -m pytest unittests -v --durations=50 --junitxml=results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}.xml - - name: Examples + - name: Prepare Examples run: | # adjust versions according installed Torch version python ./requirements/adjust-versions.py requirements/examples.txt pip install -r requirements/examples.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --upgrade - python -m pytest pl_examples -v --durations=10 + + - name: Run Examples + working-directory: ./src + run: python -m pytest pl_examples -v --durations=10 - name: Upload pytest results uses: actions/upload-artifact@v2 with: - name: pytest-results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }} - path: junit/test-results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}.xml - if-no-files-found: error + name: unittest-results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }} + path: test/results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}.xml if: failure() - name: Statistics if: success() + working-directory: ./test run: | coverage report coverage xml @@ -159,7 +162,7 @@ jobs: continue-on-error: true with: token: ${{ secrets.CODECOV_TOKEN }} - file: coverage.xml - flags: cpu,pytest,python${{ matrix.python-version }} + file: test/coverage.xml + flags: cpu,unittests,python${{ matrix.python-version }},${{ matrix.requires }} name: CPU-coverage fail_ci_if_error: false diff --git a/.github/workflows/ci_test-slow.yml b/.github/workflows/ci_test-slow.yml index 3b8c7a6d89816..345acd92268f3 100644 --- a/.github/workflows/ci_test-slow.yml +++ b/.github/workflows/ci_test-slow.yml @@ -49,27 +49,27 @@ jobs: run: | # adjust versions according installed Torch version python ./requirements/adjust-versions.py requirements.txt ${{ matrix.pytorch-version }} - pip install -r requirements.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --upgrade + pip install -e . --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --upgrade pip install -r requirements/test.txt pip list shell: bash - name: Tests - run: | - coverage run --source pytorch_lightning -m pytest tests -v --junitxml=junit/test-results-${{ runner.os }}-py${{ matrix.python-version }}.xml + working-directory: ./test + run: coverage run --source pytorch_lightning -m pytest unittests -v --junitxml=results-${{ runner.os }}-py${{ matrix.python-version }}.xml env: PL_RUN_SLOW_TESTS: 1 - name: Upload pytest test results uses: actions/upload-artifact@v2 with: - name: pytest-results-${{ runner.os }}-py${{ matrix.python-version }} - path: junit/test-results-${{ runner.os }}-py${{ matrix.python-version }}.xml - if-no-files-found: error + name: unittest-results-${{ runner.os }}-py${{ matrix.python-version }} + path: test/results-${{ runner.os }}-py${{ matrix.python-version }}.xml if: failure() - name: Statistics if: success() + working-directory: ./test run: | coverage report coverage xml @@ -81,7 +81,7 @@ jobs: continue-on-error: true with: token: ${{ secrets.CODECOV_TOKEN }} - file: coverage.xml - flags: cpu,pytest,torch${{ matrix.pytorch-version }} + file: test/coverage.xml + flags: cpu,unittests,torch${{ matrix.pytorch-version }} name: CPU-coverage fail_ci_if_error: false diff --git a/.github/workflows/code-checks.yml b/.github/workflows/code-checks.yml index 76dcfd6069b0d..183b9b6002a45 100644 --- a/.github/workflows/code-checks.yml +++ b/.github/workflows/code-checks.yml @@ -37,4 +37,4 @@ jobs: pip list - name: Type check - run: mypy --install-types --non-interactive + run: mypy src/ --install-types --non-interactive diff --git a/.github/workflows/docs-checks.yml b/.github/workflows/docs-checks.yml index f6b2311e17c97..a2d717ce2d3ee 100644 --- a/.github/workflows/docs-checks.yml +++ b/.github/workflows/docs-checks.yml @@ -42,7 +42,7 @@ jobs: pip --version pip install -q fire # python -m pip install --upgrade --user pip - pip install -r requirements.txt --upgrade-strategy only-if-needed --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet + pip install -e . --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet pip install -r requirements/devel.txt pip install -r requirements/docs.txt pip list @@ -83,6 +83,7 @@ jobs: sudo apt-get update sudo apt-get install -y cmake pandoc pip --version + pip install -e . pip install --requirement requirements/docs.txt # install Texlive, see https://linuxconfig.org/how-to-install-latex-on-ubuntu-20-04-focal-fossa-linux sudo apt-get update && sudo apt-get install -y texlive-latex-extra dvipng texlive-pictures diff --git a/.github/workflows/legacy-checkpoints.yml b/.github/workflows/legacy-checkpoints.yml index 6f9cb05a5c39c..c962fe6570587 100644 --- a/.github/workflows/legacy-checkpoints.yml +++ b/.github/workflows/legacy-checkpoints.yml @@ -29,12 +29,12 @@ jobs: - name: Generate checkpoint run: | while IFS= read -r line; do - bash legacy/generate_checkpoints.sh $line - done <<< $(cat legacy/back-compatible-versions.txt) + bash test/legacy/generate_checkpoints.sh $line + done <<< $(cat test/legacy/back-compatible-versions.txt) - name: Push files to S3 - working-directory: ./legacy + working-directory: ./test/legacy run: | - aws s3 sync legacy/checkpoints/ s3://pl-public-data/legacy/checkpoints/ + aws s3 sync checkpoints/ s3://pl-public-data/legacy/checkpoints/ zip -r checkpoints.zip checkpoints aws s3 cp checkpoints.zip s3://pl-public-data/legacy/ --acl public-read diff --git a/.github/workflows/release-pypi.yml b/.github/workflows/release-pypi.yml index 397b6a64823be..55233dcefe997 100644 --- a/.github/workflows/release-pypi.yml +++ b/.github/workflows/release-pypi.yml @@ -123,8 +123,9 @@ jobs: path: dist - name: Pull files from S3 + working-directory: ./test/legacy run: | - aws s3 cp --recursive s3://pl-public-data/legacy/checkpoints/ legacy/checkpoints/ # --acl public-read + aws s3 cp --recursive s3://pl-public-data/legacy/checkpoints/ checkpoints/ # --acl public-read ls -l legacy/checkpoints/ - name: Generate checkpoint @@ -137,7 +138,7 @@ jobs: bash legacy/generate_checkpoints.sh $pl_ver - name: Push files to S3 - working-directory: ./legacy + working-directory: ./test/legacy run: | aws s3 sync legacy/checkpoints/ s3://pl-public-data/legacy/checkpoints/ zip -r checkpoints.zip checkpoints diff --git a/requirements/test.txt b/requirements/test.txt index d9d7bea91f632..acd2e273bda56 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,11 +1,12 @@ coverage>=6.4 codecov>=2.1 pytest>=6.0 +pytest-cov +pytest-forked pytest-rerunfailures>=10.2 mypy>=0.920 flake8>=3.9.2 pre-commit>=1.0 -pytest-forked # needed in tests cloudpickle>=1.3 diff --git a/src/pl_examples/basic_examples/mnist_datamodule.py b/src/pl_examples/basic_examples/mnist_datamodule.py index 31a2e284dd8ba..d47be33dd98d9 100644 --- a/src/pl_examples/basic_examples/mnist_datamodule.py +++ b/src/pl_examples/basic_examples/mnist_datamodule.py @@ -33,7 +33,7 @@ class _MNIST(Dataset): - """Carbon copy of ``tests.helpers.datasets.MNIST``. + """Carbon copy of ``unittests.helpers.datasets.MNIST``. We cannot import the tests as they are not distributed with the package. See https://github.com/PyTorchLightning/pytorch-lightning/pull/7614#discussion_r671183652 for more context. diff --git a/test/unittests/__init__.py b/test/unittests/__init__.py index 9039a6e4b16e9..6baae528c94e6 100644 --- a/test/unittests/__init__.py +++ b/test/unittests/__init__.py @@ -16,16 +16,16 @@ import numpy as np -_TEST_ROOT = os.path.dirname(__file__) -_PROJECT_ROOT = os.path.dirname(_TEST_ROOT) -_TEMP_PATH = os.path.join(_PROJECT_ROOT, "test_temp") -_PATH_DATASETS = os.path.join(_PROJECT_ROOT, "Datasets") -_PATH_LEGACY = os.path.join(_PROJECT_ROOT, "legacy") +_UNITTEST_ROOT = os.path.dirname(__file__) +_TEST_ROOT = os.path.dirname(_UNITTEST_ROOT) +_TEMP_PATH = os.path.join(_TEST_ROOT, "test_temp") +_PATH_DATASETS = os.path.join(_TEST_ROOT, "Datasets") +_PATH_LEGACY = os.path.join(_TEST_ROOT, "legacy") # todo: this setting `PYTHONPATH` may not be used by other evns like Conda for import packages -if _PROJECT_ROOT not in os.getenv("PYTHONPATH", ""): +if _TEST_ROOT not in os.getenv("PYTHONPATH", ""): splitter = ":" if os.environ.get("PYTHONPATH", "") else "" - os.environ["PYTHONPATH"] = f'{_PROJECT_ROOT}{splitter}{os.environ.get("PYTHONPATH", "")}' + os.environ["PYTHONPATH"] = f'{_TEST_ROOT}{splitter}{os.environ.get("PYTHONPATH", "")}' # generate a list of random seeds for each test RANDOM_PORTS = list(np.random.randint(12000, 19000, 1000)) diff --git a/test/unittests/checkpointing/test_legacy_checkpoints.py b/test/unittests/checkpointing/test_legacy_checkpoints.py index 2d904fcfa2f1e..af220f334604a 100644 --- a/test/unittests/checkpointing/test_legacy_checkpoints.py +++ b/test/unittests/checkpointing/test_legacy_checkpoints.py @@ -22,12 +22,12 @@ import pytorch_lightning as pl from pytorch_lightning import Callback, Trainer -from unittests import _PATH_LEGACY, _PROJECT_ROOT +from unittests import _PATH_LEGACY, _TEST_ROOT LEGACY_CHECKPOINTS_PATH = os.path.join(_PATH_LEGACY, "checkpoints") CHECKPOINT_EXTENSION = ".ckpt" # load list of all back compatible versions -with open(os.path.join(_PROJECT_ROOT, "legacy", "back-compatible-versions.txt")) as fp: +with open(os.path.join(_TEST_ROOT, "legacy", "back-compatible-versions.txt")) as fp: LEGACY_BACK_COMPATIBLE_PL_VERSIONS = [ln.strip() for ln in fp.readlines()] diff --git a/test/unittests/utilities/test_cli.py b/test/unittests/utilities/test_cli.py index 1d690be8e6017..41cdff37ebc71 100644 --- a/test/unittests/utilities/test_cli.py +++ b/test/unittests/utilities/test_cli.py @@ -411,8 +411,8 @@ def test_lightning_cli_save_config_cases(tmpdir): def test_lightning_cli_config_and_subclass_mode(tmpdir): input_config = { "fit": { - "model": {"class_path": "tests.helpers.BoringModel"}, - "data": {"class_path": "tests.helpers.BoringDataModule", "init_args": {"data_dir": str(tmpdir)}}, + "model": {"class_path": "unittests.helpers.BoringModel"}, + "data": {"class_path": "unittests.helpers.BoringDataModule", "init_args": {"data_dir": str(tmpdir)}}, "trainer": {"default_root_dir": str(tmpdir), "max_epochs": 1, "enable_model_summary": False}, } } @@ -463,7 +463,7 @@ def test_lightning_cli_help(): if param not in skip_params: assert f"--trainer.{param}" in out - cli_args = ["any.py", "fit", "--data.help=tests.helpers.BoringDataModule"] + cli_args = ["any.py", "fit", "--data.help=unittests.helpers.BoringDataModule"] out = StringIO() with mock.patch("sys.argv", cli_args), redirect_stdout(out), pytest.raises(SystemExit): any_model_any_data_cli() @@ -476,8 +476,8 @@ def test_lightning_cli_print_config(): "any.py", "predict", "--seed_everything=1234", - "--model=tests.helpers.BoringModel", - "--data=tests.helpers.BoringDataModule", + "--model=unittests.helpers.BoringModel", + "--data=unittests.helpers.BoringDataModule", "--print_config", ] out = StringIO() @@ -592,7 +592,7 @@ def add_arguments_to_parser(self, parser): parser.link_arguments("data.batch_size", "model.init_args.batch_size") parser.link_arguments("data.num_classes", "model.init_args.num_classes", apply_on="instantiate") - cli_args[-1] = "--model=tests.utilities.test_cli.BoringModelRequiredClasses" + cli_args[-1] = "--model=unittests.utilities.test_cli.BoringModelRequiredClasses" with mock.patch("sys.argv", ["any.py"] + cli_args): cli = MyLightningCLI( From 276f011e50ee8f48be8099d1d6afd7b99dc77805 Mon Sep 17 00:00:00 2001 From: Jirka Date: Wed, 8 Jun 2022 16:30:07 +0200 Subject: [PATCH 09/20] CI: update Azure --- .azure-pipelines/gpu-benchmark.yml | 6 ++-- .azure-pipelines/gpu-tests.yml | 33 +++++++++++-------- .azure-pipelines/hpu-tests.yml | 20 ++++++----- .azure-pipelines/ipu-tests.yml | 22 ++++++++----- src/run_ddp_examples.sh | 21 ++++++++++++ ...alone_tests.sh => run_standalone_tests.sh} | 20 ++++------- 6 files changed, 76 insertions(+), 46 deletions(-) create mode 100644 src/run_ddp_examples.sh rename test/{standalone_tests.sh => run_standalone_tests.sh} (68%) diff --git a/.azure-pipelines/gpu-benchmark.yml b/.azure-pipelines/gpu-benchmark.yml index 3abd75f30d9f5..f466defe31958 100644 --- a/.azure-pipelines/gpu-benchmark.yml +++ b/.azure-pipelines/gpu-benchmark.yml @@ -35,8 +35,8 @@ jobs: clean: all steps: - - bash: | - python -m pytest tests/benchmarks -v --durations=0 - displayName: 'Testing: benchmarks' + - bash: python -m pytest unittests/benchmarks -v --durations=0 env: PL_RUNNING_BENCHMARKS: 1 + workingDirectory: test + displayName: 'Testing: benchmarks' diff --git a/.azure-pipelines/gpu-tests.yml b/.azure-pipelines/gpu-tests.yml index 30286d45be741..27c5fb9ddfba4 100644 --- a/.azure-pipelines/gpu-tests.yml +++ b/.azure-pipelines/gpu-tests.yml @@ -19,7 +19,7 @@ pr: - "future/*" jobs: - - job: pytest + - job: testing strategy: matrix: 'PyTorch - LTS': @@ -30,15 +30,12 @@ jobs: timeoutInMinutes: "100" # how much time to give 'run always even if cancelled tasks' before stopping them cancelTimeoutInMinutes: "2" - pool: azure-jirka-spot - container: image: $(image) # default shm size is 64m. Increase it to avoid: # 'Error while creating shared memory: unhandled system error, NCCL version 2.7.8' options: "--runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all --shm-size=512m" - workspace: clean: all @@ -58,8 +55,9 @@ jobs: python -c "fname = 'requirements/strategies.txt' ; lines = [line for line in open(fname).readlines() if 'horovod' not in line] ; open(fname, 'w').writelines(lines)" CUDA_VERSION_MM=$(python -c "import torch ; print(''.join(map(str, torch.version.cuda.split('.')[:2])))") pip install "bagua-cuda$CUDA_VERSION_MM>=0.9.0" - pip install . --requirement requirements/devel.txt - pip install . --requirement requirements/strategies.txt + pip install -e . + pip install --requirement requirements/devel.txt + pip install --requirement requirements/strategies.txt pip list displayName: 'Install dependencies' @@ -74,12 +72,16 @@ jobs: - bash: bash .actions/pull_legacy_checkpoints.sh displayName: 'Get legacy checkpoints' - - bash: | - python -m coverage run --source pytorch_lightning -m pytest pytorch_lightning tests --ignore tests/benchmarks -v --junitxml=$(Build.StagingDirectory)/test-results.xml --durations=50 - displayName: 'Testing: standard' + - bash: python -m coverage run --source pytorch_lightning -m pytest pytorch_lightning + workingDirectory: src + displayName: 'Testing: doctests' - - bash: | - bash tests/standalone_tests.sh + - bash: python -m coverage run --source pytorch_lightning -m pytest unittests --ignore unittests/benchmarks -v --junitxml=$(Build.StagingDirectory)/test-results.xml --durations=50 + displayName: 'Testing: unittests' + workingDirectory: test + + - bash: bash run_standalone_tests.sh + workingDirectory: test env: PL_USE_MOCKED_MNIST: "1" displayName: 'Testing: standalone' @@ -88,8 +90,9 @@ jobs: python -m coverage report python -m coverage xml python -m coverage html - python -m codecov --token=$(CODECOV_TOKEN) --commit=$(Build.SourceVersion) --flags=gpu,pytest --name="GPU-coverage" --env=linux,azure + python -m codecov --token=$(CODECOV_TOKEN) --commit=$(Build.SourceVersion) --flags=gpu,unittest --name="GPU-coverage" --env=linux,azure ls -l + workingDirectory: test displayName: 'Statistics' - task: PublishTestResults@2 @@ -111,14 +114,16 @@ jobs: - script: | set -e + bash run_ddp_examples.sh python -m pytest pl_examples -v --maxfail=2 --durations=0 bash pl_examples/run_examples.sh --trainer.accelerator=gpu --trainer.devices=1 bash pl_examples/run_examples.sh --trainer.accelerator=gpu --trainer.devices=2 --trainer.strategy=ddp bash pl_examples/run_examples.sh --trainer.accelerator=gpu --trainer.devices=2 --trainer.strategy=ddp --trainer.precision=16 + workingDirectory: src env: PL_USE_MOCKED_MNIST: "1" displayName: 'Testing: examples' - - bash: | - python -m pytest tests/benchmarks -v --maxfail=2 --durations=0 + - bash: python -m pytest unittests/benchmarks -v --maxfail=2 --durations=0 + workingDirectory: test displayName: 'Testing: benchmarks' diff --git a/.azure-pipelines/hpu-tests.yml b/.azure-pipelines/hpu-tests.yml index 8fc6de45d6dfc..c1e565632b1d5 100644 --- a/.azure-pipelines/hpu-tests.yml +++ b/.azure-pipelines/hpu-tests.yml @@ -16,15 +16,12 @@ pr: - "future/*" jobs: - - job: tests - + - job: testing # how long to run the job before automatically cancelling timeoutInMinutes: "10" # how much time to give 'run always even if cancelled tasks' before stopping them cancelTimeoutInMinutes: "2" - pool: intel-hpus - workspace: clean: all @@ -35,25 +32,32 @@ jobs: displayName: 'Instance HW info' - bash: | - pip install . --requirement requirements/extra.txt + pip install -e .[extra] pip install . --requirement requirements/test.txt displayName: 'Install dependencies' - bash: | - python -m pytest -sv tests/accelerators/test_hpu.py --forked --junitxml=hpu1_test-results.xml + python -m pytest -sv unittests/accelerators/test_hpu.py --forked --junitxml=hpu1_test-results.xml + workingDirectory: test displayName: 'Single card HPU test' - bash: | - python -m pytest -sv tests/accelerators/test_hpu.py --forked --hpus 8 --junitxml=hpu8_test-results.xml + python -m pytest -sv unittests/accelerators/test_hpu.py --forked --hpus 8 --junitxml=hpu8_test-results.xml + workingDirectory: test displayName: 'Multi card(8) HPU test' - bash: | - python -m pytest -sv tests/plugins/precision/hpu/test_hpu.py --hmp-bf16 'tests/plugins/precision/hpu/ops_bf16.txt' --hmp-fp32 'tests/plugins/precision/hpu/ops_fp32.txt' --forked --junitxml=hpu1_precision_test-results.xml + python -m pytest -sv unittests/plugins/precision/hpu/test_hpu.py --hmp-bf16 \ + 'unittests/plugins/precision/hpu/ops_bf16.txt' --hmp-fp32 \ + 'unittests/plugins/precision/hpu/ops_fp32.txt' --forked \ + --junitxml=hpu1_precision_test-results.xml + workingDirectory: test displayName: 'HPU precision test' - bash: | export PYTHONPATH="${PYTHONPATH}:$(pwd)" python "pl_examples/hpu_examples/simple_mnist/mnist.py" + workingDirectory: src displayName: 'Testing: HPU examples' - task: PublishTestResults@2 diff --git a/.azure-pipelines/ipu-tests.yml b/.azure-pipelines/ipu-tests.yml index e314c6d1bf58a..01ffd24b47fa9 100644 --- a/.azure-pipelines/ipu-tests.yml +++ b/.azure-pipelines/ipu-tests.yml @@ -18,12 +18,10 @@ variables: value: "poplar_sdk-ubuntu_20_04-2.3.1+793-89796d462d" jobs: - - job: tests - + - job: testing # how long to run the job before automatically cancelling timeoutInMinutes: "15" pool: graphcore-ipus - workspace: clean: all @@ -57,6 +55,7 @@ jobs: export GIT_TERMINAL_PROMPT=1 python ./requirements/adjust-versions.py requirements/extra.txt python ./requirements/adjust-versions.py requirements/examples.txt + pip install -e . pip install . --requirement ./requirements/devel.txt pip list displayName: 'Install dependencies' @@ -70,16 +69,23 @@ jobs: set -eux source ${{ variables.poplar_sdk }}/poplar-ubuntu*/enable.sh source ${{ variables.poplar_sdk }}/popart-ubuntu*/enable.sh - python -c "import poptorch; print(poptorch.__version__)" displayName: "Check poptorch installation" - bash: | source ${{ variables.poplar_sdk }}/poplar-ubuntu*/enable.sh source ${{ variables.poplar_sdk }}/popart-ubuntu*/enable.sh - export POPTORCH_WAIT_FOR_IPU=1 - export PL_RUN_IPU_TESTS=1 - python -m coverage run --source pytorch_lightning -m pytest tests -vv --junitxml=$(Build.StagingDirectory)/test-results.xml --durations=50 + cd src + python -m pytest pytorch_lightning + displayName: 'DocTests' + + - bash: | + source ${{ variables.poplar_sdk }}/poplar-ubuntu*/enable.sh + source ${{ variables.poplar_sdk }}/popart-ubuntu*/enable.sh + cd test + python -m coverage run --source pytorch_lightning -m pytest unittests -vv --durations=50 env: MKL_THREADING_LAYER: "GNU" - displayName: 'Testing: standard' + POPTORCH_WAIT_FOR_IPU: 1 + PL_RUN_IPU_TESTS: 1 + displayName: 'UnitTests' diff --git a/src/run_ddp_examples.sh b/src/run_ddp_examples.sh new file mode 100644 index 0000000000000..6041f4b6a2a8f --- /dev/null +++ b/src/run_ddp_examples.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# Copyright The PyTorch Lightning team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +set -e + +# test that a user can manually launch individual processes +export PYTHONPATH="${PYTHONPATH}:$(pwd)" +args="--trainer.gpus 2 --trainer.strategy ddp --trainer.max_epochs=1 --trainer.limit_train_batches=1 --trainer.limit_val_batches=1 --trainer.limit_test_batches=1" +MASTER_ADDR="localhost" MASTER_PORT=1234 LOCAL_RANK=1 python pl_examples/basic_examples/mnist_examples/image_classifier_5_lightning_datamodule.py ${args} & +MASTER_ADDR="localhost" MASTER_PORT=1234 LOCAL_RANK=0 python pl_examples/basic_examples/mnist_examples/image_classifier_5_lightning_datamodule.py ${args} diff --git a/test/standalone_tests.sh b/test/run_standalone_tests.sh similarity index 68% rename from test/standalone_tests.sh rename to test/run_standalone_tests.sh index 10892e4ab40a5..f59a219456ee0 100644 --- a/test/standalone_tests.sh +++ b/test/run_standalone_tests.sh @@ -20,22 +20,22 @@ export PL_RUN_STANDALONE_TESTS=1 defaults='-m coverage run --source pytorch_lightning --append -m pytest --capture=no' # find tests marked as `@RunIf(standalone=True)`. done manually instead of with pytest because it is faster -grep_output=$(grep --recursive --word-regexp 'tests' --regexp 'standalone=True' --include '*.py' --exclude 'tests/conftest.py') +grep_output=$(grep --recursive --word-regexp 'unittests' --regexp 'standalone=True' --include '*.py' --exclude 'unittests/conftest.py') # file paths, remove duplicates files=$(echo "$grep_output" | cut -f1 -d: | sort | uniq) -# get the list of parametrizations. we need to call them separately. the last two lines are removed. +# get the list of parametrization. we need to call them separately. the last two lines are removed. # note: if there's a syntax error, this will fail with some garbled output if [[ "$OSTYPE" == "darwin"* ]]; then parametrizations=$(python -m pytest $files --collect-only --quiet "$@" | tail -r | sed -e '1,3d' | tail -r) else parametrizations=$(python -m pytest $files --collect-only --quiet "$@" | head -n -2) fi -parametrizations_arr=($parametrizations) +parametrizations_arr=(${parametrizations//"test/"/""}) # tests to skip - space separated -blocklist='tests/profiler/test_profiler.py::test_pytorch_profiler_nested_emit_nvtx tests/utilities/test_warnings.py' +blocklist='unittests/profiler/test_profiler.py::test_pytorch_profiler_nested_emit_nvtx unittests/utilities/test_warnings.py' report='' for i in "${!parametrizations_arr[@]}"; do @@ -55,13 +55,13 @@ for i in "${!parametrizations_arr[@]}"; do done if nvcc --version; then - nvprof --profile-from-start off -o trace_name.prof -- python ${defaults} tests/profiler/test_profiler.py::test_pytorch_profiler_nested_emit_nvtx + nvprof --profile-from-start off -o trace_name.prof -- python ${defaults} unittests/profiler/test_profiler.py::test_pytorch_profiler_nested_emit_nvtx fi # needs to run outside of `pytest` -python tests/utilities/test_warnings.py +python unittests/utilities/test_warnings.py if [ $? -eq 0 ]; then - report+="Ran\ttests/utilities/test_warnings.py\n" + report+="Ran\tunittests/utilities/test_warnings.py\n" fi # TODO: enable when CI uses torch>=1.9 @@ -72,13 +72,7 @@ fi # fi # report+="Ran\ttests/plugins/environments/torch_elastic_deadlock.py\n" -# test that a user can manually launch individual processes -export PYTHONPATH="${PYTHONPATH}:$(pwd)" -args="--trainer.gpus 2 --trainer.strategy ddp --trainer.max_epochs=1 --trainer.limit_train_batches=1 --trainer.limit_val_batches=1 --trainer.limit_test_batches=1" -MASTER_ADDR="localhost" MASTER_PORT=1234 LOCAL_RANK=1 python pl_examples/basic_examples/mnist_examples/image_classifier_5_lightning_datamodule.py ${args} & -MASTER_ADDR="localhost" MASTER_PORT=1234 LOCAL_RANK=0 python pl_examples/basic_examples/mnist_examples/image_classifier_5_lightning_datamodule.py ${args} report+="Ran\tmanual ddp launch test\n" - # echo test report printf '=%.s' {1..80} printf "\n$report" From 14bb3be7f6c36477237ef7e35e8522d3c626aaf9 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 9 Jun 2022 15:35:27 +0200 Subject: [PATCH 10/20] docs: rename source >> source-PL --- .github/workflows/docs-checks.yml | 14 +++++----- .gitignore | 12 ++++----- .pre-commit-config.yaml | 12 ++++----- Makefile | 4 +-- README.md | 6 ++--- docs/Makefile | 2 +- docs/README.md | 6 ++--- docs/make.bat | 2 +- .../_static/copybutton.js | 0 .../images/accelerator/ipus/profiler.png | Bin .../images/benchmarks/figure-parity-times.png | Bin .../general/PTL101_youtube_thumbnail.jpg | Bin .../_static/images/general/fast_2.gif | Bin .../_static/images/general/pl_overview.gif | Bin .../images/general/pl_overview_flat.jpg | Bin .../pl_quick_start_full_compressed.gif | Bin .../_static/images/general/tf_loss.jpg | Bin .../_static/images/general/tf_tags.jpg | Bin .../_static/images/general/tutorial_cover.jpg | Bin .../_static/images/icon.svg | 0 .../_static/images/lightning_lite/lite.gif | Bin .../images/lightning_module/pt_to_pl.png | Bin .../images/lightning_module/pt_trainer.png | Bin .../_static/images/logo.png | Bin .../_static/images/logo.svg | 0 .../_static/images/logo_light.svg | 0 .../images/mnist_imgs/mnist_cpu_bar.png | Bin .../_static/images/mnist_imgs/mnist_gpu.png | Bin .../_static/images/mnist_imgs/mnist_tb.png | Bin .../_static/images/mnist_imgs/pt_to_pl.jpg | Bin .../images/mnist_imgs/restart_runtime.png | Bin .../_static/images/mnist_imgs/runtime_tpu.png | Bin .../_static/images/mnist_imgs/tpu_fast.png | Bin .../_static/images/mnist_imgs/tpu_start.png | Bin .../_static/images/trainer/lr_finder.png | Bin docs/{source => source-PL}/_static/main.css | 0 .../_templates/autosummary/module.rst | 0 .../_templates/classtemplate.rst | 0 .../_templates/layout.html | 0 .../_templates/theme_variables.jinja | 0 .../accelerators/accelerator_prepare.rst | 0 .../accelerators/gpu.rst | 0 .../accelerators/gpu_advanced.rst | 0 .../accelerators/gpu_basic.rst | 0 .../accelerators/gpu_expert.rst | 0 .../accelerators/gpu_faq.rst | 0 .../accelerators/gpu_intermediate.rst | 0 .../accelerators/hpu.rst | 0 .../accelerators/hpu_basic.rst | 0 .../accelerators/hpu_intermediate.rst | 0 .../accelerators/ipu.rst | 0 .../accelerators/ipu_advanced.rst | 0 .../accelerators/ipu_basic.rst | 0 .../accelerators/ipu_intermediate.rst | 0 .../accelerators/tpu.rst | 0 .../accelerators/tpu_advanced.rst | 0 .../accelerators/tpu_basic.rst | 0 .../accelerators/tpu_faq.rst | 0 .../accelerators/tpu_intermediate.rst | 0 .../advanced/finetuning.rst | 0 .../advanced/model_parallel.rst | 0 .../advanced/pretrained.rst | 0 .../advanced/pruning_quantization.rst | 0 .../advanced/strategy_registry.rst | 0 .../advanced/training_tricks.rst | 0 .../advanced/transfer_learning.rst | 0 docs/{source => source-PL}/api_references.rst | 0 .../benchmarking/benchmarks.rst | 0 .../cli/lightning_cli.rst | 0 .../cli/lightning_cli_advanced.rst | 0 .../cli/lightning_cli_advanced_2.rst | 0 .../cli/lightning_cli_advanced_3.rst | 0 .../cli/lightning_cli_expert.rst | 0 .../cli/lightning_cli_faq.rst | 0 .../cli/lightning_cli_intermediate.rst | 0 .../cli/lightning_cli_intermediate_2.rst | 0 .../clouds/cloud_training.rst | 0 .../clouds/cloud_training_intermediate.rst | 0 docs/{source => source-PL}/clouds/cluster.rst | 0 .../clouds/cluster_advanced.rst | 0 .../clouds/cluster_expert.rst | 0 .../clouds/cluster_intermediate_1.rst | 0 .../clouds/cluster_intermediate_2.rst | 0 .../clouds/fault_tolerant_training.rst | 0 .../clouds/fault_tolerant_training_basic.rst | 0 .../clouds/fault_tolerant_training_expert.rst | 0 .../clouds/fault_tolerant_training_faq.rst | 0 .../clouds/grid_costs.rst | 0 .../clouds/run_advanced.rst | 0 .../clouds/run_basic.rst | 0 .../clouds/run_expert.rst | 0 .../clouds/run_intermediate.rst | 0 .../clouds/session_basic.rst | 0 .../clouds/session_intermediate.rst | 0 .../common/checkpointing.rst | 0 .../common/checkpointing_advanced.rst | 0 .../common/checkpointing_basic.rst | 0 .../common/checkpointing_expert.rst | 0 .../common/checkpointing_intermediate.rst | 0 .../common/child_modules.rst | 0 .../common/console_logs.rst | 0 .../common/early_stopping.rst | 0 .../common/evaluation.rst | 0 .../common/evaluation_basic.rst | 0 .../common/evaluation_intermediate.rst | 0 .../common/gradient_accumulation.rst | 0 .../common/hyperparameters.rst | 0 .../common/lightning_module.rst | 0 .../common/optimization.rst | 0 .../common/precision.rst | 0 .../common/precision_basic.rst | 0 .../common/precision_expert.rst | 0 .../common/precision_intermediate.rst | 0 .../common/progress_bar.rst | 0 .../common/remote_fs.rst | 0 docs/{source => source-PL}/common/trainer.rst | 0 .../{source => source-PL}/common_usecases.rst | 0 docs/{source => source-PL}/conf.py | 24 ++++++------------ .../{source => source-PL}/data/datamodule.rst | 0 .../{source => source-PL}/debug/debugging.rst | 0 .../debug/debugging_advanced.rst | 0 .../debug/debugging_basic.rst | 0 .../debug/debugging_intermediate.rst | 0 .../deploy/production.rst | 0 .../deploy/production_advanced.rst | 0 .../deploy/production_advanced_2.rst | 0 .../deploy/production_basic.rst | 0 .../deploy/production_intermediate.rst | 0 .../ecosystem/asr_nlp_tts.rst | 0 .../{source => source-PL}/ecosystem/bolts.rst | 0 .../ecosystem/community_examples.rst | 0 .../ecosystem/ecosystem-ci.rst | 0 .../{source => source-PL}/ecosystem/flash.rst | 0 .../ecosystem/metrics.rst | 0 .../ecosystem/transformers.rst | 0 .../expertise_levels.rst | 0 .../extensions/accelerator.rst | 0 .../extensions/callbacks.rst | 0 .../extensions/callbacks_state.rst | 0 .../extensions/datamodules_state.rst | 0 .../extensions/entry_points.rst | 0 .../extensions/logging.rst | 0 .../extensions/loops.rst | 0 .../extensions/loops_advanced.rst | 0 .../extensions/plugins.rst | 0 .../extensions/strategy.rst | 0 docs/{source => source-PL}/governance.rst | 0 docs/{source => source-PL}/guides/data.rst | 0 docs/{source => source-PL}/guides/speed.rst | 0 docs/{source => source-PL}/index.rst | 0 .../{source => source-PL}/levels/advanced.rst | 0 .../levels/advanced_level_15.rst | 0 .../levels/advanced_level_16.rst | 0 .../levels/advanced_level_17.rst | 0 .../levels/advanced_level_18.rst | 0 .../levels/advanced_level_19.rst | 0 .../levels/advanced_level_20.rst | 0 .../levels/advanced_level_21.rst | 0 .../levels/advanced_level_22.rst | 0 .../levels/basic_level_2.rst | 0 .../levels/basic_level_5.rst | 0 .../levels/core_level_3.rst | 0 .../levels/core_level_6.rst | 0 .../levels/core_skills.rst | 0 docs/{source => source-PL}/levels/expert.rst | 0 .../levels/expert_level_23.rst | 0 .../levels/expert_level_24.rst | 0 .../levels/expert_level_27.rst | 0 .../levels/intermediate.rst | 0 .../levels/intermediate_level_10.rst | 0 .../levels/intermediate_level_11.rst | 0 .../levels/intermediate_level_12.rst | 0 .../levels/intermediate_level_13.rst | 0 .../levels/intermediate_level_14.rst | 0 .../levels/intermediate_level_7.rst | 0 .../levels/intermediate_level_8.rst | 0 .../levels/intermediate_level_9.rst | 0 docs/{source => source-PL}/links.rst | 0 .../model/build_model.rst | 0 .../model/build_model_advanced.rst | 0 .../model/build_model_expert.rst | 0 .../model/build_model_intermediate.rst | 0 .../model/manual_optimization.rst | 0 .../model/own_your_loop.rst | 0 .../model/train_model_basic.rst | 0 .../starter/converting.rst | 0 .../starter/installation.rst | 0 .../starter/introduction.rst | 0 .../starter/lightning_lite.rst | 0 .../starter/style_guide.rst | 0 .../strategies/collaborative_training.rst | 0 .../collaborative_training_basic.rst | 0 .../collaborative_training_expert.rst | 0 .../collaborative_training_intermediate.rst | 0 .../{source => source-PL}/tuning/profiler.rst | 0 .../tuning/profiler_advanced.rst | 0 .../tuning/profiler_basic.rst | 0 .../tuning/profiler_expert.rst | 0 .../tuning/profiler_intermediate.rst | 0 docs/{source => source-PL}/tutorials.rst | 0 .../visualize/experiment_managers.rst | 0 .../visualize/loggers.rst | 0 .../visualize/logging_advanced.rst | 0 .../visualize/logging_basic.rst | 0 .../visualize/logging_expert.rst | 0 .../visualize/logging_intermediate.rst | 0 .../visualize/supported_exp_managers.rst | 0 setup.py | 2 +- src/pytorch_lightning/__about__.py | 11 +++++++- 209 files changed, 46 insertions(+), 49 deletions(-) rename docs/{source => source-PL}/_static/copybutton.js (100%) rename docs/{source => source-PL}/_static/images/accelerator/ipus/profiler.png (100%) rename docs/{source => source-PL}/_static/images/benchmarks/figure-parity-times.png (100%) rename docs/{source => source-PL}/_static/images/general/PTL101_youtube_thumbnail.jpg (100%) rename docs/{source => source-PL}/_static/images/general/fast_2.gif (100%) rename docs/{source => source-PL}/_static/images/general/pl_overview.gif (100%) rename docs/{source => source-PL}/_static/images/general/pl_overview_flat.jpg (100%) rename docs/{source => source-PL}/_static/images/general/pl_quick_start_full_compressed.gif (100%) rename docs/{source => source-PL}/_static/images/general/tf_loss.jpg (100%) rename docs/{source => source-PL}/_static/images/general/tf_tags.jpg (100%) rename docs/{source => source-PL}/_static/images/general/tutorial_cover.jpg (100%) rename docs/{source => source-PL}/_static/images/icon.svg (100%) rename docs/{source => source-PL}/_static/images/lightning_lite/lite.gif (100%) rename docs/{source => source-PL}/_static/images/lightning_module/pt_to_pl.png (100%) rename docs/{source => source-PL}/_static/images/lightning_module/pt_trainer.png (100%) rename docs/{source => source-PL}/_static/images/logo.png (100%) rename docs/{source => source-PL}/_static/images/logo.svg (100%) rename docs/{source => source-PL}/_static/images/logo_light.svg (100%) rename docs/{source => source-PL}/_static/images/mnist_imgs/mnist_cpu_bar.png (100%) rename docs/{source => source-PL}/_static/images/mnist_imgs/mnist_gpu.png (100%) rename docs/{source => source-PL}/_static/images/mnist_imgs/mnist_tb.png (100%) rename docs/{source => source-PL}/_static/images/mnist_imgs/pt_to_pl.jpg (100%) rename docs/{source => source-PL}/_static/images/mnist_imgs/restart_runtime.png (100%) rename docs/{source => source-PL}/_static/images/mnist_imgs/runtime_tpu.png (100%) rename docs/{source => source-PL}/_static/images/mnist_imgs/tpu_fast.png (100%) rename docs/{source => source-PL}/_static/images/mnist_imgs/tpu_start.png (100%) rename docs/{source => source-PL}/_static/images/trainer/lr_finder.png (100%) rename docs/{source => source-PL}/_static/main.css (100%) rename docs/{source => source-PL}/_templates/autosummary/module.rst (100%) rename docs/{source => source-PL}/_templates/classtemplate.rst (100%) rename docs/{source => source-PL}/_templates/layout.html (100%) rename docs/{source => source-PL}/_templates/theme_variables.jinja (100%) rename docs/{source => source-PL}/accelerators/accelerator_prepare.rst (100%) rename docs/{source => source-PL}/accelerators/gpu.rst (100%) rename docs/{source => source-PL}/accelerators/gpu_advanced.rst (100%) rename docs/{source => source-PL}/accelerators/gpu_basic.rst (100%) rename docs/{source => source-PL}/accelerators/gpu_expert.rst (100%) rename docs/{source => source-PL}/accelerators/gpu_faq.rst (100%) rename docs/{source => source-PL}/accelerators/gpu_intermediate.rst (100%) rename docs/{source => source-PL}/accelerators/hpu.rst (100%) rename docs/{source => source-PL}/accelerators/hpu_basic.rst (100%) rename docs/{source => source-PL}/accelerators/hpu_intermediate.rst (100%) rename docs/{source => source-PL}/accelerators/ipu.rst (100%) rename docs/{source => source-PL}/accelerators/ipu_advanced.rst (100%) rename docs/{source => source-PL}/accelerators/ipu_basic.rst (100%) rename docs/{source => source-PL}/accelerators/ipu_intermediate.rst (100%) rename docs/{source => source-PL}/accelerators/tpu.rst (100%) rename docs/{source => source-PL}/accelerators/tpu_advanced.rst (100%) rename docs/{source => source-PL}/accelerators/tpu_basic.rst (100%) rename docs/{source => source-PL}/accelerators/tpu_faq.rst (100%) rename docs/{source => source-PL}/accelerators/tpu_intermediate.rst (100%) rename docs/{source => source-PL}/advanced/finetuning.rst (100%) rename docs/{source => source-PL}/advanced/model_parallel.rst (100%) rename docs/{source => source-PL}/advanced/pretrained.rst (100%) rename docs/{source => source-PL}/advanced/pruning_quantization.rst (100%) rename docs/{source => source-PL}/advanced/strategy_registry.rst (100%) rename docs/{source => source-PL}/advanced/training_tricks.rst (100%) rename docs/{source => source-PL}/advanced/transfer_learning.rst (100%) rename docs/{source => source-PL}/api_references.rst (100%) rename docs/{source => source-PL}/benchmarking/benchmarks.rst (100%) rename docs/{source => source-PL}/cli/lightning_cli.rst (100%) rename docs/{source => source-PL}/cli/lightning_cli_advanced.rst (100%) rename docs/{source => source-PL}/cli/lightning_cli_advanced_2.rst (100%) rename docs/{source => source-PL}/cli/lightning_cli_advanced_3.rst (100%) rename docs/{source => source-PL}/cli/lightning_cli_expert.rst (100%) rename docs/{source => source-PL}/cli/lightning_cli_faq.rst (100%) rename docs/{source => source-PL}/cli/lightning_cli_intermediate.rst (100%) rename docs/{source => source-PL}/cli/lightning_cli_intermediate_2.rst (100%) rename docs/{source => source-PL}/clouds/cloud_training.rst (100%) rename docs/{source => source-PL}/clouds/cloud_training_intermediate.rst (100%) rename docs/{source => source-PL}/clouds/cluster.rst (100%) rename docs/{source => source-PL}/clouds/cluster_advanced.rst (100%) rename docs/{source => source-PL}/clouds/cluster_expert.rst (100%) rename docs/{source => source-PL}/clouds/cluster_intermediate_1.rst (100%) rename docs/{source => source-PL}/clouds/cluster_intermediate_2.rst (100%) rename docs/{source => source-PL}/clouds/fault_tolerant_training.rst (100%) rename docs/{source => source-PL}/clouds/fault_tolerant_training_basic.rst (100%) rename docs/{source => source-PL}/clouds/fault_tolerant_training_expert.rst (100%) rename docs/{source => source-PL}/clouds/fault_tolerant_training_faq.rst (100%) rename docs/{source => source-PL}/clouds/grid_costs.rst (100%) rename docs/{source => source-PL}/clouds/run_advanced.rst (100%) rename docs/{source => source-PL}/clouds/run_basic.rst (100%) rename docs/{source => source-PL}/clouds/run_expert.rst (100%) rename docs/{source => source-PL}/clouds/run_intermediate.rst (100%) rename docs/{source => source-PL}/clouds/session_basic.rst (100%) rename docs/{source => source-PL}/clouds/session_intermediate.rst (100%) rename docs/{source => source-PL}/common/checkpointing.rst (100%) rename docs/{source => source-PL}/common/checkpointing_advanced.rst (100%) rename docs/{source => source-PL}/common/checkpointing_basic.rst (100%) rename docs/{source => source-PL}/common/checkpointing_expert.rst (100%) rename docs/{source => source-PL}/common/checkpointing_intermediate.rst (100%) rename docs/{source => source-PL}/common/child_modules.rst (100%) rename docs/{source => source-PL}/common/console_logs.rst (100%) rename docs/{source => source-PL}/common/early_stopping.rst (100%) rename docs/{source => source-PL}/common/evaluation.rst (100%) rename docs/{source => source-PL}/common/evaluation_basic.rst (100%) rename docs/{source => source-PL}/common/evaluation_intermediate.rst (100%) rename docs/{source => source-PL}/common/gradient_accumulation.rst (100%) rename docs/{source => source-PL}/common/hyperparameters.rst (100%) rename docs/{source => source-PL}/common/lightning_module.rst (100%) rename docs/{source => source-PL}/common/optimization.rst (100%) rename docs/{source => source-PL}/common/precision.rst (100%) rename docs/{source => source-PL}/common/precision_basic.rst (100%) rename docs/{source => source-PL}/common/precision_expert.rst (100%) rename docs/{source => source-PL}/common/precision_intermediate.rst (100%) rename docs/{source => source-PL}/common/progress_bar.rst (100%) rename docs/{source => source-PL}/common/remote_fs.rst (100%) rename docs/{source => source-PL}/common/trainer.rst (100%) rename docs/{source => source-PL}/common_usecases.rst (100%) rename docs/{source => source-PL}/conf.py (96%) rename docs/{source => source-PL}/data/datamodule.rst (100%) rename docs/{source => source-PL}/debug/debugging.rst (100%) rename docs/{source => source-PL}/debug/debugging_advanced.rst (100%) rename docs/{source => source-PL}/debug/debugging_basic.rst (100%) rename docs/{source => source-PL}/debug/debugging_intermediate.rst (100%) rename docs/{source => source-PL}/deploy/production.rst (100%) rename docs/{source => source-PL}/deploy/production_advanced.rst (100%) rename docs/{source => source-PL}/deploy/production_advanced_2.rst (100%) rename docs/{source => source-PL}/deploy/production_basic.rst (100%) rename docs/{source => source-PL}/deploy/production_intermediate.rst (100%) rename docs/{source => source-PL}/ecosystem/asr_nlp_tts.rst (100%) rename docs/{source => source-PL}/ecosystem/bolts.rst (100%) rename docs/{source => source-PL}/ecosystem/community_examples.rst (100%) rename docs/{source => source-PL}/ecosystem/ecosystem-ci.rst (100%) rename docs/{source => source-PL}/ecosystem/flash.rst (100%) rename docs/{source => source-PL}/ecosystem/metrics.rst (100%) rename docs/{source => source-PL}/ecosystem/transformers.rst (100%) rename docs/{source => source-PL}/expertise_levels.rst (100%) rename docs/{source => source-PL}/extensions/accelerator.rst (100%) rename docs/{source => source-PL}/extensions/callbacks.rst (100%) rename docs/{source => source-PL}/extensions/callbacks_state.rst (100%) rename docs/{source => source-PL}/extensions/datamodules_state.rst (100%) rename docs/{source => source-PL}/extensions/entry_points.rst (100%) rename docs/{source => source-PL}/extensions/logging.rst (100%) rename docs/{source => source-PL}/extensions/loops.rst (100%) rename docs/{source => source-PL}/extensions/loops_advanced.rst (100%) rename docs/{source => source-PL}/extensions/plugins.rst (100%) rename docs/{source => source-PL}/extensions/strategy.rst (100%) rename docs/{source => source-PL}/governance.rst (100%) rename docs/{source => source-PL}/guides/data.rst (100%) rename docs/{source => source-PL}/guides/speed.rst (100%) rename docs/{source => source-PL}/index.rst (100%) rename docs/{source => source-PL}/levels/advanced.rst (100%) rename docs/{source => source-PL}/levels/advanced_level_15.rst (100%) rename docs/{source => source-PL}/levels/advanced_level_16.rst (100%) rename docs/{source => source-PL}/levels/advanced_level_17.rst (100%) rename docs/{source => source-PL}/levels/advanced_level_18.rst (100%) rename docs/{source => source-PL}/levels/advanced_level_19.rst (100%) rename docs/{source => source-PL}/levels/advanced_level_20.rst (100%) rename docs/{source => source-PL}/levels/advanced_level_21.rst (100%) rename docs/{source => source-PL}/levels/advanced_level_22.rst (100%) rename docs/{source => source-PL}/levels/basic_level_2.rst (100%) rename docs/{source => source-PL}/levels/basic_level_5.rst (100%) rename docs/{source => source-PL}/levels/core_level_3.rst (100%) rename docs/{source => source-PL}/levels/core_level_6.rst (100%) rename docs/{source => source-PL}/levels/core_skills.rst (100%) rename docs/{source => source-PL}/levels/expert.rst (100%) rename docs/{source => source-PL}/levels/expert_level_23.rst (100%) rename docs/{source => source-PL}/levels/expert_level_24.rst (100%) rename docs/{source => source-PL}/levels/expert_level_27.rst (100%) rename docs/{source => source-PL}/levels/intermediate.rst (100%) rename docs/{source => source-PL}/levels/intermediate_level_10.rst (100%) rename docs/{source => source-PL}/levels/intermediate_level_11.rst (100%) rename docs/{source => source-PL}/levels/intermediate_level_12.rst (100%) rename docs/{source => source-PL}/levels/intermediate_level_13.rst (100%) rename docs/{source => source-PL}/levels/intermediate_level_14.rst (100%) rename docs/{source => source-PL}/levels/intermediate_level_7.rst (100%) rename docs/{source => source-PL}/levels/intermediate_level_8.rst (100%) rename docs/{source => source-PL}/levels/intermediate_level_9.rst (100%) rename docs/{source => source-PL}/links.rst (100%) rename docs/{source => source-PL}/model/build_model.rst (100%) rename docs/{source => source-PL}/model/build_model_advanced.rst (100%) rename docs/{source => source-PL}/model/build_model_expert.rst (100%) rename docs/{source => source-PL}/model/build_model_intermediate.rst (100%) rename docs/{source => source-PL}/model/manual_optimization.rst (100%) rename docs/{source => source-PL}/model/own_your_loop.rst (100%) rename docs/{source => source-PL}/model/train_model_basic.rst (100%) rename docs/{source => source-PL}/starter/converting.rst (100%) rename docs/{source => source-PL}/starter/installation.rst (100%) rename docs/{source => source-PL}/starter/introduction.rst (100%) rename docs/{source => source-PL}/starter/lightning_lite.rst (100%) rename docs/{source => source-PL}/starter/style_guide.rst (100%) rename docs/{source => source-PL}/strategies/collaborative_training.rst (100%) rename docs/{source => source-PL}/strategies/collaborative_training_basic.rst (100%) rename docs/{source => source-PL}/strategies/collaborative_training_expert.rst (100%) rename docs/{source => source-PL}/strategies/collaborative_training_intermediate.rst (100%) rename docs/{source => source-PL}/tuning/profiler.rst (100%) rename docs/{source => source-PL}/tuning/profiler_advanced.rst (100%) rename docs/{source => source-PL}/tuning/profiler_basic.rst (100%) rename docs/{source => source-PL}/tuning/profiler_expert.rst (100%) rename docs/{source => source-PL}/tuning/profiler_intermediate.rst (100%) rename docs/{source => source-PL}/tutorials.rst (100%) rename docs/{source => source-PL}/visualize/experiment_managers.rst (100%) rename docs/{source => source-PL}/visualize/loggers.rst (100%) rename docs/{source => source-PL}/visualize/logging_advanced.rst (100%) rename docs/{source => source-PL}/visualize/logging_basic.rst (100%) rename docs/{source => source-PL}/visualize/logging_expert.rst (100%) rename docs/{source => source-PL}/visualize/logging_intermediate.rst (100%) rename docs/{source => source-PL}/visualize/supported_exp_managers.rst (100%) diff --git a/.github/workflows/docs-checks.yml b/.github/workflows/docs-checks.yml index a2d717ce2d3ee..051f74378aacb 100644 --- a/.github/workflows/docs-checks.yml +++ b/.github/workflows/docs-checks.yml @@ -31,9 +31,9 @@ jobs: uses: actions/cache@v2 with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-td${{ env.TIME_PERIOD }}-${{ hashFiles('requirements/base.txt') }} + key: ${{ runner.os }}-docs-test-pip-td${{ env.TIME_PERIOD }}-${{ hashFiles('requirements/*.txt') }} restore-keys: | - ${{ runner.os }}-pip-td${{ env.TIME_PERIOD }}- + ${{ runner.os }}-docs-test-pip-td${{ env.TIME_PERIOD }}- - name: Install dependencies run: | @@ -42,9 +42,8 @@ jobs: pip --version pip install -q fire # python -m pip install --upgrade --user pip - pip install -e . --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet + pip install -e . --quiet -r requirements/docs.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html pip install -r requirements/devel.txt - pip install -r requirements/docs.txt pip list shell: bash @@ -74,17 +73,16 @@ jobs: uses: actions/cache@v2 with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('requirements/base.txt') }} + key: ${{ runner.os }}-docs-make-pip-${{ hashFiles('requirements/base.txt') }} restore-keys: | - ${{ runner.os }}-pip- + ${{ runner.os }}-docs-make-pip- - name: Install dependencies run: | sudo apt-get update sudo apt-get install -y cmake pandoc pip --version - pip install -e . - pip install --requirement requirements/docs.txt + pip install -e . --quiet -r requirements/docs.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html # install Texlive, see https://linuxconfig.org/how-to-install-latex-on-ubuntu-20-04-focal-fossa-linux sudo apt-get update && sudo apt-get install -y texlive-latex-extra dvipng texlive-pictures pip list diff --git a/.gitignore b/.gitignore index e9bcc4cfd385f..773206075401b 100644 --- a/.gitignore +++ b/.gitignore @@ -8,13 +8,13 @@ lightning_logs/ .vscode/ # Documentations -docs/source/api +docs/source-PL/api docs/source/*.md -docs/source/generated -docs/source/*/generated -docs/source/notebooks -docs/source/_static/images/course_UvA-DL -docs/source/_static/images/lightning_examples +docs/source-PL/generated +docs/source-PL/*/generated +docs/source-PL/notebooks +docs/source-PL/_static/images/course_UvA-DL +docs/source-PL/_static/images/lightning_examples # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 800dd6859f608..6e57fe2430d56 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,12 +37,12 @@ repos: exclude: | (?x)^( CHANGELOG.md| - docs/source/_static/images/general/fast_2.gif| - docs/source/_static/images/mnist_imgs/pt_to_pl.jpg| - docs/source/_static/images/lightning_module/pt_to_pl.png| - docs/source/_static/images/general/pl_quick_start_full_compressed.gif| - docs/source/_static/images/general/pl_overview_flat.jpg| - docs/source/_static/images/general/pl_overview.gif + docs/source-PL/_static/images/general/fast_2.gif| + docs/source-PL/_static/images/mnist_imgs/pt_to_pl.jpg| + docs/source-PL/_static/images/lightning_module/pt_to_pl.png| + docs/source-PL/_static/images/general/pl_quick_start_full_compressed.gif| + docs/source-PL/_static/images/general/pl_overview_flat.jpg| + docs/source-PL/_static/images/general/pl_overview.gif )$ - id: detect-private-key diff --git a/Makefile b/Makefile index efd2a7f3c5496..8af270c534d7d 100644 --- a/Makefile +++ b/Makefile @@ -28,8 +28,8 @@ test: clean python -m coverage report docs: clean - pip install --quiet -r requirements/docs.txt - python -m sphinx -b html -W --keep-going docs/source docs/build + pip install -e . --quiet -r requirements/docs.txt + python -m sphinx -b html -W --keep-going docs/source-PL docs/build update: git submodule update --init --recursive --remote diff --git a/README.md b/README.md index ca79aa53c432e..3cebc579f66af 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@
- + **The lightweight PyTorch wrapper for high-performance AI research. Scale your models, not the boilerplate.** @@ -44,7 +44,7 @@ ______________________________________________________________________ ## PyTorch Lightning is just organized PyTorch Lightning disentangles PyTorch code to decouple the science from the engineering. -![PT to PL](docs/source/_static/images/general/pl_quick_start_full_compressed.gif) +![PT to PL](docs/source-PL/_static/images/general/pl_quick_start_full_compressed.gif) ______________________________________________________________________ @@ -354,7 +354,7 @@ ______________________________________________________________________ ## Lightning Lite
- +
In the Lightning 1.5 release, LightningLite now enables you to leverage all the capabilities of PyTorch Lightning Accelerators without any refactoring to your training loop. Check out the diff --git a/docs/Makefile b/docs/Makefile index ba501f6f5b1bf..49ee70e029a96 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -4,7 +4,7 @@ # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build -SOURCEDIR = source +SOURCEDIR = source-PL BUILDDIR = build # Put it first so that "make" without argument is like "make help". diff --git a/docs/README.md b/docs/README.md index 4979a18399368..88561baaed684 100644 --- a/docs/README.md +++ b/docs/README.md @@ -43,10 +43,8 @@ Run these commands ```bash git submodule update --init --recursive -pip install -r requirements/docs.txt -make clean -cd docs -make html +pip install -e . -r requirements/docs.txt +make docs ``` and open `docs/build/html/index.html` in your browser. diff --git a/docs/make.bat b/docs/make.bat index 4d9eb83d9f930..63efbeb5f4eea 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -7,7 +7,7 @@ REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) -set SOURCEDIR=source +set SOURCEDIR=source-PL set BUILDDIR=build if "%1" == "" goto help diff --git a/docs/source/_static/copybutton.js b/docs/source-PL/_static/copybutton.js similarity index 100% rename from docs/source/_static/copybutton.js rename to docs/source-PL/_static/copybutton.js diff --git a/docs/source/_static/images/accelerator/ipus/profiler.png b/docs/source-PL/_static/images/accelerator/ipus/profiler.png similarity index 100% rename from docs/source/_static/images/accelerator/ipus/profiler.png rename to docs/source-PL/_static/images/accelerator/ipus/profiler.png diff --git a/docs/source/_static/images/benchmarks/figure-parity-times.png b/docs/source-PL/_static/images/benchmarks/figure-parity-times.png similarity index 100% rename from docs/source/_static/images/benchmarks/figure-parity-times.png rename to docs/source-PL/_static/images/benchmarks/figure-parity-times.png diff --git a/docs/source/_static/images/general/PTL101_youtube_thumbnail.jpg b/docs/source-PL/_static/images/general/PTL101_youtube_thumbnail.jpg similarity index 100% rename from docs/source/_static/images/general/PTL101_youtube_thumbnail.jpg rename to docs/source-PL/_static/images/general/PTL101_youtube_thumbnail.jpg diff --git a/docs/source/_static/images/general/fast_2.gif b/docs/source-PL/_static/images/general/fast_2.gif similarity index 100% rename from docs/source/_static/images/general/fast_2.gif rename to docs/source-PL/_static/images/general/fast_2.gif diff --git a/docs/source/_static/images/general/pl_overview.gif b/docs/source-PL/_static/images/general/pl_overview.gif similarity index 100% rename from docs/source/_static/images/general/pl_overview.gif rename to docs/source-PL/_static/images/general/pl_overview.gif diff --git a/docs/source/_static/images/general/pl_overview_flat.jpg b/docs/source-PL/_static/images/general/pl_overview_flat.jpg similarity index 100% rename from docs/source/_static/images/general/pl_overview_flat.jpg rename to docs/source-PL/_static/images/general/pl_overview_flat.jpg diff --git a/docs/source/_static/images/general/pl_quick_start_full_compressed.gif b/docs/source-PL/_static/images/general/pl_quick_start_full_compressed.gif similarity index 100% rename from docs/source/_static/images/general/pl_quick_start_full_compressed.gif rename to docs/source-PL/_static/images/general/pl_quick_start_full_compressed.gif diff --git a/docs/source/_static/images/general/tf_loss.jpg b/docs/source-PL/_static/images/general/tf_loss.jpg similarity index 100% rename from docs/source/_static/images/general/tf_loss.jpg rename to docs/source-PL/_static/images/general/tf_loss.jpg diff --git a/docs/source/_static/images/general/tf_tags.jpg b/docs/source-PL/_static/images/general/tf_tags.jpg similarity index 100% rename from docs/source/_static/images/general/tf_tags.jpg rename to docs/source-PL/_static/images/general/tf_tags.jpg diff --git a/docs/source/_static/images/general/tutorial_cover.jpg b/docs/source-PL/_static/images/general/tutorial_cover.jpg similarity index 100% rename from docs/source/_static/images/general/tutorial_cover.jpg rename to docs/source-PL/_static/images/general/tutorial_cover.jpg diff --git a/docs/source/_static/images/icon.svg b/docs/source-PL/_static/images/icon.svg similarity index 100% rename from docs/source/_static/images/icon.svg rename to docs/source-PL/_static/images/icon.svg diff --git a/docs/source/_static/images/lightning_lite/lite.gif b/docs/source-PL/_static/images/lightning_lite/lite.gif similarity index 100% rename from docs/source/_static/images/lightning_lite/lite.gif rename to docs/source-PL/_static/images/lightning_lite/lite.gif diff --git a/docs/source/_static/images/lightning_module/pt_to_pl.png b/docs/source-PL/_static/images/lightning_module/pt_to_pl.png similarity index 100% rename from docs/source/_static/images/lightning_module/pt_to_pl.png rename to docs/source-PL/_static/images/lightning_module/pt_to_pl.png diff --git a/docs/source/_static/images/lightning_module/pt_trainer.png b/docs/source-PL/_static/images/lightning_module/pt_trainer.png similarity index 100% rename from docs/source/_static/images/lightning_module/pt_trainer.png rename to docs/source-PL/_static/images/lightning_module/pt_trainer.png diff --git a/docs/source/_static/images/logo.png b/docs/source-PL/_static/images/logo.png similarity index 100% rename from docs/source/_static/images/logo.png rename to docs/source-PL/_static/images/logo.png diff --git a/docs/source/_static/images/logo.svg b/docs/source-PL/_static/images/logo.svg similarity index 100% rename from docs/source/_static/images/logo.svg rename to docs/source-PL/_static/images/logo.svg diff --git a/docs/source/_static/images/logo_light.svg b/docs/source-PL/_static/images/logo_light.svg similarity index 100% rename from docs/source/_static/images/logo_light.svg rename to docs/source-PL/_static/images/logo_light.svg diff --git a/docs/source/_static/images/mnist_imgs/mnist_cpu_bar.png b/docs/source-PL/_static/images/mnist_imgs/mnist_cpu_bar.png similarity index 100% rename from docs/source/_static/images/mnist_imgs/mnist_cpu_bar.png rename to docs/source-PL/_static/images/mnist_imgs/mnist_cpu_bar.png diff --git a/docs/source/_static/images/mnist_imgs/mnist_gpu.png b/docs/source-PL/_static/images/mnist_imgs/mnist_gpu.png similarity index 100% rename from docs/source/_static/images/mnist_imgs/mnist_gpu.png rename to docs/source-PL/_static/images/mnist_imgs/mnist_gpu.png diff --git a/docs/source/_static/images/mnist_imgs/mnist_tb.png b/docs/source-PL/_static/images/mnist_imgs/mnist_tb.png similarity index 100% rename from docs/source/_static/images/mnist_imgs/mnist_tb.png rename to docs/source-PL/_static/images/mnist_imgs/mnist_tb.png diff --git a/docs/source/_static/images/mnist_imgs/pt_to_pl.jpg b/docs/source-PL/_static/images/mnist_imgs/pt_to_pl.jpg similarity index 100% rename from docs/source/_static/images/mnist_imgs/pt_to_pl.jpg rename to docs/source-PL/_static/images/mnist_imgs/pt_to_pl.jpg diff --git a/docs/source/_static/images/mnist_imgs/restart_runtime.png b/docs/source-PL/_static/images/mnist_imgs/restart_runtime.png similarity index 100% rename from docs/source/_static/images/mnist_imgs/restart_runtime.png rename to docs/source-PL/_static/images/mnist_imgs/restart_runtime.png diff --git a/docs/source/_static/images/mnist_imgs/runtime_tpu.png b/docs/source-PL/_static/images/mnist_imgs/runtime_tpu.png similarity index 100% rename from docs/source/_static/images/mnist_imgs/runtime_tpu.png rename to docs/source-PL/_static/images/mnist_imgs/runtime_tpu.png diff --git a/docs/source/_static/images/mnist_imgs/tpu_fast.png b/docs/source-PL/_static/images/mnist_imgs/tpu_fast.png similarity index 100% rename from docs/source/_static/images/mnist_imgs/tpu_fast.png rename to docs/source-PL/_static/images/mnist_imgs/tpu_fast.png diff --git a/docs/source/_static/images/mnist_imgs/tpu_start.png b/docs/source-PL/_static/images/mnist_imgs/tpu_start.png similarity index 100% rename from docs/source/_static/images/mnist_imgs/tpu_start.png rename to docs/source-PL/_static/images/mnist_imgs/tpu_start.png diff --git a/docs/source/_static/images/trainer/lr_finder.png b/docs/source-PL/_static/images/trainer/lr_finder.png similarity index 100% rename from docs/source/_static/images/trainer/lr_finder.png rename to docs/source-PL/_static/images/trainer/lr_finder.png diff --git a/docs/source/_static/main.css b/docs/source-PL/_static/main.css similarity index 100% rename from docs/source/_static/main.css rename to docs/source-PL/_static/main.css diff --git a/docs/source/_templates/autosummary/module.rst b/docs/source-PL/_templates/autosummary/module.rst similarity index 100% rename from docs/source/_templates/autosummary/module.rst rename to docs/source-PL/_templates/autosummary/module.rst diff --git a/docs/source/_templates/classtemplate.rst b/docs/source-PL/_templates/classtemplate.rst similarity index 100% rename from docs/source/_templates/classtemplate.rst rename to docs/source-PL/_templates/classtemplate.rst diff --git a/docs/source/_templates/layout.html b/docs/source-PL/_templates/layout.html similarity index 100% rename from docs/source/_templates/layout.html rename to docs/source-PL/_templates/layout.html diff --git a/docs/source/_templates/theme_variables.jinja b/docs/source-PL/_templates/theme_variables.jinja similarity index 100% rename from docs/source/_templates/theme_variables.jinja rename to docs/source-PL/_templates/theme_variables.jinja diff --git a/docs/source/accelerators/accelerator_prepare.rst b/docs/source-PL/accelerators/accelerator_prepare.rst similarity index 100% rename from docs/source/accelerators/accelerator_prepare.rst rename to docs/source-PL/accelerators/accelerator_prepare.rst diff --git a/docs/source/accelerators/gpu.rst b/docs/source-PL/accelerators/gpu.rst similarity index 100% rename from docs/source/accelerators/gpu.rst rename to docs/source-PL/accelerators/gpu.rst diff --git a/docs/source/accelerators/gpu_advanced.rst b/docs/source-PL/accelerators/gpu_advanced.rst similarity index 100% rename from docs/source/accelerators/gpu_advanced.rst rename to docs/source-PL/accelerators/gpu_advanced.rst diff --git a/docs/source/accelerators/gpu_basic.rst b/docs/source-PL/accelerators/gpu_basic.rst similarity index 100% rename from docs/source/accelerators/gpu_basic.rst rename to docs/source-PL/accelerators/gpu_basic.rst diff --git a/docs/source/accelerators/gpu_expert.rst b/docs/source-PL/accelerators/gpu_expert.rst similarity index 100% rename from docs/source/accelerators/gpu_expert.rst rename to docs/source-PL/accelerators/gpu_expert.rst diff --git a/docs/source/accelerators/gpu_faq.rst b/docs/source-PL/accelerators/gpu_faq.rst similarity index 100% rename from docs/source/accelerators/gpu_faq.rst rename to docs/source-PL/accelerators/gpu_faq.rst diff --git a/docs/source/accelerators/gpu_intermediate.rst b/docs/source-PL/accelerators/gpu_intermediate.rst similarity index 100% rename from docs/source/accelerators/gpu_intermediate.rst rename to docs/source-PL/accelerators/gpu_intermediate.rst diff --git a/docs/source/accelerators/hpu.rst b/docs/source-PL/accelerators/hpu.rst similarity index 100% rename from docs/source/accelerators/hpu.rst rename to docs/source-PL/accelerators/hpu.rst diff --git a/docs/source/accelerators/hpu_basic.rst b/docs/source-PL/accelerators/hpu_basic.rst similarity index 100% rename from docs/source/accelerators/hpu_basic.rst rename to docs/source-PL/accelerators/hpu_basic.rst diff --git a/docs/source/accelerators/hpu_intermediate.rst b/docs/source-PL/accelerators/hpu_intermediate.rst similarity index 100% rename from docs/source/accelerators/hpu_intermediate.rst rename to docs/source-PL/accelerators/hpu_intermediate.rst diff --git a/docs/source/accelerators/ipu.rst b/docs/source-PL/accelerators/ipu.rst similarity index 100% rename from docs/source/accelerators/ipu.rst rename to docs/source-PL/accelerators/ipu.rst diff --git a/docs/source/accelerators/ipu_advanced.rst b/docs/source-PL/accelerators/ipu_advanced.rst similarity index 100% rename from docs/source/accelerators/ipu_advanced.rst rename to docs/source-PL/accelerators/ipu_advanced.rst diff --git a/docs/source/accelerators/ipu_basic.rst b/docs/source-PL/accelerators/ipu_basic.rst similarity index 100% rename from docs/source/accelerators/ipu_basic.rst rename to docs/source-PL/accelerators/ipu_basic.rst diff --git a/docs/source/accelerators/ipu_intermediate.rst b/docs/source-PL/accelerators/ipu_intermediate.rst similarity index 100% rename from docs/source/accelerators/ipu_intermediate.rst rename to docs/source-PL/accelerators/ipu_intermediate.rst diff --git a/docs/source/accelerators/tpu.rst b/docs/source-PL/accelerators/tpu.rst similarity index 100% rename from docs/source/accelerators/tpu.rst rename to docs/source-PL/accelerators/tpu.rst diff --git a/docs/source/accelerators/tpu_advanced.rst b/docs/source-PL/accelerators/tpu_advanced.rst similarity index 100% rename from docs/source/accelerators/tpu_advanced.rst rename to docs/source-PL/accelerators/tpu_advanced.rst diff --git a/docs/source/accelerators/tpu_basic.rst b/docs/source-PL/accelerators/tpu_basic.rst similarity index 100% rename from docs/source/accelerators/tpu_basic.rst rename to docs/source-PL/accelerators/tpu_basic.rst diff --git a/docs/source/accelerators/tpu_faq.rst b/docs/source-PL/accelerators/tpu_faq.rst similarity index 100% rename from docs/source/accelerators/tpu_faq.rst rename to docs/source-PL/accelerators/tpu_faq.rst diff --git a/docs/source/accelerators/tpu_intermediate.rst b/docs/source-PL/accelerators/tpu_intermediate.rst similarity index 100% rename from docs/source/accelerators/tpu_intermediate.rst rename to docs/source-PL/accelerators/tpu_intermediate.rst diff --git a/docs/source/advanced/finetuning.rst b/docs/source-PL/advanced/finetuning.rst similarity index 100% rename from docs/source/advanced/finetuning.rst rename to docs/source-PL/advanced/finetuning.rst diff --git a/docs/source/advanced/model_parallel.rst b/docs/source-PL/advanced/model_parallel.rst similarity index 100% rename from docs/source/advanced/model_parallel.rst rename to docs/source-PL/advanced/model_parallel.rst diff --git a/docs/source/advanced/pretrained.rst b/docs/source-PL/advanced/pretrained.rst similarity index 100% rename from docs/source/advanced/pretrained.rst rename to docs/source-PL/advanced/pretrained.rst diff --git a/docs/source/advanced/pruning_quantization.rst b/docs/source-PL/advanced/pruning_quantization.rst similarity index 100% rename from docs/source/advanced/pruning_quantization.rst rename to docs/source-PL/advanced/pruning_quantization.rst diff --git a/docs/source/advanced/strategy_registry.rst b/docs/source-PL/advanced/strategy_registry.rst similarity index 100% rename from docs/source/advanced/strategy_registry.rst rename to docs/source-PL/advanced/strategy_registry.rst diff --git a/docs/source/advanced/training_tricks.rst b/docs/source-PL/advanced/training_tricks.rst similarity index 100% rename from docs/source/advanced/training_tricks.rst rename to docs/source-PL/advanced/training_tricks.rst diff --git a/docs/source/advanced/transfer_learning.rst b/docs/source-PL/advanced/transfer_learning.rst similarity index 100% rename from docs/source/advanced/transfer_learning.rst rename to docs/source-PL/advanced/transfer_learning.rst diff --git a/docs/source/api_references.rst b/docs/source-PL/api_references.rst similarity index 100% rename from docs/source/api_references.rst rename to docs/source-PL/api_references.rst diff --git a/docs/source/benchmarking/benchmarks.rst b/docs/source-PL/benchmarking/benchmarks.rst similarity index 100% rename from docs/source/benchmarking/benchmarks.rst rename to docs/source-PL/benchmarking/benchmarks.rst diff --git a/docs/source/cli/lightning_cli.rst b/docs/source-PL/cli/lightning_cli.rst similarity index 100% rename from docs/source/cli/lightning_cli.rst rename to docs/source-PL/cli/lightning_cli.rst diff --git a/docs/source/cli/lightning_cli_advanced.rst b/docs/source-PL/cli/lightning_cli_advanced.rst similarity index 100% rename from docs/source/cli/lightning_cli_advanced.rst rename to docs/source-PL/cli/lightning_cli_advanced.rst diff --git a/docs/source/cli/lightning_cli_advanced_2.rst b/docs/source-PL/cli/lightning_cli_advanced_2.rst similarity index 100% rename from docs/source/cli/lightning_cli_advanced_2.rst rename to docs/source-PL/cli/lightning_cli_advanced_2.rst diff --git a/docs/source/cli/lightning_cli_advanced_3.rst b/docs/source-PL/cli/lightning_cli_advanced_3.rst similarity index 100% rename from docs/source/cli/lightning_cli_advanced_3.rst rename to docs/source-PL/cli/lightning_cli_advanced_3.rst diff --git a/docs/source/cli/lightning_cli_expert.rst b/docs/source-PL/cli/lightning_cli_expert.rst similarity index 100% rename from docs/source/cli/lightning_cli_expert.rst rename to docs/source-PL/cli/lightning_cli_expert.rst diff --git a/docs/source/cli/lightning_cli_faq.rst b/docs/source-PL/cli/lightning_cli_faq.rst similarity index 100% rename from docs/source/cli/lightning_cli_faq.rst rename to docs/source-PL/cli/lightning_cli_faq.rst diff --git a/docs/source/cli/lightning_cli_intermediate.rst b/docs/source-PL/cli/lightning_cli_intermediate.rst similarity index 100% rename from docs/source/cli/lightning_cli_intermediate.rst rename to docs/source-PL/cli/lightning_cli_intermediate.rst diff --git a/docs/source/cli/lightning_cli_intermediate_2.rst b/docs/source-PL/cli/lightning_cli_intermediate_2.rst similarity index 100% rename from docs/source/cli/lightning_cli_intermediate_2.rst rename to docs/source-PL/cli/lightning_cli_intermediate_2.rst diff --git a/docs/source/clouds/cloud_training.rst b/docs/source-PL/clouds/cloud_training.rst similarity index 100% rename from docs/source/clouds/cloud_training.rst rename to docs/source-PL/clouds/cloud_training.rst diff --git a/docs/source/clouds/cloud_training_intermediate.rst b/docs/source-PL/clouds/cloud_training_intermediate.rst similarity index 100% rename from docs/source/clouds/cloud_training_intermediate.rst rename to docs/source-PL/clouds/cloud_training_intermediate.rst diff --git a/docs/source/clouds/cluster.rst b/docs/source-PL/clouds/cluster.rst similarity index 100% rename from docs/source/clouds/cluster.rst rename to docs/source-PL/clouds/cluster.rst diff --git a/docs/source/clouds/cluster_advanced.rst b/docs/source-PL/clouds/cluster_advanced.rst similarity index 100% rename from docs/source/clouds/cluster_advanced.rst rename to docs/source-PL/clouds/cluster_advanced.rst diff --git a/docs/source/clouds/cluster_expert.rst b/docs/source-PL/clouds/cluster_expert.rst similarity index 100% rename from docs/source/clouds/cluster_expert.rst rename to docs/source-PL/clouds/cluster_expert.rst diff --git a/docs/source/clouds/cluster_intermediate_1.rst b/docs/source-PL/clouds/cluster_intermediate_1.rst similarity index 100% rename from docs/source/clouds/cluster_intermediate_1.rst rename to docs/source-PL/clouds/cluster_intermediate_1.rst diff --git a/docs/source/clouds/cluster_intermediate_2.rst b/docs/source-PL/clouds/cluster_intermediate_2.rst similarity index 100% rename from docs/source/clouds/cluster_intermediate_2.rst rename to docs/source-PL/clouds/cluster_intermediate_2.rst diff --git a/docs/source/clouds/fault_tolerant_training.rst b/docs/source-PL/clouds/fault_tolerant_training.rst similarity index 100% rename from docs/source/clouds/fault_tolerant_training.rst rename to docs/source-PL/clouds/fault_tolerant_training.rst diff --git a/docs/source/clouds/fault_tolerant_training_basic.rst b/docs/source-PL/clouds/fault_tolerant_training_basic.rst similarity index 100% rename from docs/source/clouds/fault_tolerant_training_basic.rst rename to docs/source-PL/clouds/fault_tolerant_training_basic.rst diff --git a/docs/source/clouds/fault_tolerant_training_expert.rst b/docs/source-PL/clouds/fault_tolerant_training_expert.rst similarity index 100% rename from docs/source/clouds/fault_tolerant_training_expert.rst rename to docs/source-PL/clouds/fault_tolerant_training_expert.rst diff --git a/docs/source/clouds/fault_tolerant_training_faq.rst b/docs/source-PL/clouds/fault_tolerant_training_faq.rst similarity index 100% rename from docs/source/clouds/fault_tolerant_training_faq.rst rename to docs/source-PL/clouds/fault_tolerant_training_faq.rst diff --git a/docs/source/clouds/grid_costs.rst b/docs/source-PL/clouds/grid_costs.rst similarity index 100% rename from docs/source/clouds/grid_costs.rst rename to docs/source-PL/clouds/grid_costs.rst diff --git a/docs/source/clouds/run_advanced.rst b/docs/source-PL/clouds/run_advanced.rst similarity index 100% rename from docs/source/clouds/run_advanced.rst rename to docs/source-PL/clouds/run_advanced.rst diff --git a/docs/source/clouds/run_basic.rst b/docs/source-PL/clouds/run_basic.rst similarity index 100% rename from docs/source/clouds/run_basic.rst rename to docs/source-PL/clouds/run_basic.rst diff --git a/docs/source/clouds/run_expert.rst b/docs/source-PL/clouds/run_expert.rst similarity index 100% rename from docs/source/clouds/run_expert.rst rename to docs/source-PL/clouds/run_expert.rst diff --git a/docs/source/clouds/run_intermediate.rst b/docs/source-PL/clouds/run_intermediate.rst similarity index 100% rename from docs/source/clouds/run_intermediate.rst rename to docs/source-PL/clouds/run_intermediate.rst diff --git a/docs/source/clouds/session_basic.rst b/docs/source-PL/clouds/session_basic.rst similarity index 100% rename from docs/source/clouds/session_basic.rst rename to docs/source-PL/clouds/session_basic.rst diff --git a/docs/source/clouds/session_intermediate.rst b/docs/source-PL/clouds/session_intermediate.rst similarity index 100% rename from docs/source/clouds/session_intermediate.rst rename to docs/source-PL/clouds/session_intermediate.rst diff --git a/docs/source/common/checkpointing.rst b/docs/source-PL/common/checkpointing.rst similarity index 100% rename from docs/source/common/checkpointing.rst rename to docs/source-PL/common/checkpointing.rst diff --git a/docs/source/common/checkpointing_advanced.rst b/docs/source-PL/common/checkpointing_advanced.rst similarity index 100% rename from docs/source/common/checkpointing_advanced.rst rename to docs/source-PL/common/checkpointing_advanced.rst diff --git a/docs/source/common/checkpointing_basic.rst b/docs/source-PL/common/checkpointing_basic.rst similarity index 100% rename from docs/source/common/checkpointing_basic.rst rename to docs/source-PL/common/checkpointing_basic.rst diff --git a/docs/source/common/checkpointing_expert.rst b/docs/source-PL/common/checkpointing_expert.rst similarity index 100% rename from docs/source/common/checkpointing_expert.rst rename to docs/source-PL/common/checkpointing_expert.rst diff --git a/docs/source/common/checkpointing_intermediate.rst b/docs/source-PL/common/checkpointing_intermediate.rst similarity index 100% rename from docs/source/common/checkpointing_intermediate.rst rename to docs/source-PL/common/checkpointing_intermediate.rst diff --git a/docs/source/common/child_modules.rst b/docs/source-PL/common/child_modules.rst similarity index 100% rename from docs/source/common/child_modules.rst rename to docs/source-PL/common/child_modules.rst diff --git a/docs/source/common/console_logs.rst b/docs/source-PL/common/console_logs.rst similarity index 100% rename from docs/source/common/console_logs.rst rename to docs/source-PL/common/console_logs.rst diff --git a/docs/source/common/early_stopping.rst b/docs/source-PL/common/early_stopping.rst similarity index 100% rename from docs/source/common/early_stopping.rst rename to docs/source-PL/common/early_stopping.rst diff --git a/docs/source/common/evaluation.rst b/docs/source-PL/common/evaluation.rst similarity index 100% rename from docs/source/common/evaluation.rst rename to docs/source-PL/common/evaluation.rst diff --git a/docs/source/common/evaluation_basic.rst b/docs/source-PL/common/evaluation_basic.rst similarity index 100% rename from docs/source/common/evaluation_basic.rst rename to docs/source-PL/common/evaluation_basic.rst diff --git a/docs/source/common/evaluation_intermediate.rst b/docs/source-PL/common/evaluation_intermediate.rst similarity index 100% rename from docs/source/common/evaluation_intermediate.rst rename to docs/source-PL/common/evaluation_intermediate.rst diff --git a/docs/source/common/gradient_accumulation.rst b/docs/source-PL/common/gradient_accumulation.rst similarity index 100% rename from docs/source/common/gradient_accumulation.rst rename to docs/source-PL/common/gradient_accumulation.rst diff --git a/docs/source/common/hyperparameters.rst b/docs/source-PL/common/hyperparameters.rst similarity index 100% rename from docs/source/common/hyperparameters.rst rename to docs/source-PL/common/hyperparameters.rst diff --git a/docs/source/common/lightning_module.rst b/docs/source-PL/common/lightning_module.rst similarity index 100% rename from docs/source/common/lightning_module.rst rename to docs/source-PL/common/lightning_module.rst diff --git a/docs/source/common/optimization.rst b/docs/source-PL/common/optimization.rst similarity index 100% rename from docs/source/common/optimization.rst rename to docs/source-PL/common/optimization.rst diff --git a/docs/source/common/precision.rst b/docs/source-PL/common/precision.rst similarity index 100% rename from docs/source/common/precision.rst rename to docs/source-PL/common/precision.rst diff --git a/docs/source/common/precision_basic.rst b/docs/source-PL/common/precision_basic.rst similarity index 100% rename from docs/source/common/precision_basic.rst rename to docs/source-PL/common/precision_basic.rst diff --git a/docs/source/common/precision_expert.rst b/docs/source-PL/common/precision_expert.rst similarity index 100% rename from docs/source/common/precision_expert.rst rename to docs/source-PL/common/precision_expert.rst diff --git a/docs/source/common/precision_intermediate.rst b/docs/source-PL/common/precision_intermediate.rst similarity index 100% rename from docs/source/common/precision_intermediate.rst rename to docs/source-PL/common/precision_intermediate.rst diff --git a/docs/source/common/progress_bar.rst b/docs/source-PL/common/progress_bar.rst similarity index 100% rename from docs/source/common/progress_bar.rst rename to docs/source-PL/common/progress_bar.rst diff --git a/docs/source/common/remote_fs.rst b/docs/source-PL/common/remote_fs.rst similarity index 100% rename from docs/source/common/remote_fs.rst rename to docs/source-PL/common/remote_fs.rst diff --git a/docs/source/common/trainer.rst b/docs/source-PL/common/trainer.rst similarity index 100% rename from docs/source/common/trainer.rst rename to docs/source-PL/common/trainer.rst diff --git a/docs/source/common_usecases.rst b/docs/source-PL/common_usecases.rst similarity index 100% rename from docs/source/common_usecases.rst rename to docs/source-PL/common_usecases.rst diff --git a/docs/source/conf.py b/docs/source-PL/conf.py similarity index 96% rename from docs/source/conf.py rename to docs/source-PL/conf.py index 508c32e9037be..41d52f4290c2a 100644 --- a/docs/source/conf.py +++ b/docs/source-PL/conf.py @@ -17,10 +17,11 @@ import shutil import sys import warnings -from importlib.util import module_from_spec, spec_from_file_location import pt_lightning_sphinx_theme +import pytorch_lightning + # ----------------------- # VARIABLES WHEN WORKING ON DOCS... MAKE THIS TRUE TO BUILD FASTER # ----------------------- @@ -32,12 +33,10 @@ PATH_HERE = os.path.abspath(os.path.dirname(__file__)) PATH_ROOT = os.path.join(PATH_HERE, "..", "..") PATH_RAW_NB = os.path.join(PATH_ROOT, "_notebooks") +_SHOULD_COPY_NOTEBOOKS = True sys.path.insert(0, os.path.abspath(PATH_ROOT)) sys.path.append(os.path.join(PATH_RAW_NB, ".actions")) -_SHOULD_COPY_NOTEBOOKS = True - - try: from assistant import AssistantCLI except ImportError: @@ -47,12 +46,6 @@ FOLDER_GENERATED = "generated" SPHINX_MOCK_REQUIREMENTS = int(os.environ.get("SPHINX_MOCK_REQUIREMENTS", True)) -spec = spec_from_file_location( - "pytorch_lightning/__about__.py", os.path.join(PATH_ROOT, "pytorch_lightning", "__about__.py") -) -about = module_from_spec(spec) -spec.loader.exec_module(about) - # -- Project documents ------------------------------------------------------- if _SHOULD_COPY_NOTEBOOKS: AssistantCLI.copy_notebooks( @@ -85,13 +78,13 @@ def _transform_changelog(path_in: str, path_out: str) -> None: # -- Project information ----------------------------------------------------- project = "PyTorch Lightning" -copyright = about.__copyright__ -author = about.__author__ +copyright = pytorch_lightning.__copyright__ +author = pytorch_lightning.__author__ # The short X.Y version -version = about.__version__ +version = pytorch_lightning.__version__ # The full version, including alpha/beta/rc tags -release = about.__version__ +release = pytorch_lightning.__version__ # -- General configuration --------------------------------------------------- @@ -192,7 +185,7 @@ def _transform_changelog(path_in: str, path_out: str) -> None: html_theme_options = { "pytorch_project": "https://pytorchlightning.ai", - "canonical_url": about.__docs_url__, + "canonical_url": pytorch_lightning.__docs_url__, "collapse_navigation": False, "display_version": True, "logo_only": False, @@ -344,7 +337,6 @@ def package_list_from_file(file): } MOCK_PACKAGES = [] if SPHINX_MOCK_REQUIREMENTS: - MOCK_PACKAGES += ["fairscale"] _path_require = lambda fname: os.path.join(PATH_ROOT, "requirements", fname) # mock also base packages when we are on RTD since we don't install them there MOCK_PACKAGES += package_list_from_file(_path_require("base.txt")) diff --git a/docs/source/data/datamodule.rst b/docs/source-PL/data/datamodule.rst similarity index 100% rename from docs/source/data/datamodule.rst rename to docs/source-PL/data/datamodule.rst diff --git a/docs/source/debug/debugging.rst b/docs/source-PL/debug/debugging.rst similarity index 100% rename from docs/source/debug/debugging.rst rename to docs/source-PL/debug/debugging.rst diff --git a/docs/source/debug/debugging_advanced.rst b/docs/source-PL/debug/debugging_advanced.rst similarity index 100% rename from docs/source/debug/debugging_advanced.rst rename to docs/source-PL/debug/debugging_advanced.rst diff --git a/docs/source/debug/debugging_basic.rst b/docs/source-PL/debug/debugging_basic.rst similarity index 100% rename from docs/source/debug/debugging_basic.rst rename to docs/source-PL/debug/debugging_basic.rst diff --git a/docs/source/debug/debugging_intermediate.rst b/docs/source-PL/debug/debugging_intermediate.rst similarity index 100% rename from docs/source/debug/debugging_intermediate.rst rename to docs/source-PL/debug/debugging_intermediate.rst diff --git a/docs/source/deploy/production.rst b/docs/source-PL/deploy/production.rst similarity index 100% rename from docs/source/deploy/production.rst rename to docs/source-PL/deploy/production.rst diff --git a/docs/source/deploy/production_advanced.rst b/docs/source-PL/deploy/production_advanced.rst similarity index 100% rename from docs/source/deploy/production_advanced.rst rename to docs/source-PL/deploy/production_advanced.rst diff --git a/docs/source/deploy/production_advanced_2.rst b/docs/source-PL/deploy/production_advanced_2.rst similarity index 100% rename from docs/source/deploy/production_advanced_2.rst rename to docs/source-PL/deploy/production_advanced_2.rst diff --git a/docs/source/deploy/production_basic.rst b/docs/source-PL/deploy/production_basic.rst similarity index 100% rename from docs/source/deploy/production_basic.rst rename to docs/source-PL/deploy/production_basic.rst diff --git a/docs/source/deploy/production_intermediate.rst b/docs/source-PL/deploy/production_intermediate.rst similarity index 100% rename from docs/source/deploy/production_intermediate.rst rename to docs/source-PL/deploy/production_intermediate.rst diff --git a/docs/source/ecosystem/asr_nlp_tts.rst b/docs/source-PL/ecosystem/asr_nlp_tts.rst similarity index 100% rename from docs/source/ecosystem/asr_nlp_tts.rst rename to docs/source-PL/ecosystem/asr_nlp_tts.rst diff --git a/docs/source/ecosystem/bolts.rst b/docs/source-PL/ecosystem/bolts.rst similarity index 100% rename from docs/source/ecosystem/bolts.rst rename to docs/source-PL/ecosystem/bolts.rst diff --git a/docs/source/ecosystem/community_examples.rst b/docs/source-PL/ecosystem/community_examples.rst similarity index 100% rename from docs/source/ecosystem/community_examples.rst rename to docs/source-PL/ecosystem/community_examples.rst diff --git a/docs/source/ecosystem/ecosystem-ci.rst b/docs/source-PL/ecosystem/ecosystem-ci.rst similarity index 100% rename from docs/source/ecosystem/ecosystem-ci.rst rename to docs/source-PL/ecosystem/ecosystem-ci.rst diff --git a/docs/source/ecosystem/flash.rst b/docs/source-PL/ecosystem/flash.rst similarity index 100% rename from docs/source/ecosystem/flash.rst rename to docs/source-PL/ecosystem/flash.rst diff --git a/docs/source/ecosystem/metrics.rst b/docs/source-PL/ecosystem/metrics.rst similarity index 100% rename from docs/source/ecosystem/metrics.rst rename to docs/source-PL/ecosystem/metrics.rst diff --git a/docs/source/ecosystem/transformers.rst b/docs/source-PL/ecosystem/transformers.rst similarity index 100% rename from docs/source/ecosystem/transformers.rst rename to docs/source-PL/ecosystem/transformers.rst diff --git a/docs/source/expertise_levels.rst b/docs/source-PL/expertise_levels.rst similarity index 100% rename from docs/source/expertise_levels.rst rename to docs/source-PL/expertise_levels.rst diff --git a/docs/source/extensions/accelerator.rst b/docs/source-PL/extensions/accelerator.rst similarity index 100% rename from docs/source/extensions/accelerator.rst rename to docs/source-PL/extensions/accelerator.rst diff --git a/docs/source/extensions/callbacks.rst b/docs/source-PL/extensions/callbacks.rst similarity index 100% rename from docs/source/extensions/callbacks.rst rename to docs/source-PL/extensions/callbacks.rst diff --git a/docs/source/extensions/callbacks_state.rst b/docs/source-PL/extensions/callbacks_state.rst similarity index 100% rename from docs/source/extensions/callbacks_state.rst rename to docs/source-PL/extensions/callbacks_state.rst diff --git a/docs/source/extensions/datamodules_state.rst b/docs/source-PL/extensions/datamodules_state.rst similarity index 100% rename from docs/source/extensions/datamodules_state.rst rename to docs/source-PL/extensions/datamodules_state.rst diff --git a/docs/source/extensions/entry_points.rst b/docs/source-PL/extensions/entry_points.rst similarity index 100% rename from docs/source/extensions/entry_points.rst rename to docs/source-PL/extensions/entry_points.rst diff --git a/docs/source/extensions/logging.rst b/docs/source-PL/extensions/logging.rst similarity index 100% rename from docs/source/extensions/logging.rst rename to docs/source-PL/extensions/logging.rst diff --git a/docs/source/extensions/loops.rst b/docs/source-PL/extensions/loops.rst similarity index 100% rename from docs/source/extensions/loops.rst rename to docs/source-PL/extensions/loops.rst diff --git a/docs/source/extensions/loops_advanced.rst b/docs/source-PL/extensions/loops_advanced.rst similarity index 100% rename from docs/source/extensions/loops_advanced.rst rename to docs/source-PL/extensions/loops_advanced.rst diff --git a/docs/source/extensions/plugins.rst b/docs/source-PL/extensions/plugins.rst similarity index 100% rename from docs/source/extensions/plugins.rst rename to docs/source-PL/extensions/plugins.rst diff --git a/docs/source/extensions/strategy.rst b/docs/source-PL/extensions/strategy.rst similarity index 100% rename from docs/source/extensions/strategy.rst rename to docs/source-PL/extensions/strategy.rst diff --git a/docs/source/governance.rst b/docs/source-PL/governance.rst similarity index 100% rename from docs/source/governance.rst rename to docs/source-PL/governance.rst diff --git a/docs/source/guides/data.rst b/docs/source-PL/guides/data.rst similarity index 100% rename from docs/source/guides/data.rst rename to docs/source-PL/guides/data.rst diff --git a/docs/source/guides/speed.rst b/docs/source-PL/guides/speed.rst similarity index 100% rename from docs/source/guides/speed.rst rename to docs/source-PL/guides/speed.rst diff --git a/docs/source/index.rst b/docs/source-PL/index.rst similarity index 100% rename from docs/source/index.rst rename to docs/source-PL/index.rst diff --git a/docs/source/levels/advanced.rst b/docs/source-PL/levels/advanced.rst similarity index 100% rename from docs/source/levels/advanced.rst rename to docs/source-PL/levels/advanced.rst diff --git a/docs/source/levels/advanced_level_15.rst b/docs/source-PL/levels/advanced_level_15.rst similarity index 100% rename from docs/source/levels/advanced_level_15.rst rename to docs/source-PL/levels/advanced_level_15.rst diff --git a/docs/source/levels/advanced_level_16.rst b/docs/source-PL/levels/advanced_level_16.rst similarity index 100% rename from docs/source/levels/advanced_level_16.rst rename to docs/source-PL/levels/advanced_level_16.rst diff --git a/docs/source/levels/advanced_level_17.rst b/docs/source-PL/levels/advanced_level_17.rst similarity index 100% rename from docs/source/levels/advanced_level_17.rst rename to docs/source-PL/levels/advanced_level_17.rst diff --git a/docs/source/levels/advanced_level_18.rst b/docs/source-PL/levels/advanced_level_18.rst similarity index 100% rename from docs/source/levels/advanced_level_18.rst rename to docs/source-PL/levels/advanced_level_18.rst diff --git a/docs/source/levels/advanced_level_19.rst b/docs/source-PL/levels/advanced_level_19.rst similarity index 100% rename from docs/source/levels/advanced_level_19.rst rename to docs/source-PL/levels/advanced_level_19.rst diff --git a/docs/source/levels/advanced_level_20.rst b/docs/source-PL/levels/advanced_level_20.rst similarity index 100% rename from docs/source/levels/advanced_level_20.rst rename to docs/source-PL/levels/advanced_level_20.rst diff --git a/docs/source/levels/advanced_level_21.rst b/docs/source-PL/levels/advanced_level_21.rst similarity index 100% rename from docs/source/levels/advanced_level_21.rst rename to docs/source-PL/levels/advanced_level_21.rst diff --git a/docs/source/levels/advanced_level_22.rst b/docs/source-PL/levels/advanced_level_22.rst similarity index 100% rename from docs/source/levels/advanced_level_22.rst rename to docs/source-PL/levels/advanced_level_22.rst diff --git a/docs/source/levels/basic_level_2.rst b/docs/source-PL/levels/basic_level_2.rst similarity index 100% rename from docs/source/levels/basic_level_2.rst rename to docs/source-PL/levels/basic_level_2.rst diff --git a/docs/source/levels/basic_level_5.rst b/docs/source-PL/levels/basic_level_5.rst similarity index 100% rename from docs/source/levels/basic_level_5.rst rename to docs/source-PL/levels/basic_level_5.rst diff --git a/docs/source/levels/core_level_3.rst b/docs/source-PL/levels/core_level_3.rst similarity index 100% rename from docs/source/levels/core_level_3.rst rename to docs/source-PL/levels/core_level_3.rst diff --git a/docs/source/levels/core_level_6.rst b/docs/source-PL/levels/core_level_6.rst similarity index 100% rename from docs/source/levels/core_level_6.rst rename to docs/source-PL/levels/core_level_6.rst diff --git a/docs/source/levels/core_skills.rst b/docs/source-PL/levels/core_skills.rst similarity index 100% rename from docs/source/levels/core_skills.rst rename to docs/source-PL/levels/core_skills.rst diff --git a/docs/source/levels/expert.rst b/docs/source-PL/levels/expert.rst similarity index 100% rename from docs/source/levels/expert.rst rename to docs/source-PL/levels/expert.rst diff --git a/docs/source/levels/expert_level_23.rst b/docs/source-PL/levels/expert_level_23.rst similarity index 100% rename from docs/source/levels/expert_level_23.rst rename to docs/source-PL/levels/expert_level_23.rst diff --git a/docs/source/levels/expert_level_24.rst b/docs/source-PL/levels/expert_level_24.rst similarity index 100% rename from docs/source/levels/expert_level_24.rst rename to docs/source-PL/levels/expert_level_24.rst diff --git a/docs/source/levels/expert_level_27.rst b/docs/source-PL/levels/expert_level_27.rst similarity index 100% rename from docs/source/levels/expert_level_27.rst rename to docs/source-PL/levels/expert_level_27.rst diff --git a/docs/source/levels/intermediate.rst b/docs/source-PL/levels/intermediate.rst similarity index 100% rename from docs/source/levels/intermediate.rst rename to docs/source-PL/levels/intermediate.rst diff --git a/docs/source/levels/intermediate_level_10.rst b/docs/source-PL/levels/intermediate_level_10.rst similarity index 100% rename from docs/source/levels/intermediate_level_10.rst rename to docs/source-PL/levels/intermediate_level_10.rst diff --git a/docs/source/levels/intermediate_level_11.rst b/docs/source-PL/levels/intermediate_level_11.rst similarity index 100% rename from docs/source/levels/intermediate_level_11.rst rename to docs/source-PL/levels/intermediate_level_11.rst diff --git a/docs/source/levels/intermediate_level_12.rst b/docs/source-PL/levels/intermediate_level_12.rst similarity index 100% rename from docs/source/levels/intermediate_level_12.rst rename to docs/source-PL/levels/intermediate_level_12.rst diff --git a/docs/source/levels/intermediate_level_13.rst b/docs/source-PL/levels/intermediate_level_13.rst similarity index 100% rename from docs/source/levels/intermediate_level_13.rst rename to docs/source-PL/levels/intermediate_level_13.rst diff --git a/docs/source/levels/intermediate_level_14.rst b/docs/source-PL/levels/intermediate_level_14.rst similarity index 100% rename from docs/source/levels/intermediate_level_14.rst rename to docs/source-PL/levels/intermediate_level_14.rst diff --git a/docs/source/levels/intermediate_level_7.rst b/docs/source-PL/levels/intermediate_level_7.rst similarity index 100% rename from docs/source/levels/intermediate_level_7.rst rename to docs/source-PL/levels/intermediate_level_7.rst diff --git a/docs/source/levels/intermediate_level_8.rst b/docs/source-PL/levels/intermediate_level_8.rst similarity index 100% rename from docs/source/levels/intermediate_level_8.rst rename to docs/source-PL/levels/intermediate_level_8.rst diff --git a/docs/source/levels/intermediate_level_9.rst b/docs/source-PL/levels/intermediate_level_9.rst similarity index 100% rename from docs/source/levels/intermediate_level_9.rst rename to docs/source-PL/levels/intermediate_level_9.rst diff --git a/docs/source/links.rst b/docs/source-PL/links.rst similarity index 100% rename from docs/source/links.rst rename to docs/source-PL/links.rst diff --git a/docs/source/model/build_model.rst b/docs/source-PL/model/build_model.rst similarity index 100% rename from docs/source/model/build_model.rst rename to docs/source-PL/model/build_model.rst diff --git a/docs/source/model/build_model_advanced.rst b/docs/source-PL/model/build_model_advanced.rst similarity index 100% rename from docs/source/model/build_model_advanced.rst rename to docs/source-PL/model/build_model_advanced.rst diff --git a/docs/source/model/build_model_expert.rst b/docs/source-PL/model/build_model_expert.rst similarity index 100% rename from docs/source/model/build_model_expert.rst rename to docs/source-PL/model/build_model_expert.rst diff --git a/docs/source/model/build_model_intermediate.rst b/docs/source-PL/model/build_model_intermediate.rst similarity index 100% rename from docs/source/model/build_model_intermediate.rst rename to docs/source-PL/model/build_model_intermediate.rst diff --git a/docs/source/model/manual_optimization.rst b/docs/source-PL/model/manual_optimization.rst similarity index 100% rename from docs/source/model/manual_optimization.rst rename to docs/source-PL/model/manual_optimization.rst diff --git a/docs/source/model/own_your_loop.rst b/docs/source-PL/model/own_your_loop.rst similarity index 100% rename from docs/source/model/own_your_loop.rst rename to docs/source-PL/model/own_your_loop.rst diff --git a/docs/source/model/train_model_basic.rst b/docs/source-PL/model/train_model_basic.rst similarity index 100% rename from docs/source/model/train_model_basic.rst rename to docs/source-PL/model/train_model_basic.rst diff --git a/docs/source/starter/converting.rst b/docs/source-PL/starter/converting.rst similarity index 100% rename from docs/source/starter/converting.rst rename to docs/source-PL/starter/converting.rst diff --git a/docs/source/starter/installation.rst b/docs/source-PL/starter/installation.rst similarity index 100% rename from docs/source/starter/installation.rst rename to docs/source-PL/starter/installation.rst diff --git a/docs/source/starter/introduction.rst b/docs/source-PL/starter/introduction.rst similarity index 100% rename from docs/source/starter/introduction.rst rename to docs/source-PL/starter/introduction.rst diff --git a/docs/source/starter/lightning_lite.rst b/docs/source-PL/starter/lightning_lite.rst similarity index 100% rename from docs/source/starter/lightning_lite.rst rename to docs/source-PL/starter/lightning_lite.rst diff --git a/docs/source/starter/style_guide.rst b/docs/source-PL/starter/style_guide.rst similarity index 100% rename from docs/source/starter/style_guide.rst rename to docs/source-PL/starter/style_guide.rst diff --git a/docs/source/strategies/collaborative_training.rst b/docs/source-PL/strategies/collaborative_training.rst similarity index 100% rename from docs/source/strategies/collaborative_training.rst rename to docs/source-PL/strategies/collaborative_training.rst diff --git a/docs/source/strategies/collaborative_training_basic.rst b/docs/source-PL/strategies/collaborative_training_basic.rst similarity index 100% rename from docs/source/strategies/collaborative_training_basic.rst rename to docs/source-PL/strategies/collaborative_training_basic.rst diff --git a/docs/source/strategies/collaborative_training_expert.rst b/docs/source-PL/strategies/collaborative_training_expert.rst similarity index 100% rename from docs/source/strategies/collaborative_training_expert.rst rename to docs/source-PL/strategies/collaborative_training_expert.rst diff --git a/docs/source/strategies/collaborative_training_intermediate.rst b/docs/source-PL/strategies/collaborative_training_intermediate.rst similarity index 100% rename from docs/source/strategies/collaborative_training_intermediate.rst rename to docs/source-PL/strategies/collaborative_training_intermediate.rst diff --git a/docs/source/tuning/profiler.rst b/docs/source-PL/tuning/profiler.rst similarity index 100% rename from docs/source/tuning/profiler.rst rename to docs/source-PL/tuning/profiler.rst diff --git a/docs/source/tuning/profiler_advanced.rst b/docs/source-PL/tuning/profiler_advanced.rst similarity index 100% rename from docs/source/tuning/profiler_advanced.rst rename to docs/source-PL/tuning/profiler_advanced.rst diff --git a/docs/source/tuning/profiler_basic.rst b/docs/source-PL/tuning/profiler_basic.rst similarity index 100% rename from docs/source/tuning/profiler_basic.rst rename to docs/source-PL/tuning/profiler_basic.rst diff --git a/docs/source/tuning/profiler_expert.rst b/docs/source-PL/tuning/profiler_expert.rst similarity index 100% rename from docs/source/tuning/profiler_expert.rst rename to docs/source-PL/tuning/profiler_expert.rst diff --git a/docs/source/tuning/profiler_intermediate.rst b/docs/source-PL/tuning/profiler_intermediate.rst similarity index 100% rename from docs/source/tuning/profiler_intermediate.rst rename to docs/source-PL/tuning/profiler_intermediate.rst diff --git a/docs/source/tutorials.rst b/docs/source-PL/tutorials.rst similarity index 100% rename from docs/source/tutorials.rst rename to docs/source-PL/tutorials.rst diff --git a/docs/source/visualize/experiment_managers.rst b/docs/source-PL/visualize/experiment_managers.rst similarity index 100% rename from docs/source/visualize/experiment_managers.rst rename to docs/source-PL/visualize/experiment_managers.rst diff --git a/docs/source/visualize/loggers.rst b/docs/source-PL/visualize/loggers.rst similarity index 100% rename from docs/source/visualize/loggers.rst rename to docs/source-PL/visualize/loggers.rst diff --git a/docs/source/visualize/logging_advanced.rst b/docs/source-PL/visualize/logging_advanced.rst similarity index 100% rename from docs/source/visualize/logging_advanced.rst rename to docs/source-PL/visualize/logging_advanced.rst diff --git a/docs/source/visualize/logging_basic.rst b/docs/source-PL/visualize/logging_basic.rst similarity index 100% rename from docs/source/visualize/logging_basic.rst rename to docs/source-PL/visualize/logging_basic.rst diff --git a/docs/source/visualize/logging_expert.rst b/docs/source-PL/visualize/logging_expert.rst similarity index 100% rename from docs/source/visualize/logging_expert.rst rename to docs/source-PL/visualize/logging_expert.rst diff --git a/docs/source/visualize/logging_intermediate.rst b/docs/source-PL/visualize/logging_intermediate.rst similarity index 100% rename from docs/source/visualize/logging_intermediate.rst rename to docs/source-PL/visualize/logging_intermediate.rst diff --git a/docs/source/visualize/supported_exp_managers.rst b/docs/source-PL/visualize/supported_exp_managers.rst similarity index 100% rename from docs/source/visualize/supported_exp_managers.rst rename to docs/source-PL/visualize/supported_exp_managers.rst diff --git a/setup.py b/setup.py index ba744ffee2936..ac5628f81f229 100755 --- a/setup.py +++ b/setup.py @@ -78,7 +78,7 @@ def _load_readme_description(path_dir: str, homepage: str, version: str) -> str: github_source_url = os.path.join(homepage, "raw", version) # replace relative repository path to absolute link to the release # do not replace all "docs" as in the readme we reger some other sources with particular path to docs - text = text.replace("docs/source/_static/", f"{os.path.join(github_source_url, 'docs/source/_static/')}") + text = text.replace("docs/source/_static/", f"{os.path.join(github_source_url, 'docs/source-PL/_static/')}") # readthedocs badge text = text.replace("badge/?version=stable", f"badge/?version={version}") diff --git a/src/pytorch_lightning/__about__.py b/src/pytorch_lightning/__about__.py index 0a309f964d217..f1fb3e40c7a31 100644 --- a/src/pytorch_lightning/__about__.py +++ b/src/pytorch_lightning/__about__.py @@ -35,4 +35,13 @@ - https://pytorch-lightning.readthedocs.io/en/stable """ -__all__ = ["__author__", "__author_email__", "__copyright__", "__docs__", "__homepage__", "__license__", "__version__"] +__all__ = [ + "__author__", + "__author_email__", + "__copyright__", + "__docs__", + "__docs_url__", + "__homepage__", + "__license__", + "__version__", +] From e02daefe35d01e6c5c45f6c29595b099b4e82863 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 9 Jun 2022 18:59:59 +0200 Subject: [PATCH 11/20] docs: fix typing --- src/pytorch_lightning/plugins/precision/sharded_native_amp.py | 2 ++ src/pytorch_lightning/strategies/collaborative.py | 2 ++ src/pytorch_lightning/strategies/ddp.py | 2 ++ src/pytorch_lightning/strategies/sharded.py | 2 ++ src/pytorch_lightning/strategies/sharded_spawn.py | 2 ++ 5 files changed, 10 insertions(+) diff --git a/src/pytorch_lightning/plugins/precision/sharded_native_amp.py b/src/pytorch_lightning/plugins/precision/sharded_native_amp.py index e40aea8ecf4eb..61b8cd16f73f3 100644 --- a/src/pytorch_lightning/plugins/precision/sharded_native_amp.py +++ b/src/pytorch_lightning/plugins/precision/sharded_native_amp.py @@ -22,6 +22,8 @@ if _FAIRSCALE_AVAILABLE: from fairscale.optim import OSS from fairscale.optim.grad_scaler import ShardedGradScaler +else: + OSS = ShardedGradScaler = object class ShardedNativeMixedPrecisionPlugin(NativeMixedPrecisionPlugin): diff --git a/src/pytorch_lightning/strategies/collaborative.py b/src/pytorch_lightning/strategies/collaborative.py index 5acc1e0df60d0..3eafe595a7323 100644 --- a/src/pytorch_lightning/strategies/collaborative.py +++ b/src/pytorch_lightning/strategies/collaborative.py @@ -25,6 +25,8 @@ if _HIVEMIND_AVAILABLE: import hivemind +else: + hivemind = None log = logging.getLogger(__name__) diff --git a/src/pytorch_lightning/strategies/ddp.py b/src/pytorch_lightning/strategies/ddp.py index c431c2d790aec..655da334eb2f2 100644 --- a/src/pytorch_lightning/strategies/ddp.py +++ b/src/pytorch_lightning/strategies/ddp.py @@ -63,6 +63,8 @@ if _FAIRSCALE_AVAILABLE: from fairscale.optim import OSS +else: + OSS = object if _TORCH_GREATER_EQUAL_1_10 and torch.distributed.is_available(): from torch.distributed.algorithms.model_averaging.averagers import ModelAverager diff --git a/src/pytorch_lightning/strategies/sharded.py b/src/pytorch_lightning/strategies/sharded.py index 8a76520755345..e22dbe0a95199 100644 --- a/src/pytorch_lightning/strategies/sharded.py +++ b/src/pytorch_lightning/strategies/sharded.py @@ -33,6 +33,8 @@ from fairscale.optim import OSS from pytorch_lightning.overrides.fairscale import LightningShardedDataParallel, unwrap_lightning_module_sharded +else: + OSS = ShardedDataParallel = object class DDPShardedStrategy(DDPStrategy): diff --git a/src/pytorch_lightning/strategies/sharded_spawn.py b/src/pytorch_lightning/strategies/sharded_spawn.py index 58ad47f464bfc..19c38004739f7 100644 --- a/src/pytorch_lightning/strategies/sharded_spawn.py +++ b/src/pytorch_lightning/strategies/sharded_spawn.py @@ -31,6 +31,8 @@ from fairscale.optim import OSS from pytorch_lightning.overrides.fairscale import LightningShardedDataParallel, unwrap_lightning_module_sharded +else: + OSS = ShardedDataParallel = object class DDPSpawnShardedStrategy(DDPSpawnStrategy): From 35c2275f3a88e00732aa5e65ef0d698ed58dc879 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 9 Jun 2022 19:31:26 +0200 Subject: [PATCH 12/20] CI: update CircleCI --- .circleci/config.yml | 2 +- .github/workflows/code-checks.yml | 3 ++- dockers/tpu-tests/Dockerfile | 3 ++- dockers/tpu-tests/tpu_test_cases.jsonnet | 10 +++++----- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c54d24d920607..7657709420f85 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -41,7 +41,7 @@ references: # the image uses python 2.7 by default, force a different version pyenv global 3.7.3 python --version - pip install -r requirements/docs.txt + pip install -e . -r requirements/docs.txt pip list cd docs make clean diff --git a/.github/workflows/code-checks.yml b/.github/workflows/code-checks.yml index 183b9b6002a45..ca048bf187cc0 100644 --- a/.github/workflows/code-checks.yml +++ b/.github/workflows/code-checks.yml @@ -37,4 +37,5 @@ jobs: pip list - name: Type check - run: mypy src/ --install-types --non-interactive + working-directory: ./src + run: mypy -p pytorch_lightning --install-types --non-interactive --verbose --config-file ../pyproject.toml --warn-unused-configs diff --git a/dockers/tpu-tests/Dockerfile b/dockers/tpu-tests/Dockerfile index d4c58c665e7a5..5005fd0f9ad7e 100644 --- a/dockers/tpu-tests/Dockerfile +++ b/dockers/tpu-tests/Dockerfile @@ -22,7 +22,8 @@ LABEL maintainer="PyTorchLightning " COPY ./ ./pytorch-lightning/ # Pull the legacy checkpoints -RUN cd pytorch-lightning && bash .actions/pull_legacy_checkpoints.sh +RUN cd pytorch-lightning && \ + bash .actions/pull_legacy_checkpoints.sh RUN \ pip install -q fire && \ diff --git a/dockers/tpu-tests/tpu_test_cases.jsonnet b/dockers/tpu-tests/tpu_test_cases.jsonnet index c474ea6641076..40ea27dd64de3 100644 --- a/dockers/tpu-tests/tpu_test_cases.jsonnet +++ b/dockers/tpu-tests/tpu_test_cases.jsonnet @@ -33,12 +33,12 @@ local tputests = base.BaseTest { echo $KUBE_GOOGLE_CLOUD_TPU_ENDPOINTS export XRT_TPU_CONFIG="tpu_worker;0;${KUBE_GOOGLE_CLOUD_TPU_ENDPOINTS:7}" # TODO (@kaushikb11): Add device stats tests here + cd test coverage run --source=pytorch_lightning -m pytest -v --capture=no \ - tests/strategies/test_tpu_spawn.py \ - tests/profiler/test_xla_profiler.py \ - pytorch_lightning/utilities/xla_device.py \ - tests/accelerators/test_tpu.py \ - tests/models/test_tpu.py + unittests/strategies/test_tpu_spawn.py \ + unittests/profiler/test_xla_profiler.py \ + unittests/accelerators/test_tpu.py \ + unittests/models/test_tpu.py test_exit_code=$? echo "\n||| END PYTEST LOGS |||\n" coverage xml From 94f4bdf6d64be0f55e269b77e7beb638857eefe4 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 9 Jun 2022 20:22:48 +0200 Subject: [PATCH 13/20] fix dockers --- dockers/base-conda/Dockerfile | 7 ++++--- dockers/release/Dockerfile | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/dockers/base-conda/Dockerfile b/dockers/base-conda/Dockerfile index 72603b04ffd64..5823f9296d426 100644 --- a/dockers/base-conda/Dockerfile +++ b/dockers/base-conda/Dockerfile @@ -97,9 +97,10 @@ RUN \ python requirements/adjust-versions.py requirements/extra.txt && \ python requirements/adjust-versions.py requirements/examples.txt && \ # Install remaining requirements - pip install -r requirements/base.txt --no-cache-dir --find-links https://download.pytorch.org/whl/test/torch_test.html && \ - pip install -r requirements/extra.txt --no-cache-dir --find-links https://download.pytorch.org/whl/test/torch_test.html && \ - pip install -r requirements/examples.txt --no-cache-dir --find-links https://download.pytorch.org/whl/test/torch_test.html && \ + pip install -r requirements/base.txt \ + -r requirements/extra.txt \ + -r requirements/examples.txt \ + --no-cache-dir --find-links https://download.pytorch.org/whl/test/torch_test.html && \ rm assistant.py ENV \ diff --git a/dockers/release/Dockerfile b/dockers/release/Dockerfile index a0ba3a4a41c37..6093f745ab086 100644 --- a/dockers/release/Dockerfile +++ b/dockers/release/Dockerfile @@ -27,7 +27,7 @@ COPY ./ /home/pytorch-lightning/ RUN \ cd /home && \ mv pytorch-lightning/_notebooks notebooks && \ - mv pytorch-lightning/pl_examples . && \ + mv pytorch-lightning/src/pl_examples . && \ # replace by specific version if asked if [ ! -z "$LIGHTNING_VERSION" ] ; then \ rm -rf pytorch-lightning ; \ From 68028db7fc0d0a962d482aba3c2aefb0eef13144 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 9 Jun 2022 21:15:11 +0200 Subject: [PATCH 14/20] rename unittests_pl --- .azure-pipelines/gpu-benchmark.yml | 2 +- .azure-pipelines/gpu-tests.yml | 4 ++-- .azure-pipelines/hpu-tests.yml | 10 +++++----- .azure-pipelines/ipu-tests.yml | 2 +- .github/workflows/ci_test-conda.yml | 2 +- .github/workflows/ci_test-full.yml | 2 +- .github/workflows/ci_test-slow.yml | 4 ++-- dockers/tpu-tests/tpu_test_cases.jsonnet | 8 ++++---- pyproject.toml | 2 +- .../basic_examples/mnist_datamodule.py | 2 +- test/run_standalone_tests.sh | 10 +++++----- test/unittests/helpers/__init__.py | 7 ------- test/{unittests => unittests_pl}/__init__.py | 0 .../accelerators/__init__.py | 0 .../accelerators/test_accelerator_connector.py | 2 +- .../accelerators/test_accelerator_registry.py | 0 .../accelerators/test_common.py | 0 .../accelerators/test_cpu.py | 2 +- .../accelerators/test_gpu.py | 4 ++-- .../accelerators/test_hpu.py | 8 ++++---- .../accelerators/test_ipu.py | 8 ++++---- .../accelerators/test_tpu.py | 6 +++--- .../benchmarks/__init__.py | 0 .../benchmarks/generate_comparison.py | 4 ++-- .../benchmarks/test_basic_parity.py | 2 +- .../benchmarks/test_sharded_parity.py | 4 ++-- .../benchmarks/test_sync_batchnorm_parity.py | 2 +- .../callbacks/__init__.py | 0 .../callbacks/test_callback_hook_outputs.py | 2 +- .../callbacks/test_callbacks.py | 4 ++-- .../callbacks/test_device_stats_monitor.py | 4 ++-- .../callbacks/test_early_stopping.py | 8 ++++---- .../callbacks/test_finetuning_callback.py | 2 +- .../test_gradient_accumulation_scheduler.py | 2 +- .../callbacks/test_lambda_function.py | 4 ++-- .../callbacks/test_lr_monitor.py | 8 ++++---- .../callbacks/test_model_summary.py | 2 +- .../callbacks/test_prediction_writer.py | 4 ++-- .../callbacks/test_pruning.py | 4 ++-- .../callbacks/test_quantization.py | 8 ++++---- .../callbacks/test_rich_model_summary.py | 4 ++-- .../callbacks/test_rich_progress_bar.py | 4 ++-- .../callbacks/test_stochastic_weight_avg.py | 4 ++-- .../callbacks/test_timer.py | 4 ++-- .../callbacks/test_tqdm_progress_bar.py | 4 ++-- .../checkpointing/__init__.py | 0 .../test_checkpoint_callback_frequency.py | 4 ++-- .../checkpointing/test_legacy_checkpoints.py | 2 +- .../checkpointing/test_model_checkpoint.py | 6 +++--- .../checkpointing/test_torch_saving.py | 4 ++-- .../checkpointing/test_trainer_checkpoint.py | 2 +- test/{unittests => unittests_pl}/conftest.py | 2 +- .../core/__init__.py | 0 .../core/test_datamodules.py | 10 +++++----- .../core/test_lightning_module.py | 4 ++-- .../core/test_lightning_optimizer.py | 2 +- .../core/test_metric_result_integration.py | 6 +++--- .../core/test_results.py | 4 ++-- .../deprecated_api/__init__.py | 2 +- .../deprecated_api/test_remove_1-7.py | 6 +++--- .../deprecated_api/test_remove_1-8.py | 8 ++++---- .../deprecated_api/test_remove_1-9.py | 0 .../deprecated_api/test_remove_2-0.py | 4 ++-- test/unittests_pl/helpers/__init__.py | 7 +++++++ .../helpers/advanced_models.py | 4 ++-- .../helpers/boring_model.py | 0 .../helpers/dataloaders.py | 0 .../helpers/datamodules.py | 2 +- .../helpers/datasets.py | 0 .../helpers/deterministic_model.py | 0 .../helpers/imports.py | 0 .../helpers/pipelines.py | 4 ++-- .../helpers/runif.py | 0 .../helpers/simple_models.py | 0 .../helpers/test_datasets.py | 4 ++-- .../helpers/test_models.py | 8 ++++---- .../helpers/torchtext_utils.py | 2 +- .../helpers/utils.py | 4 ++-- .../lite/__init__.py | 0 .../lite/test_lite.py | 2 +- .../lite/test_parity.py | 4 ++-- .../lite/test_wrappers.py | 2 +- .../loggers/__init__.py | 0 .../loggers/test_all.py | 12 ++++++------ .../loggers/test_comet.py | 2 +- .../loggers/test_csv.py | 4 ++-- .../loggers/test_logger.py | 2 +- .../loggers/test_mlflow.py | 2 +- .../loggers/test_neptune.py | 2 +- .../loggers/test_tensorboard.py | 4 ++-- .../loggers/test_wandb.py | 4 ++-- .../loops/__init__.py | 0 .../loops/batch/__init__.py | 0 .../loops/batch/test_truncated_bptt.py | 0 .../loops/epoch/__init__.py | 0 .../loops/epoch/test_training_epoch_loop.py | 4 ++-- .../loops/optimization/__init__.py | 0 .../loops/optimization/test_closure.py | 2 +- .../loops/optimization/test_manual_loop.py | 2 +- .../loops/optimization/test_optimizer_loop.py | 2 +- .../loops/test_all.py | 4 ++-- .../loops/test_evaluation_loop.py | 4 ++-- .../loops/test_evaluation_loop_flow.py | 2 +- .../loops/test_flow_warnings.py | 2 +- .../loops/test_loop_state_dict.py | 0 .../loops/test_loops.py | 4 ++-- .../loops/test_training_loop.py | 2 +- .../loops/test_training_loop_flow_dict.py | 2 +- .../loops/test_training_loop_flow_scalar.py | 6 +++--- .../loops/test_utilities.py | 0 .../models/__init__.py | 0 .../models/conf/config.yaml | 0 .../models/conf/training/default.yaml | 0 .../models/data/__init__.py | 0 .../models/data/horovod/__init__.py | 0 .../models/data/horovod/test_train_script.py | 2 +- .../models/data/horovod/train_default_model.py | 4 ++-- .../models/test_amp.py | 6 +++--- .../models/test_cpu.py | 12 ++++++------ .../models/test_gpu.py | 14 +++++++------- .../models/test_grad_norm.py | 4 ++-- .../models/test_hooks.py | 4 ++-- .../models/test_horovod.py | 12 ++++++------ .../models/test_hparams.py | 8 ++++---- .../models/test_onnx.py | 10 +++++----- .../models/test_restore.py | 14 +++++++------- .../models/test_torchscript.py | 6 +++--- .../models/test_tpu.py | 10 +++++----- .../overrides/__init__.py | 0 .../overrides/test_base.py | 2 +- .../overrides/test_data_parallel.py | 4 ++-- .../overrides/test_distributed.py | 0 .../plugins/__init__.py | 0 .../plugins/environments/__init__.py | 0 .../environments/test_kubeflow_environment.py | 0 .../environments/test_lightning_environment.py | 0 .../environments/test_lsf_environment.py | 0 .../environments/test_slurm_environment.py | 0 .../test_torchelastic_environment.py | 2 +- .../environments/torch_elastic_deadlock.py | 2 +- .../plugins/precision/__init__.py | 0 .../plugins/precision/hpu/ops_bf16.txt | 0 .../plugins/precision/hpu/ops_fp32.txt | 0 .../plugins/precision/hpu/test_hpu.py | 4 ++-- .../precision/test_deepspeed_precision.py | 0 .../precision/test_sharded_precision.py | 2 +- .../plugins/precision/test_tpu_bf16_plugin.py | 0 .../plugins/test_amp_plugins.py | 4 ++-- .../plugins/test_checkpoint_io_plugin.py | 2 +- .../plugins/test_cluster_integration.py | 2 +- .../plugins/test_double_plugin.py | 4 ++-- .../profiler/__init__.py | 0 .../profiler/test_profiler.py | 4 ++-- .../profiler/test_xla_profiler.py | 4 ++-- .../strategies/__init__.py | 0 .../strategies/ddp_model.py | 4 ++-- .../strategies/test_bagua_strategy.py | 4 ++-- .../strategies/test_collaborative.py | 4 ++-- .../strategies/test_common.py | 10 +++++----- .../strategies/test_custom_plugin.py | 2 +- .../strategies/test_ddp.py | 8 ++++---- .../test_ddp_fully_sharded_native.py | 4 ++-- ...t_ddp_fully_sharded_with_full_state_dict.py | 4 ++-- .../strategies/test_ddp_spawn.py | 12 ++++++------ .../strategies/test_ddp_spawn_strategy.py | 4 ++-- .../strategies/test_ddp_strategy.py | 4 ++-- .../test_ddp_strategy_with_comm_hook.py | 4 ++-- .../strategies/test_deepspeed_strategy.py | 6 +++--- .../strategies/test_dp.py | 12 ++++++------ .../strategies/test_sharded_strategy.py | 4 ++-- .../strategies/test_single_device_strategy.py | 4 ++-- .../strategies/test_strategy_registry.py | 2 +- .../strategies/test_tpu_spawn.py | 8 ++++---- .../trainer/__init__.py | 0 .../trainer/connectors/__init__.py | 0 .../connectors/test_callback_connector.py | 2 +- .../connectors/test_checkpoint_connector.py | 2 +- .../trainer/connectors/test_data_connector.py | 6 +++--- .../connectors/test_signal_connector.py | 4 ++-- .../trainer/dynamic_args/__init__.py | 0 .../test_multiple_eval_dataloaders.py | 2 +- .../trainer/flags/__init__.py | 0 .../flags/test_check_val_every_n_epoch.py | 2 +- .../trainer/flags/test_env_vars.py | 0 .../trainer/flags/test_fast_dev_run.py | 2 +- .../trainer/flags/test_limit_batches.py | 2 +- .../trainer/flags/test_min_max_epochs.py | 2 +- .../trainer/flags/test_overfit_batches.py | 4 ++-- .../trainer/flags/test_val_check_interval.py | 4 ++-- .../trainer/logging_/__init__.py | 0 .../logging_/test_distributed_logging.py | 4 ++-- .../trainer/logging_/test_eval_loop_logging.py | 4 ++-- .../trainer/logging_/test_logger_connector.py | 6 +++--- .../trainer/logging_/test_loop_logging.py | 2 +- .../logging_/test_progress_bar_logging.py | 2 +- .../logging_/test_train_loop_logging.py | 4 ++-- .../trainer/optimization/__init__.py | 0 .../optimization/test_backward_calls.py | 2 +- .../optimization/test_manual_optimization.py | 4 ++-- .../optimization/test_multiple_optimizers.py | 2 +- .../trainer/optimization/test_optimizers.py | 4 ++-- .../trainer/properties/__init__.py | 0 .../trainer/properties/test_auto_gpu_select.py | 2 +- .../test_estimated_stepping_batches.py | 6 +++--- .../trainer/properties/test_get_model.py | 4 ++-- .../trainer/properties/test_log_dir.py | 2 +- .../trainer/properties/test_loggers.py | 2 +- .../trainer/test_config_validator.py | 2 +- .../trainer/test_dataloaders.py | 6 +++--- .../trainer/test_progress.py | 0 .../trainer/test_states.py | 2 +- .../trainer/test_supporters.py | 4 ++-- .../trainer/test_trainer.py | 12 ++++++------ .../trainer/test_trainer_cli.py | 2 +- .../tuner/__init__.py | 0 .../tuner/test_lr_finder.py | 8 ++++---- .../tuner/test_scale_batch_size.py | 8 ++++---- .../tuner/test_tuning.py | 2 +- .../utilities/__init__.py | 0 .../utilities/distributed.py | 0 .../utilities/test_all_gather_grad.py | 4 ++-- .../utilities/test_apply_func.py | 0 .../utilities/test_apply_func_torchtext.py | 4 ++-- .../utilities/test_argparse.py | 0 .../utilities/test_auto_restart.py | 6 +++--- .../utilities/test_cli.py | 18 +++++++++--------- .../utilities/test_cloud_io.py | 0 .../utilities/test_data.py | 4 ++-- .../test_deepspeed_collate_checkpoint.py | 4 ++-- .../utilities/test_distributed.py | 4 ++-- .../utilities/test_dtype_device_mixin.py | 4 ++-- .../utilities/test_enums.py | 0 .../utilities/test_fetching.py | 4 ++-- .../utilities/test_finite_checks.py | 0 .../utilities/test_grads.py | 0 .../utilities/test_imports.py | 0 .../utilities/test_logger.py | 0 .../utilities/test_memory.py | 2 +- .../utilities/test_meta.py | 4 ++-- .../utilities/test_migration.py | 0 .../utilities/test_model_helpers.py | 2 +- .../utilities/test_model_summary.py | 6 +++--- .../utilities/test_optimizer.py | 0 .../utilities/test_parameter_tying.py | 2 +- .../utilities/test_parsing.py | 0 .../utilities/test_rank_zero.py | 0 .../utilities/test_remote_filesystem.py | 2 +- .../utilities/test_seed.py | 0 .../utilities/test_types.py | 0 .../utilities/test_upgrade_checkpoint.py | 0 .../utilities/test_warnings.py | 0 .../utilities/test_xla_device_utils.py | 2 +- 252 files changed, 394 insertions(+), 394 deletions(-) delete mode 100644 test/unittests/helpers/__init__.py rename test/{unittests => unittests_pl}/__init__.py (100%) rename test/{unittests => unittests_pl}/accelerators/__init__.py (100%) rename test/{unittests => unittests_pl}/accelerators/test_accelerator_connector.py (99%) rename test/{unittests => unittests_pl}/accelerators/test_accelerator_registry.py (100%) rename test/{unittests => unittests_pl}/accelerators/test_common.py (100%) rename test/{unittests => unittests_pl}/accelerators/test_cpu.py (97%) rename test/{unittests => unittests_pl}/accelerators/test_gpu.py (96%) rename test/{unittests => unittests_pl}/accelerators/test_hpu.py (97%) rename test/{unittests => unittests_pl}/accelerators/test_ipu.py (98%) rename test/{unittests => unittests_pl}/accelerators/test_tpu.py (98%) rename test/{unittests => unittests_pl}/benchmarks/__init__.py (100%) rename test/{unittests => unittests_pl}/benchmarks/generate_comparison.py (93%) rename test/{unittests => unittests_pl}/benchmarks/test_basic_parity.py (98%) rename test/{unittests => unittests_pl}/benchmarks/test_sharded_parity.py (98%) rename test/{unittests => unittests_pl}/benchmarks/test_sync_batchnorm_parity.py (98%) rename test/{unittests => unittests_pl}/callbacks/__init__.py (100%) rename test/{unittests => unittests_pl}/callbacks/test_callback_hook_outputs.py (97%) rename test/{unittests => unittests_pl}/callbacks/test_callbacks.py (98%) rename test/{unittests => unittests_pl}/callbacks/test_device_stats_monitor.py (98%) rename test/{unittests => unittests_pl}/callbacks/test_early_stopping.py (98%) rename test/{unittests => unittests_pl}/callbacks/test_finetuning_callback.py (99%) rename test/{unittests => unittests_pl}/callbacks/test_gradient_accumulation_scheduler.py (98%) rename test/{unittests => unittests_pl}/callbacks/test_lambda_function.py (95%) rename test/{unittests => unittests_pl}/callbacks/test_lr_monitor.py (98%) rename test/{unittests => unittests_pl}/callbacks/test_model_summary.py (97%) rename test/{unittests => unittests_pl}/callbacks/test_prediction_writer.py (98%) rename test/{unittests => unittests_pl}/callbacks/test_pruning.py (99%) rename test/{unittests => unittests_pl}/callbacks/test_quantization.py (97%) rename test/{unittests => unittests_pl}/callbacks/test_rich_model_summary.py (96%) rename test/{unittests => unittests_pl}/callbacks/test_rich_progress_bar.py (99%) rename test/{unittests => unittests_pl}/callbacks/test_stochastic_weight_avg.py (98%) rename test/{unittests => unittests_pl}/callbacks/test_timer.py (98%) rename test/{unittests => unittests_pl}/callbacks/test_tqdm_progress_bar.py (99%) rename test/{unittests => unittests_pl}/checkpointing/__init__.py (100%) rename test/{unittests => unittests_pl}/checkpointing/test_checkpoint_callback_frequency.py (98%) rename test/{unittests => unittests_pl}/checkpointing/test_legacy_checkpoints.py (98%) rename test/{unittests => unittests_pl}/checkpointing/test_model_checkpoint.py (99%) rename test/{unittests => unittests_pl}/checkpointing/test_torch_saving.py (95%) rename test/{unittests => unittests_pl}/checkpointing/test_trainer_checkpoint.py (99%) rename test/{unittests => unittests_pl}/conftest.py (99%) rename test/{unittests => unittests_pl}/core/__init__.py (100%) rename test/{unittests => unittests_pl}/core/test_datamodules.py (98%) rename test/{unittests => unittests_pl}/core/test_lightning_module.py (99%) rename test/{unittests => unittests_pl}/core/test_lightning_optimizer.py (99%) rename test/{unittests => unittests_pl}/core/test_metric_result_integration.py (99%) rename test/{unittests => unittests_pl}/core/test_results.py (94%) rename test/{unittests => unittests_pl}/deprecated_api/__init__.py (95%) rename test/{unittests => unittests_pl}/deprecated_api/test_remove_1-7.py (97%) rename test/{unittests => unittests_pl}/deprecated_api/test_remove_1-8.py (99%) rename test/{unittests => unittests_pl}/deprecated_api/test_remove_1-9.py (100%) rename test/{unittests => unittests_pl}/deprecated_api/test_remove_2-0.py (97%) create mode 100644 test/unittests_pl/helpers/__init__.py rename test/{unittests => unittests_pl}/helpers/advanced_models.py (98%) rename test/{unittests => unittests_pl}/helpers/boring_model.py (100%) rename test/{unittests => unittests_pl}/helpers/dataloaders.py (100%) rename test/{unittests => unittests_pl}/helpers/datamodules.py (98%) rename test/{unittests => unittests_pl}/helpers/datasets.py (100%) rename test/{unittests => unittests_pl}/helpers/deterministic_model.py (100%) rename test/{unittests => unittests_pl}/helpers/imports.py (100%) rename test/{unittests => unittests_pl}/helpers/pipelines.py (96%) rename test/{unittests => unittests_pl}/helpers/runif.py (100%) rename test/{unittests => unittests_pl}/helpers/simple_models.py (100%) rename test/{unittests => unittests_pl}/helpers/test_datasets.py (90%) rename test/{unittests => unittests_pl}/helpers/test_models.py (81%) rename test/{unittests => unittests_pl}/helpers/torchtext_utils.py (95%) rename test/{unittests => unittests_pl}/helpers/utils.py (97%) rename test/{unittests => unittests_pl}/lite/__init__.py (100%) rename test/{unittests => unittests_pl}/lite/test_lite.py (99%) rename test/{unittests => unittests_pl}/lite/test_parity.py (98%) rename test/{unittests => unittests_pl}/lite/test_wrappers.py (99%) rename test/{unittests => unittests_pl}/loggers/__init__.py (100%) rename test/{unittests => unittests_pl}/loggers/test_all.py (97%) rename test/{unittests => unittests_pl}/loggers/test_comet.py (99%) rename test/{unittests => unittests_pl}/loggers/test_csv.py (96%) rename test/{unittests => unittests_pl}/loggers/test_logger.py (99%) rename test/{unittests => unittests_pl}/loggers/test_mlflow.py (99%) rename test/{unittests => unittests_pl}/loggers/test_neptune.py (99%) rename test/{unittests => unittests_pl}/loggers/test_tensorboard.py (99%) rename test/{unittests => unittests_pl}/loggers/test_wandb.py (99%) rename test/{unittests => unittests_pl}/loops/__init__.py (100%) rename test/{unittests => unittests_pl}/loops/batch/__init__.py (100%) rename test/{unittests => unittests_pl}/loops/batch/test_truncated_bptt.py (100%) rename test/{unittests => unittests_pl}/loops/epoch/__init__.py (100%) rename test/{unittests => unittests_pl}/loops/epoch/test_training_epoch_loop.py (98%) rename test/{unittests => unittests_pl}/loops/optimization/__init__.py (100%) rename test/{unittests => unittests_pl}/loops/optimization/test_closure.py (97%) rename test/{unittests => unittests_pl}/loops/optimization/test_manual_loop.py (97%) rename test/{unittests => unittests_pl}/loops/optimization/test_optimizer_loop.py (99%) rename test/{unittests => unittests_pl}/loops/test_all.py (97%) rename test/{unittests => unittests_pl}/loops/test_evaluation_loop.py (98%) rename test/{unittests => unittests_pl}/loops/test_evaluation_loop_flow.py (99%) rename test/{unittests => unittests_pl}/loops/test_flow_warnings.py (95%) rename test/{unittests => unittests_pl}/loops/test_loop_state_dict.py (100%) rename test/{unittests => unittests_pl}/loops/test_loops.py (99%) rename test/{unittests => unittests_pl}/loops/test_training_loop.py (99%) rename test/{unittests => unittests_pl}/loops/test_training_loop_flow_dict.py (98%) rename test/{unittests => unittests_pl}/loops/test_training_loop_flow_scalar.py (98%) rename test/{unittests => unittests_pl}/loops/test_utilities.py (100%) rename test/{unittests => unittests_pl}/models/__init__.py (100%) rename test/{unittests => unittests_pl}/models/conf/config.yaml (100%) rename test/{unittests => unittests_pl}/models/conf/training/default.yaml (100%) rename test/{unittests => unittests_pl}/models/data/__init__.py (100%) rename test/{unittests => unittests_pl}/models/data/horovod/__init__.py (100%) rename test/{unittests => unittests_pl}/models/data/horovod/test_train_script.py (92%) rename test/{unittests => unittests_pl}/models/data/horovod/train_default_model.py (96%) rename test/{unittests => unittests_pl}/models/test_amp.py (98%) rename test/{unittests => unittests_pl}/models/test_cpu.py (96%) rename test/{unittests => unittests_pl}/models/test_gpu.py (96%) rename test/{unittests => unittests_pl}/models/test_grad_norm.py (97%) rename test/{unittests => unittests_pl}/models/test_hooks.py (99%) rename test/{unittests => unittests_pl}/models/test_horovod.py (98%) rename test/{unittests => unittests_pl}/models/test_hparams.py (99%) rename test/{unittests => unittests_pl}/models/test_onnx.py (95%) rename test/{unittests => unittests_pl}/models/test_restore.py (98%) rename test/{unittests => unittests_pl}/models/test_torchscript.py (97%) rename test/{unittests => unittests_pl}/models/test_tpu.py (98%) rename test/{unittests => unittests_pl}/overrides/__init__.py (100%) rename test/{unittests => unittests_pl}/overrides/test_base.py (96%) rename test/{unittests => unittests_pl}/overrides/test_data_parallel.py (98%) rename test/{unittests => unittests_pl}/overrides/test_distributed.py (100%) rename test/{unittests => unittests_pl}/plugins/__init__.py (100%) rename test/{unittests => unittests_pl}/plugins/environments/__init__.py (100%) rename test/{unittests => unittests_pl}/plugins/environments/test_kubeflow_environment.py (100%) rename test/{unittests => unittests_pl}/plugins/environments/test_lightning_environment.py (100%) rename test/{unittests => unittests_pl}/plugins/environments/test_lsf_environment.py (100%) rename test/{unittests => unittests_pl}/plugins/environments/test_slurm_environment.py (100%) rename test/{unittests => unittests_pl}/plugins/environments/test_torchelastic_environment.py (98%) rename test/{unittests => unittests_pl}/plugins/environments/torch_elastic_deadlock.py (95%) rename test/{unittests => unittests_pl}/plugins/precision/__init__.py (100%) rename test/{unittests => unittests_pl}/plugins/precision/hpu/ops_bf16.txt (100%) rename test/{unittests => unittests_pl}/plugins/precision/hpu/ops_fp32.txt (100%) rename test/{unittests => unittests_pl}/plugins/precision/hpu/test_hpu.py (96%) rename test/{unittests => unittests_pl}/plugins/precision/test_deepspeed_precision.py (100%) rename test/{unittests => unittests_pl}/plugins/precision/test_sharded_precision.py (96%) rename test/{unittests => unittests_pl}/plugins/precision/test_tpu_bf16_plugin.py (100%) rename test/{unittests => unittests_pl}/plugins/test_amp_plugins.py (99%) rename test/{unittests => unittests_pl}/plugins/test_checkpoint_io_plugin.py (98%) rename test/{unittests => unittests_pl}/plugins/test_cluster_integration.py (99%) rename test/{unittests => unittests_pl}/plugins/test_double_plugin.py (97%) rename test/{unittests => unittests_pl}/profiler/__init__.py (100%) rename test/{unittests => unittests_pl}/profiler/test_profiler.py (99%) rename test/{unittests => unittests_pl}/profiler/test_xla_profiler.py (95%) rename test/{unittests => unittests_pl}/strategies/__init__.py (100%) rename test/{unittests => unittests_pl}/strategies/ddp_model.py (93%) rename test/{unittests => unittests_pl}/strategies/test_bagua_strategy.py (97%) rename test/{unittests => unittests_pl}/strategies/test_collaborative.py (99%) rename test/{unittests => unittests_pl}/strategies/test_common.py (90%) rename test/{unittests => unittests_pl}/strategies/test_custom_plugin.py (97%) rename test/{unittests => unittests_pl}/strategies/test_ddp.py (97%) rename test/{unittests => unittests_pl}/strategies/test_ddp_fully_sharded_native.py (98%) rename test/{unittests => unittests_pl}/strategies/test_ddp_fully_sharded_with_full_state_dict.py (98%) rename test/{unittests => unittests_pl}/strategies/test_ddp_spawn.py (88%) rename test/{unittests => unittests_pl}/strategies/test_ddp_spawn_strategy.py (98%) rename test/{unittests => unittests_pl}/strategies/test_ddp_strategy.py (98%) rename test/{unittests => unittests_pl}/strategies/test_ddp_strategy_with_comm_hook.py (98%) rename test/{unittests => unittests_pl}/strategies/test_deepspeed_strategy.py (99%) rename test/{unittests => unittests_pl}/strategies/test_dp.py (95%) rename test/{unittests => unittests_pl}/strategies/test_sharded_strategy.py (99%) rename test/{unittests => unittests_pl}/strategies/test_single_device_strategy.py (96%) rename test/{unittests => unittests_pl}/strategies/test_strategy_registry.py (99%) rename test/{unittests => unittests_pl}/strategies/test_tpu_spawn.py (93%) rename test/{unittests => unittests_pl}/trainer/__init__.py (100%) rename test/{unittests => unittests_pl}/trainer/connectors/__init__.py (100%) rename test/{unittests => unittests_pl}/trainer/connectors/test_callback_connector.py (99%) rename test/{unittests => unittests_pl}/trainer/connectors/test_checkpoint_connector.py (99%) rename test/{unittests => unittests_pl}/trainer/connectors/test_data_connector.py (99%) rename test/{unittests => unittests_pl}/trainer/connectors/test_signal_connector.py (98%) rename test/{unittests => unittests_pl}/trainer/dynamic_args/__init__.py (100%) rename test/{unittests => unittests_pl}/trainer/dynamic_args/test_multiple_eval_dataloaders.py (98%) rename test/{unittests => unittests_pl}/trainer/flags/__init__.py (100%) rename test/{unittests => unittests_pl}/trainer/flags/test_check_val_every_n_epoch.py (97%) rename test/{unittests => unittests_pl}/trainer/flags/test_env_vars.py (100%) rename test/{unittests => unittests_pl}/trainer/flags/test_fast_dev_run.py (99%) rename test/{unittests => unittests_pl}/trainer/flags/test_limit_batches.py (98%) rename test/{unittests => unittests_pl}/trainer/flags/test_min_max_epochs.py (96%) rename test/{unittests => unittests_pl}/trainer/flags/test_overfit_batches.py (97%) rename test/{unittests => unittests_pl}/trainer/flags/test_val_check_interval.py (97%) rename test/{unittests => unittests_pl}/trainer/logging_/__init__.py (100%) rename test/{unittests => unittests_pl}/trainer/logging_/test_distributed_logging.py (98%) rename test/{unittests => unittests_pl}/trainer/logging_/test_eval_loop_logging.py (99%) rename test/{unittests => unittests_pl}/trainer/logging_/test_logger_connector.py (99%) rename test/{unittests => unittests_pl}/trainer/logging_/test_loop_logging.py (98%) rename test/{unittests => unittests_pl}/trainer/logging_/test_progress_bar_logging.py (93%) rename test/{unittests => unittests_pl}/trainer/logging_/test_train_loop_logging.py (99%) rename test/{unittests => unittests_pl}/trainer/optimization/__init__.py (100%) rename test/{unittests => unittests_pl}/trainer/optimization/test_backward_calls.py (97%) rename test/{unittests => unittests_pl}/trainer/optimization/test_manual_optimization.py (99%) rename test/{unittests => unittests_pl}/trainer/optimization/test_multiple_optimizers.py (99%) rename test/{unittests => unittests_pl}/trainer/optimization/test_optimizers.py (99%) rename test/{unittests => unittests_pl}/trainer/properties/__init__.py (100%) rename test/{unittests => unittests_pl}/trainer/properties/test_auto_gpu_select.py (98%) rename test/{unittests => unittests_pl}/trainer/properties/test_estimated_stepping_batches.py (97%) rename test/{unittests => unittests_pl}/trainer/properties/test_get_model.py (95%) rename test/{unittests => unittests_pl}/trainer/properties/test_log_dir.py (98%) rename test/{unittests => unittests_pl}/trainer/properties/test_loggers.py (98%) rename test/{unittests => unittests_pl}/trainer/test_config_validator.py (99%) rename test/{unittests => unittests_pl}/trainer/test_dataloaders.py (99%) rename test/{unittests => unittests_pl}/trainer/test_progress.py (100%) rename test/{unittests => unittests_pl}/trainer/test_states.py (98%) rename test/{unittests => unittests_pl}/trainer/test_supporters.py (99%) rename test/{unittests => unittests_pl}/trainer/test_trainer.py (99%) rename test/{unittests => unittests_pl}/trainer/test_trainer_cli.py (99%) rename test/{unittests => unittests_pl}/tuner/__init__.py (100%) rename test/{unittests => unittests_pl}/tuner/test_lr_finder.py (98%) rename test/{unittests => unittests_pl}/tuner/test_scale_batch_size.py (98%) rename test/{unittests => unittests_pl}/tuner/test_tuning.py (95%) rename test/{unittests => unittests_pl}/utilities/__init__.py (100%) rename test/{unittests => unittests_pl}/utilities/distributed.py (100%) rename test/{unittests => unittests_pl}/utilities/test_all_gather_grad.py (97%) rename test/{unittests => unittests_pl}/utilities/test_apply_func.py (100%) rename test/{unittests => unittests_pl}/utilities/test_apply_func_torchtext.py (93%) rename test/{unittests => unittests_pl}/utilities/test_argparse.py (100%) rename test/{unittests => unittests_pl}/utilities/test_auto_restart.py (99%) rename test/{unittests => unittests_pl}/utilities/test_cli.py (98%) rename test/{unittests => unittests_pl}/utilities/test_cloud_io.py (100%) rename test/{unittests => unittests_pl}/utilities/test_data.py (98%) rename test/{unittests => unittests_pl}/utilities/test_deepspeed_collate_checkpoint.py (95%) rename test/{unittests => unittests_pl}/utilities/test_distributed.py (94%) rename test/{unittests => unittests_pl}/utilities/test_dtype_device_mixin.py (97%) rename test/{unittests => unittests_pl}/utilities/test_enums.py (100%) rename test/{unittests => unittests_pl}/utilities/test_fetching.py (99%) rename test/{unittests => unittests_pl}/utilities/test_finite_checks.py (100%) rename test/{unittests => unittests_pl}/utilities/test_grads.py (100%) rename test/{unittests => unittests_pl}/utilities/test_imports.py (100%) rename test/{unittests => unittests_pl}/utilities/test_logger.py (100%) rename test/{unittests => unittests_pl}/utilities/test_memory.py (97%) rename test/{unittests => unittests_pl}/utilities/test_meta.py (96%) rename test/{unittests => unittests_pl}/utilities/test_migration.py (100%) rename test/{unittests => unittests_pl}/utilities/test_model_helpers.py (97%) rename test/{unittests => unittests_pl}/utilities/test_model_summary.py (98%) rename test/{unittests => unittests_pl}/utilities/test_optimizer.py (100%) rename test/{unittests => unittests_pl}/utilities/test_parameter_tying.py (98%) rename test/{unittests => unittests_pl}/utilities/test_parsing.py (100%) rename test/{unittests => unittests_pl}/utilities/test_rank_zero.py (100%) rename test/{unittests => unittests_pl}/utilities/test_remote_filesystem.py (98%) rename test/{unittests => unittests_pl}/utilities/test_seed.py (100%) rename test/{unittests => unittests_pl}/utilities/test_types.py (100%) rename test/{unittests => unittests_pl}/utilities/test_upgrade_checkpoint.py (100%) rename test/{unittests => unittests_pl}/utilities/test_warnings.py (100%) rename test/{unittests => unittests_pl}/utilities/test_xla_device_utils.py (97%) diff --git a/.azure-pipelines/gpu-benchmark.yml b/.azure-pipelines/gpu-benchmark.yml index f466defe31958..bc37e7b300232 100644 --- a/.azure-pipelines/gpu-benchmark.yml +++ b/.azure-pipelines/gpu-benchmark.yml @@ -35,7 +35,7 @@ jobs: clean: all steps: - - bash: python -m pytest unittests/benchmarks -v --durations=0 + - bash: python -m pytest unittests_pl/benchmarks -v --durations=0 env: PL_RUNNING_BENCHMARKS: 1 workingDirectory: test diff --git a/.azure-pipelines/gpu-tests.yml b/.azure-pipelines/gpu-tests.yml index 27c5fb9ddfba4..8a0214a962d2c 100644 --- a/.azure-pipelines/gpu-tests.yml +++ b/.azure-pipelines/gpu-tests.yml @@ -76,7 +76,7 @@ jobs: workingDirectory: src displayName: 'Testing: doctests' - - bash: python -m coverage run --source pytorch_lightning -m pytest unittests --ignore unittests/benchmarks -v --junitxml=$(Build.StagingDirectory)/test-results.xml --durations=50 + - bash: python -m coverage run --source pytorch_lightning -m pytest unittests_pl --ignore unittests_pl/benchmarks -v --junitxml=$(Build.StagingDirectory)/test-results.xml --durations=50 displayName: 'Testing: unittests' workingDirectory: test @@ -124,6 +124,6 @@ jobs: PL_USE_MOCKED_MNIST: "1" displayName: 'Testing: examples' - - bash: python -m pytest unittests/benchmarks -v --maxfail=2 --durations=0 + - bash: python -m pytest unittests_pl/benchmarks -v --maxfail=2 --durations=0 workingDirectory: test displayName: 'Testing: benchmarks' diff --git a/.azure-pipelines/hpu-tests.yml b/.azure-pipelines/hpu-tests.yml index c1e565632b1d5..91b717d45820a 100644 --- a/.azure-pipelines/hpu-tests.yml +++ b/.azure-pipelines/hpu-tests.yml @@ -37,19 +37,19 @@ jobs: displayName: 'Install dependencies' - bash: | - python -m pytest -sv unittests/accelerators/test_hpu.py --forked --junitxml=hpu1_test-results.xml + python -m pytest -sv unittests_pl/accelerators/test_hpu.py --forked --junitxml=hpu1_test-results.xml workingDirectory: test displayName: 'Single card HPU test' - bash: | - python -m pytest -sv unittests/accelerators/test_hpu.py --forked --hpus 8 --junitxml=hpu8_test-results.xml + python -m pytest -sv unittests_pl/accelerators/test_hpu.py --forked --hpus 8 --junitxml=hpu8_test-results.xml workingDirectory: test displayName: 'Multi card(8) HPU test' - bash: | - python -m pytest -sv unittests/plugins/precision/hpu/test_hpu.py --hmp-bf16 \ - 'unittests/plugins/precision/hpu/ops_bf16.txt' --hmp-fp32 \ - 'unittests/plugins/precision/hpu/ops_fp32.txt' --forked \ + python -m pytest -sv unittests_pl/plugins/precision/hpu/test_hpu.py --hmp-bf16 \ + 'unittests_pl/plugins/precision/hpu/ops_bf16.txt' --hmp-fp32 \ + 'unittests_pl/plugins/precision/hpu/ops_fp32.txt' --forked \ --junitxml=hpu1_precision_test-results.xml workingDirectory: test displayName: 'HPU precision test' diff --git a/.azure-pipelines/ipu-tests.yml b/.azure-pipelines/ipu-tests.yml index 01ffd24b47fa9..f74199f573eeb 100644 --- a/.azure-pipelines/ipu-tests.yml +++ b/.azure-pipelines/ipu-tests.yml @@ -83,7 +83,7 @@ jobs: source ${{ variables.poplar_sdk }}/poplar-ubuntu*/enable.sh source ${{ variables.poplar_sdk }}/popart-ubuntu*/enable.sh cd test - python -m coverage run --source pytorch_lightning -m pytest unittests -vv --durations=50 + python -m coverage run --source pytorch_lightning -m pytest unittests_pl -vv --durations=50 env: MKL_THREADING_LAYER: "GNU" POPTORCH_WAIT_FOR_IPU: 1 diff --git a/.github/workflows/ci_test-conda.yml b/.github/workflows/ci_test-conda.yml index ed989d6833354..712368620107d 100644 --- a/.github/workflows/ci_test-conda.yml +++ b/.github/workflows/ci_test-conda.yml @@ -69,7 +69,7 @@ jobs: - name: UnitTests working-directory: ./test - run: coverage run --source pytorch_lightning -m pytest unittests -v --timeout 150 --durations=50 --junitxml=results-${{ runner.os }}-torch${{ matrix.pytorch-version }}.xml + run: coverage run --source pytorch_lightning -m pytest unittests_pl -v --timeout 150 --durations=50 --junitxml=results-${{ runner.os }}-torch${{ matrix.pytorch-version }}.xml - name: Upload pytest results uses: actions/upload-artifact@v2 diff --git a/.github/workflows/ci_test-full.yml b/.github/workflows/ci_test-full.yml index 8fcbfb7f3a240..03901381cc7c8 100644 --- a/.github/workflows/ci_test-full.yml +++ b/.github/workflows/ci_test-full.yml @@ -129,7 +129,7 @@ jobs: - name: UnitTests working-directory: ./test # NOTE: do not include coverage report here, see: https://github.com/nedbat/coveragepy/issues/1003 - run: coverage run --source pytorch_lightning -m pytest unittests -v --durations=50 --junitxml=results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}.xml + run: coverage run --source pytorch_lightning -m pytest unittests_pl -v --durations=50 --junitxml=results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}.xml - name: Prepare Examples run: | diff --git a/.github/workflows/ci_test-slow.yml b/.github/workflows/ci_test-slow.yml index 345acd92268f3..7a1b7cefff68e 100644 --- a/.github/workflows/ci_test-slow.yml +++ b/.github/workflows/ci_test-slow.yml @@ -54,9 +54,9 @@ jobs: pip list shell: bash - - name: Tests + - name: UnitTests working-directory: ./test - run: coverage run --source pytorch_lightning -m pytest unittests -v --junitxml=results-${{ runner.os }}-py${{ matrix.python-version }}.xml + run: coverage run --source pytorch_lightning -m pytest unittests_pl -v --junitxml=results-${{ runner.os }}-py${{ matrix.python-version }}.xml env: PL_RUN_SLOW_TESTS: 1 diff --git a/dockers/tpu-tests/tpu_test_cases.jsonnet b/dockers/tpu-tests/tpu_test_cases.jsonnet index 40ea27dd64de3..e2a62bfb6c3ec 100644 --- a/dockers/tpu-tests/tpu_test_cases.jsonnet +++ b/dockers/tpu-tests/tpu_test_cases.jsonnet @@ -35,10 +35,10 @@ local tputests = base.BaseTest { # TODO (@kaushikb11): Add device stats tests here cd test coverage run --source=pytorch_lightning -m pytest -v --capture=no \ - unittests/strategies/test_tpu_spawn.py \ - unittests/profiler/test_xla_profiler.py \ - unittests/accelerators/test_tpu.py \ - unittests/models/test_tpu.py + unittests_pl/strategies/test_tpu_spawn.py \ + unittests_pl/profiler/test_xla_profiler.py \ + unittests_pl/accelerators/test_tpu.py \ + unittests_pl/models/test_tpu.py test_exit_code=$? echo "\n||| END PYTEST LOGS |||\n" coverage xml diff --git a/pyproject.toml b/pyproject.toml index a5c9804a52c06..bbb2977903d86 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ known_first_party = [ "pl_examples", "pytorch_lightning", "legacy", - "unittests", + "unittests_pl", ] profile = "black" line_length = 120 diff --git a/src/pl_examples/basic_examples/mnist_datamodule.py b/src/pl_examples/basic_examples/mnist_datamodule.py index d47be33dd98d9..0e7f28d9fe694 100644 --- a/src/pl_examples/basic_examples/mnist_datamodule.py +++ b/src/pl_examples/basic_examples/mnist_datamodule.py @@ -33,7 +33,7 @@ class _MNIST(Dataset): - """Carbon copy of ``unittests.helpers.datasets.MNIST``. + """Carbon copy of ``unittests_pl.helpers.datasets.MNIST``. We cannot import the tests as they are not distributed with the package. See https://github.com/PyTorchLightning/pytorch-lightning/pull/7614#discussion_r671183652 for more context. diff --git a/test/run_standalone_tests.sh b/test/run_standalone_tests.sh index f59a219456ee0..e0eb8507035c9 100644 --- a/test/run_standalone_tests.sh +++ b/test/run_standalone_tests.sh @@ -20,7 +20,7 @@ export PL_RUN_STANDALONE_TESTS=1 defaults='-m coverage run --source pytorch_lightning --append -m pytest --capture=no' # find tests marked as `@RunIf(standalone=True)`. done manually instead of with pytest because it is faster -grep_output=$(grep --recursive --word-regexp 'unittests' --regexp 'standalone=True' --include '*.py' --exclude 'unittests/conftest.py') +grep_output=$(grep --recursive --word-regexp 'unittests_pl' --regexp 'standalone=True' --include '*.py' --exclude 'unittests_pl/conftest.py') # file paths, remove duplicates files=$(echo "$grep_output" | cut -f1 -d: | sort | uniq) @@ -35,7 +35,7 @@ fi parametrizations_arr=(${parametrizations//"test/"/""}) # tests to skip - space separated -blocklist='unittests/profiler/test_profiler.py::test_pytorch_profiler_nested_emit_nvtx unittests/utilities/test_warnings.py' +blocklist='unittests_pl/profiler/test_profiler.py::test_pytorch_profiler_nested_emit_nvtx unittests_pl/utilities/test_warnings.py' report='' for i in "${!parametrizations_arr[@]}"; do @@ -55,13 +55,13 @@ for i in "${!parametrizations_arr[@]}"; do done if nvcc --version; then - nvprof --profile-from-start off -o trace_name.prof -- python ${defaults} unittests/profiler/test_profiler.py::test_pytorch_profiler_nested_emit_nvtx + nvprof --profile-from-start off -o trace_name.prof -- python ${defaults} unittests_pl/profiler/test_profiler.py::test_pytorch_profiler_nested_emit_nvtx fi # needs to run outside of `pytest` -python unittests/utilities/test_warnings.py +python unittests_pl/utilities/test_warnings.py if [ $? -eq 0 ]; then - report+="Ran\tunittests/utilities/test_warnings.py\n" + report+="Ran\tunittests_pl/utilities/test_warnings.py\n" fi # TODO: enable when CI uses torch>=1.9 diff --git a/test/unittests/helpers/__init__.py b/test/unittests/helpers/__init__.py deleted file mode 100644 index aec39b5bc6e24..0000000000000 --- a/test/unittests/helpers/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -from unittests.helpers.boring_model import ( # noqa: F401 - BoringDataModule, - BoringModel, - ManualOptimBoringModel, - RandomDataset, -) -from unittests.helpers.datasets import TrialMNIST # noqa: F401 diff --git a/test/unittests/__init__.py b/test/unittests_pl/__init__.py similarity index 100% rename from test/unittests/__init__.py rename to test/unittests_pl/__init__.py diff --git a/test/unittests/accelerators/__init__.py b/test/unittests_pl/accelerators/__init__.py similarity index 100% rename from test/unittests/accelerators/__init__.py rename to test/unittests_pl/accelerators/__init__.py diff --git a/test/unittests/accelerators/test_accelerator_connector.py b/test/unittests_pl/accelerators/test_accelerator_connector.py similarity index 99% rename from test/unittests/accelerators/test_accelerator_connector.py rename to test/unittests_pl/accelerators/test_accelerator_connector.py index 84b6164311a93..972d7a0d3bc58 100644 --- a/test/unittests/accelerators/test_accelerator_connector.py +++ b/test/unittests_pl/accelerators/test_accelerator_connector.py @@ -45,7 +45,7 @@ SingleDeviceStrategy, ) from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.runif import RunIf def test_accelerator_choice_cpu(tmpdir): diff --git a/test/unittests/accelerators/test_accelerator_registry.py b/test/unittests_pl/accelerators/test_accelerator_registry.py similarity index 100% rename from test/unittests/accelerators/test_accelerator_registry.py rename to test/unittests_pl/accelerators/test_accelerator_registry.py diff --git a/test/unittests/accelerators/test_common.py b/test/unittests_pl/accelerators/test_common.py similarity index 100% rename from test/unittests/accelerators/test_common.py rename to test/unittests_pl/accelerators/test_common.py diff --git a/test/unittests/accelerators/test_cpu.py b/test/unittests_pl/accelerators/test_cpu.py similarity index 97% rename from test/unittests/accelerators/test_cpu.py rename to test/unittests_pl/accelerators/test_cpu.py index a63f0bfb6893a..b83b719316579 100644 --- a/test/unittests/accelerators/test_cpu.py +++ b/test/unittests_pl/accelerators/test_cpu.py @@ -12,7 +12,7 @@ from pytorch_lightning.plugins.precision.precision_plugin import PrecisionPlugin from pytorch_lightning.strategies import SingleDeviceStrategy from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers.boring_model import BoringModel +from unittests_pl.helpers.boring_model import BoringModel def test_restore_checkpoint_after_pre_setup_default(): diff --git a/test/unittests/accelerators/test_gpu.py b/test/unittests_pl/accelerators/test_gpu.py similarity index 96% rename from test/unittests/accelerators/test_gpu.py rename to test/unittests_pl/accelerators/test_gpu.py index e14a1f0771db6..c65dd330f53c3 100644 --- a/test/unittests/accelerators/test_gpu.py +++ b/test/unittests_pl/accelerators/test_gpu.py @@ -19,8 +19,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.accelerators import GPUAccelerator from pytorch_lightning.accelerators.gpu import get_nvidia_gpu_stats -from unittests.helpers import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.runif import RunIf @RunIf(min_cuda_gpus=1) diff --git a/test/unittests/accelerators/test_hpu.py b/test/unittests_pl/accelerators/test_hpu.py similarity index 97% rename from test/unittests/accelerators/test_hpu.py rename to test/unittests_pl/accelerators/test_hpu.py index 6b564685c83b5..081400cf24dc1 100644 --- a/test/unittests/accelerators/test_hpu.py +++ b/test/unittests_pl/accelerators/test_hpu.py @@ -22,10 +22,10 @@ from pytorch_lightning.strategies.single_hpu import SingleHPUStrategy from pytorch_lightning.utilities import _HPU_AVAILABLE from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers.boring_model import BoringModel -from unittests.helpers.datamodules import ClassifDataModule -from unittests.helpers.runif import RunIf -from unittests.helpers.simple_models import ClassificationModel +from unittests_pl.helpers.boring_model import BoringModel +from unittests_pl.helpers.datamodules import ClassifDataModule +from unittests_pl.helpers.runif import RunIf +from unittests_pl.helpers.simple_models import ClassificationModel @RunIf(hpu=True) diff --git a/test/unittests/accelerators/test_ipu.py b/test/unittests_pl/accelerators/test_ipu.py similarity index 98% rename from test/unittests/accelerators/test_ipu.py rename to test/unittests_pl/accelerators/test_ipu.py index ec234c1c66aa2..17644bbdd3a66 100644 --- a/test/unittests/accelerators/test_ipu.py +++ b/test/unittests_pl/accelerators/test_ipu.py @@ -29,10 +29,10 @@ from pytorch_lightning.trainer.supporters import CombinedLoader from pytorch_lightning.utilities import _IPU_AVAILABLE from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers.boring_model import BoringModel -from unittests.helpers.datamodules import ClassifDataModule -from unittests.helpers.runif import RunIf -from unittests.helpers.simple_models import ClassificationModel +from unittests_pl.helpers.boring_model import BoringModel +from unittests_pl.helpers.datamodules import ClassifDataModule +from unittests_pl.helpers.runif import RunIf +from unittests_pl.helpers.simple_models import ClassificationModel if _IPU_AVAILABLE: import poptorch diff --git a/test/unittests/accelerators/test_tpu.py b/test/unittests_pl/accelerators/test_tpu.py similarity index 98% rename from test/unittests/accelerators/test_tpu.py rename to test/unittests_pl/accelerators/test_tpu.py index f4d8cac0634ca..3aec029061b68 100644 --- a/test/unittests/accelerators/test_tpu.py +++ b/test/unittests_pl/accelerators/test_tpu.py @@ -26,9 +26,9 @@ from pytorch_lightning.plugins import PrecisionPlugin, TPUPrecisionPlugin, XLACheckpointIO from pytorch_lightning.strategies import DDPStrategy, TPUSpawnStrategy from pytorch_lightning.utilities import find_shared_parameters -from unittests.helpers.boring_model import BoringModel, RandomDataset -from unittests.helpers.runif import RunIf -from unittests.helpers.utils import pl_multi_process_test +from unittests_pl.helpers.boring_model import BoringModel, RandomDataset +from unittests_pl.helpers.runif import RunIf +from unittests_pl.helpers.utils import pl_multi_process_test class WeightSharingModule(BoringModel): diff --git a/test/unittests/benchmarks/__init__.py b/test/unittests_pl/benchmarks/__init__.py similarity index 100% rename from test/unittests/benchmarks/__init__.py rename to test/unittests_pl/benchmarks/__init__.py diff --git a/test/unittests/benchmarks/generate_comparison.py b/test/unittests_pl/benchmarks/generate_comparison.py similarity index 93% rename from test/unittests/benchmarks/generate_comparison.py rename to test/unittests_pl/benchmarks/generate_comparison.py index 9c413b76e3f67..9545e906cd001 100644 --- a/test/unittests/benchmarks/generate_comparison.py +++ b/test/unittests_pl/benchmarks/generate_comparison.py @@ -13,8 +13,8 @@ # limitations under the License. import os -from unittests.benchmarks.test_basic_parity import measure_loops -from unittests.helpers.advanced_models import ParityModuleMNIST, ParityModuleRNN +from unittests_pl.benchmarks.test_basic_parity import measure_loops +from unittests_pl.helpers.advanced_models import ParityModuleMNIST, ParityModuleRNN NUM_EPOCHS = 20 NUM_RUNS = 50 diff --git a/test/unittests/benchmarks/test_basic_parity.py b/test/unittests_pl/benchmarks/test_basic_parity.py similarity index 98% rename from test/unittests/benchmarks/test_basic_parity.py rename to test/unittests_pl/benchmarks/test_basic_parity.py index 932f6d61c095a..ab096bdc56ab5 100644 --- a/test/unittests/benchmarks/test_basic_parity.py +++ b/test/unittests_pl/benchmarks/test_basic_parity.py @@ -21,7 +21,7 @@ from tqdm import tqdm from pytorch_lightning import LightningModule, seed_everything, Trainer -from unittests.helpers.advanced_models import ParityModuleCIFAR, ParityModuleMNIST, ParityModuleRNN +from unittests_pl.helpers.advanced_models import ParityModuleCIFAR, ParityModuleMNIST, ParityModuleRNN _EXTEND_BENCHMARKS = os.getenv("PL_RUNNING_BENCHMARKS", "0") == "1" _SHORT_BENCHMARKS = not _EXTEND_BENCHMARKS diff --git a/test/unittests/benchmarks/test_sharded_parity.py b/test/unittests_pl/benchmarks/test_sharded_parity.py similarity index 98% rename from test/unittests/benchmarks/test_sharded_parity.py rename to test/unittests_pl/benchmarks/test_sharded_parity.py index 01ff58a282e1c..3d27dd4d710e8 100644 --- a/test/unittests/benchmarks/test_sharded_parity.py +++ b/test/unittests_pl/benchmarks/test_sharded_parity.py @@ -20,8 +20,8 @@ from pytorch_lightning import seed_everything, Trainer from pytorch_lightning.strategies import DDPSpawnShardedStrategy -from unittests.helpers.boring_model import BoringModel, RandomDataset -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringModel, RandomDataset +from unittests_pl.helpers.runif import RunIf class SeedTrainLoaderModel(BoringModel): diff --git a/test/unittests/benchmarks/test_sync_batchnorm_parity.py b/test/unittests_pl/benchmarks/test_sync_batchnorm_parity.py similarity index 98% rename from test/unittests/benchmarks/test_sync_batchnorm_parity.py rename to test/unittests_pl/benchmarks/test_sync_batchnorm_parity.py index 8eb447ff8bd14..dcb3bafb1edb6 100644 --- a/test/unittests/benchmarks/test_sync_batchnorm_parity.py +++ b/test/unittests_pl/benchmarks/test_sync_batchnorm_parity.py @@ -17,7 +17,7 @@ from torch.utils.data import DataLoader, DistributedSampler from pytorch_lightning import LightningModule, seed_everything, Trainer -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.runif import RunIf class SyncBNModule(LightningModule): diff --git a/test/unittests/callbacks/__init__.py b/test/unittests_pl/callbacks/__init__.py similarity index 100% rename from test/unittests/callbacks/__init__.py rename to test/unittests_pl/callbacks/__init__.py diff --git a/test/unittests/callbacks/test_callback_hook_outputs.py b/test/unittests_pl/callbacks/test_callback_hook_outputs.py similarity index 97% rename from test/unittests/callbacks/test_callback_hook_outputs.py rename to test/unittests_pl/callbacks/test_callback_hook_outputs.py index cc91dcece57ea..00c4c4ff29b86 100644 --- a/test/unittests/callbacks/test_callback_hook_outputs.py +++ b/test/unittests_pl/callbacks/test_callback_hook_outputs.py @@ -14,7 +14,7 @@ import pytest from pytorch_lightning import Callback, Trainer -from unittests.helpers.boring_model import BoringModel +from unittests_pl.helpers.boring_model import BoringModel @pytest.mark.parametrize("single_cb", [False, True]) diff --git a/test/unittests/callbacks/test_callbacks.py b/test/unittests_pl/callbacks/test_callbacks.py similarity index 98% rename from test/unittests/callbacks/test_callbacks.py rename to test/unittests_pl/callbacks/test_callbacks.py index 068c3e6540b1c..452dd3680d985 100644 --- a/test/unittests/callbacks/test_callbacks.py +++ b/test/unittests_pl/callbacks/test_callbacks.py @@ -19,8 +19,8 @@ from pytorch_lightning import Callback, Trainer from pytorch_lightning.callbacks import ModelCheckpoint -from unittests.helpers import BoringModel -from unittests.helpers.utils import no_warning_call +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.utils import no_warning_call def test_callbacks_configured_in_model(tmpdir): diff --git a/test/unittests/callbacks/test_device_stats_monitor.py b/test/unittests_pl/callbacks/test_device_stats_monitor.py similarity index 98% rename from test/unittests/callbacks/test_device_stats_monitor.py rename to test/unittests_pl/callbacks/test_device_stats_monitor.py index 3d22795c50255..1d205e7aabbf9 100644 --- a/test/unittests/callbacks/test_device_stats_monitor.py +++ b/test/unittests_pl/callbacks/test_device_stats_monitor.py @@ -25,8 +25,8 @@ from pytorch_lightning.loggers import CSVLogger from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.rank_zero import rank_zero_only -from unittests.helpers import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.runif import RunIf @RunIf(min_cuda_gpus=1) diff --git a/test/unittests/callbacks/test_early_stopping.py b/test/unittests_pl/callbacks/test_early_stopping.py similarity index 98% rename from test/unittests/callbacks/test_early_stopping.py rename to test/unittests_pl/callbacks/test_early_stopping.py index 49cfd7988bab1..ccc06bc56573c 100644 --- a/test/unittests/callbacks/test_early_stopping.py +++ b/test/unittests_pl/callbacks/test_early_stopping.py @@ -26,10 +26,10 @@ from pytorch_lightning import seed_everything, Trainer from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers import BoringModel -from unittests.helpers.datamodules import ClassifDataModule -from unittests.helpers.runif import RunIf -from unittests.helpers.simple_models import ClassificationModel +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.datamodules import ClassifDataModule +from unittests_pl.helpers.runif import RunIf +from unittests_pl.helpers.simple_models import ClassificationModel _logger = logging.getLogger(__name__) diff --git a/test/unittests/callbacks/test_finetuning_callback.py b/test/unittests_pl/callbacks/test_finetuning_callback.py similarity index 99% rename from test/unittests/callbacks/test_finetuning_callback.py rename to test/unittests_pl/callbacks/test_finetuning_callback.py index 7f6847b83085a..59edff9847999 100644 --- a/test/unittests/callbacks/test_finetuning_callback.py +++ b/test/unittests_pl/callbacks/test_finetuning_callback.py @@ -22,7 +22,7 @@ from pytorch_lightning import LightningModule, seed_everything, Trainer from pytorch_lightning.callbacks import BackboneFinetuning, BaseFinetuning, ModelCheckpoint from pytorch_lightning.utilities.imports import _TORCH_GREATER_EQUAL_1_11 -from unittests.helpers import BoringModel, RandomDataset +from unittests_pl.helpers import BoringModel, RandomDataset class TestBackboneFinetuningCallback(BackboneFinetuning): diff --git a/test/unittests/callbacks/test_gradient_accumulation_scheduler.py b/test/unittests_pl/callbacks/test_gradient_accumulation_scheduler.py similarity index 98% rename from test/unittests/callbacks/test_gradient_accumulation_scheduler.py rename to test/unittests_pl/callbacks/test_gradient_accumulation_scheduler.py index 1bda299a69adf..658120e900a27 100644 --- a/test/unittests/callbacks/test_gradient_accumulation_scheduler.py +++ b/test/unittests_pl/callbacks/test_gradient_accumulation_scheduler.py @@ -19,7 +19,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import GradientAccumulationScheduler from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers import BoringModel +from unittests_pl.helpers import BoringModel @pytest.mark.parametrize("accumulate_grad_batches", (1, 2, 3)) diff --git a/test/unittests/callbacks/test_lambda_function.py b/test/unittests_pl/callbacks/test_lambda_function.py similarity index 95% rename from test/unittests/callbacks/test_lambda_function.py rename to test/unittests_pl/callbacks/test_lambda_function.py index 465964e4dcb97..169a93734a560 100644 --- a/test/unittests/callbacks/test_lambda_function.py +++ b/test/unittests_pl/callbacks/test_lambda_function.py @@ -17,8 +17,8 @@ from pytorch_lightning import seed_everything, Trainer from pytorch_lightning.callbacks import Callback, LambdaCallback -from unittests.helpers.boring_model import BoringModel -from unittests.models.test_hooks import get_members +from unittests_pl.helpers.boring_model import BoringModel +from unittests_pl.models.test_hooks import get_members def test_lambda_call(tmpdir): diff --git a/test/unittests/callbacks/test_lr_monitor.py b/test/unittests_pl/callbacks/test_lr_monitor.py similarity index 98% rename from test/unittests/callbacks/test_lr_monitor.py rename to test/unittests_pl/callbacks/test_lr_monitor.py index 5bc0791bee021..bacf47d32a6e3 100644 --- a/test/unittests/callbacks/test_lr_monitor.py +++ b/test/unittests_pl/callbacks/test_lr_monitor.py @@ -15,15 +15,15 @@ import torch from torch import optim -import unittests.helpers.utils as tutils +import unittests_pl.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.callbacks import LearningRateMonitor from pytorch_lightning.callbacks.callback import Callback from pytorch_lightning.callbacks.finetuning import BackboneFinetuning from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers import BoringModel -from unittests.helpers.datamodules import ClassifDataModule -from unittests.helpers.simple_models import ClassificationModel +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.datamodules import ClassifDataModule +from unittests_pl.helpers.simple_models import ClassificationModel def test_lr_monitor_single_lr(tmpdir): diff --git a/test/unittests/callbacks/test_model_summary.py b/test/unittests_pl/callbacks/test_model_summary.py similarity index 97% rename from test/unittests/callbacks/test_model_summary.py rename to test/unittests_pl/callbacks/test_model_summary.py index 9677e0e842f5e..45248a877983e 100644 --- a/test/unittests/callbacks/test_model_summary.py +++ b/test/unittests_pl/callbacks/test_model_summary.py @@ -15,7 +15,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import ModelSummary -from unittests.helpers.boring_model import BoringModel +from unittests_pl.helpers.boring_model import BoringModel def test_model_summary_callback_present_trainer(): diff --git a/test/unittests/callbacks/test_prediction_writer.py b/test/unittests_pl/callbacks/test_prediction_writer.py similarity index 98% rename from test/unittests/callbacks/test_prediction_writer.py rename to test/unittests_pl/callbacks/test_prediction_writer.py index 0e7acd0205bab..0730a734b9c67 100644 --- a/test/unittests/callbacks/test_prediction_writer.py +++ b/test/unittests_pl/callbacks/test_prediction_writer.py @@ -21,8 +21,8 @@ from pytorch_lightning.callbacks import BasePredictionWriter from pytorch_lightning.trainer.supporters import CombinedLoader from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers import BoringModel, RandomDataset -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel, RandomDataset +from unittests_pl.helpers.runif import RunIf class DummyPredictionWriter(BasePredictionWriter): diff --git a/test/unittests/callbacks/test_pruning.py b/test/unittests_pl/callbacks/test_pruning.py similarity index 99% rename from test/unittests/callbacks/test_pruning.py rename to test/unittests_pl/callbacks/test_pruning.py index de27006cc28ca..f0ad5ceab7c51 100644 --- a/test/unittests/callbacks/test_pruning.py +++ b/test/unittests_pl/callbacks/test_pruning.py @@ -25,8 +25,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import ModelCheckpoint, ModelPruning from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers.boring_model import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringModel +from unittests_pl.helpers.runif import RunIf class TestModel(BoringModel): diff --git a/test/unittests/callbacks/test_quantization.py b/test/unittests_pl/callbacks/test_quantization.py similarity index 97% rename from test/unittests/callbacks/test_quantization.py rename to test/unittests_pl/callbacks/test_quantization.py index 38f20f000d099..ec96dffc607aa 100644 --- a/test/unittests/callbacks/test_quantization.py +++ b/test/unittests_pl/callbacks/test_quantization.py @@ -24,10 +24,10 @@ from pytorch_lightning.callbacks import QuantizationAwareTraining from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.memory import get_model_size_mb -from unittests.helpers.boring_model import RandomDataset -from unittests.helpers.datamodules import RegressDataModule -from unittests.helpers.runif import RunIf -from unittests.helpers.simple_models import RegressionModel +from unittests_pl.helpers.boring_model import RandomDataset +from unittests_pl.helpers.datamodules import RegressDataModule +from unittests_pl.helpers.runif import RunIf +from unittests_pl.helpers.simple_models import RegressionModel @pytest.mark.parametrize("observe", ["average", "histogram"]) diff --git a/test/unittests/callbacks/test_rich_model_summary.py b/test/unittests_pl/callbacks/test_rich_model_summary.py similarity index 96% rename from test/unittests/callbacks/test_rich_model_summary.py rename to test/unittests_pl/callbacks/test_rich_model_summary.py index 33cf3dd59a543..ed0c56f6f3e32 100644 --- a/test/unittests/callbacks/test_rich_model_summary.py +++ b/test/unittests_pl/callbacks/test_rich_model_summary.py @@ -20,8 +20,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import RichModelSummary, RichProgressBar from pytorch_lightning.utilities.model_summary import summarize -from unittests.helpers import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.runif import RunIf @RunIf(rich=True) diff --git a/test/unittests/callbacks/test_rich_progress_bar.py b/test/unittests_pl/callbacks/test_rich_progress_bar.py similarity index 99% rename from test/unittests/callbacks/test_rich_progress_bar.py rename to test/unittests_pl/callbacks/test_rich_progress_bar.py index 32c5f30d57b35..4bbe18da5f371 100644 --- a/test/unittests/callbacks/test_rich_progress_bar.py +++ b/test/unittests_pl/callbacks/test_rich_progress_bar.py @@ -21,8 +21,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import ProgressBarBase, RichProgressBar from pytorch_lightning.callbacks.progress.rich_progress import RichProgressBarTheme -from unittests.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset +from unittests_pl.helpers.runif import RunIf @RunIf(rich=True) diff --git a/test/unittests/callbacks/test_stochastic_weight_avg.py b/test/unittests_pl/callbacks/test_stochastic_weight_avg.py similarity index 98% rename from test/unittests/callbacks/test_stochastic_weight_avg.py rename to test/unittests_pl/callbacks/test_stochastic_weight_avg.py index 7e150da668d97..037192330b512 100644 --- a/test/unittests/callbacks/test_stochastic_weight_avg.py +++ b/test/unittests_pl/callbacks/test_stochastic_weight_avg.py @@ -24,8 +24,8 @@ from pytorch_lightning.callbacks import StochasticWeightAveraging from pytorch_lightning.strategies import DDPSpawnStrategy, Strategy from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset +from unittests_pl.helpers.runif import RunIf class SwaTestModel(BoringModel): diff --git a/test/unittests/callbacks/test_timer.py b/test/unittests_pl/callbacks/test_timer.py similarity index 98% rename from test/unittests/callbacks/test_timer.py rename to test/unittests_pl/callbacks/test_timer.py index 07a8901adc938..0453536158094 100644 --- a/test/unittests/callbacks/test_timer.py +++ b/test/unittests_pl/callbacks/test_timer.py @@ -22,8 +22,8 @@ from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.callbacks.timer import Timer from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.runif import RunIf def test_trainer_flag(caplog): diff --git a/test/unittests/callbacks/test_tqdm_progress_bar.py b/test/unittests_pl/callbacks/test_tqdm_progress_bar.py similarity index 99% rename from test/unittests/callbacks/test_tqdm_progress_bar.py rename to test/unittests_pl/callbacks/test_tqdm_progress_bar.py index 8b9326504e938..88614c6a8825f 100644 --- a/test/unittests/callbacks/test_tqdm_progress_bar.py +++ b/test/unittests_pl/callbacks/test_tqdm_progress_bar.py @@ -29,8 +29,8 @@ from pytorch_lightning.callbacks.progress.tqdm_progress import Tqdm from pytorch_lightning.core.module import LightningModule from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers.boring_model import BoringModel, RandomDataset -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringModel, RandomDataset +from unittests_pl.helpers.runif import RunIf class MockTqdm(Tqdm): diff --git a/test/unittests/checkpointing/__init__.py b/test/unittests_pl/checkpointing/__init__.py similarity index 100% rename from test/unittests/checkpointing/__init__.py rename to test/unittests_pl/checkpointing/__init__.py diff --git a/test/unittests/checkpointing/test_checkpoint_callback_frequency.py b/test/unittests_pl/checkpointing/test_checkpoint_callback_frequency.py similarity index 98% rename from test/unittests/checkpointing/test_checkpoint_callback_frequency.py rename to test/unittests_pl/checkpointing/test_checkpoint_callback_frequency.py index 80ce080b2dc02..bab7b57523775 100644 --- a/test/unittests/checkpointing/test_checkpoint_callback_frequency.py +++ b/test/unittests_pl/checkpointing/test_checkpoint_callback_frequency.py @@ -18,8 +18,8 @@ import torch from pytorch_lightning import callbacks, Trainer -from unittests.helpers import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.runif import RunIf def test_disabled_checkpointing(tmpdir): diff --git a/test/unittests/checkpointing/test_legacy_checkpoints.py b/test/unittests_pl/checkpointing/test_legacy_checkpoints.py similarity index 98% rename from test/unittests/checkpointing/test_legacy_checkpoints.py rename to test/unittests_pl/checkpointing/test_legacy_checkpoints.py index af220f334604a..9538d36246f32 100644 --- a/test/unittests/checkpointing/test_legacy_checkpoints.py +++ b/test/unittests_pl/checkpointing/test_legacy_checkpoints.py @@ -22,7 +22,7 @@ import pytorch_lightning as pl from pytorch_lightning import Callback, Trainer -from unittests import _PATH_LEGACY, _TEST_ROOT +from unittests_pl import _PATH_LEGACY, _TEST_ROOT LEGACY_CHECKPOINTS_PATH = os.path.join(_PATH_LEGACY, "checkpoints") CHECKPOINT_EXTENSION = ".ckpt" diff --git a/test/unittests/checkpointing/test_model_checkpoint.py b/test/unittests_pl/checkpointing/test_model_checkpoint.py similarity index 99% rename from test/unittests/checkpointing/test_model_checkpoint.py rename to test/unittests_pl/checkpointing/test_model_checkpoint.py index 18523550e1971..faeae0628970f 100644 --- a/test/unittests/checkpointing/test_model_checkpoint.py +++ b/test/unittests_pl/checkpointing/test_model_checkpoint.py @@ -31,15 +31,15 @@ from torch import optim import pytorch_lightning as pl -import unittests.helpers.utils as tutils +import unittests_pl.helpers.utils as tutils from pytorch_lightning import seed_everything, Trainer from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.loggers import TensorBoardLogger from pytorch_lightning.utilities.cloud_io import load as pl_load from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.imports import _OMEGACONF_AVAILABLE -from unittests.helpers import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.runif import RunIf if _OMEGACONF_AVAILABLE: from omegaconf import Container, OmegaConf diff --git a/test/unittests/checkpointing/test_torch_saving.py b/test/unittests_pl/checkpointing/test_torch_saving.py similarity index 95% rename from test/unittests/checkpointing/test_torch_saving.py rename to test/unittests_pl/checkpointing/test_torch_saving.py index 0eb5ea07b701e..250730ec42477 100644 --- a/test/unittests/checkpointing/test_torch_saving.py +++ b/test/unittests_pl/checkpointing/test_torch_saving.py @@ -16,8 +16,8 @@ import torch from pytorch_lightning import Trainer -from unittests.helpers import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.runif import RunIf def test_model_torch_save(tmpdir): diff --git a/test/unittests/checkpointing/test_trainer_checkpoint.py b/test/unittests_pl/checkpointing/test_trainer_checkpoint.py similarity index 99% rename from test/unittests/checkpointing/test_trainer_checkpoint.py rename to test/unittests_pl/checkpointing/test_trainer_checkpoint.py index 6063f89f400e4..227a934ac196b 100644 --- a/test/unittests/checkpointing/test_trainer_checkpoint.py +++ b/test/unittests_pl/checkpointing/test_trainer_checkpoint.py @@ -23,7 +23,7 @@ from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.plugins.io.torch_plugin import TorchCheckpointIO from pytorch_lightning.plugins.io.xla_plugin import XLACheckpointIO -from unittests.helpers import BoringModel +from unittests_pl.helpers import BoringModel def test_finetuning_with_ckpt_path(tmpdir): diff --git a/test/unittests/conftest.py b/test/unittests_pl/conftest.py similarity index 99% rename from test/unittests/conftest.py rename to test/unittests_pl/conftest.py index 84577ee263a44..12a9e532566ac 100644 --- a/test/unittests/conftest.py +++ b/test/unittests_pl/conftest.py @@ -24,7 +24,7 @@ from pytorch_lightning.plugins.environments.lightning_environment import find_free_network_port from pytorch_lightning.trainer.connectors.signal_connector import SignalConnector from pytorch_lightning.utilities.imports import _IS_WINDOWS -from unittests import _PATH_DATASETS +from unittests_pl import _PATH_DATASETS @pytest.fixture(scope="session") diff --git a/test/unittests/core/__init__.py b/test/unittests_pl/core/__init__.py similarity index 100% rename from test/unittests/core/__init__.py rename to test/unittests_pl/core/__init__.py diff --git a/test/unittests/core/test_datamodules.py b/test/unittests_pl/core/test_datamodules.py similarity index 98% rename from test/unittests/core/test_datamodules.py rename to test/unittests_pl/core/test_datamodules.py index 823a96557f839..6106c2e4ebf92 100644 --- a/test/unittests/core/test_datamodules.py +++ b/test/unittests_pl/core/test_datamodules.py @@ -27,11 +27,11 @@ from pytorch_lightning.trainer.states import TrainerFn from pytorch_lightning.utilities import _OMEGACONF_AVAILABLE, AttributeDict from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers import BoringDataModule, BoringModel -from unittests.helpers.datamodules import ClassifDataModule -from unittests.helpers.runif import RunIf -from unittests.helpers.simple_models import ClassificationModel -from unittests.helpers.utils import reset_seed +from unittests_pl.helpers import BoringDataModule, BoringModel +from unittests_pl.helpers.datamodules import ClassifDataModule +from unittests_pl.helpers.runif import RunIf +from unittests_pl.helpers.simple_models import ClassificationModel +from unittests_pl.helpers.utils import reset_seed if _OMEGACONF_AVAILABLE: from omegaconf import OmegaConf diff --git a/test/unittests/core/test_lightning_module.py b/test/unittests_pl/core/test_lightning_module.py similarity index 99% rename from test/unittests/core/test_lightning_module.py rename to test/unittests_pl/core/test_lightning_module.py index 4253697abeb15..a470c7e9104cd 100644 --- a/test/unittests/core/test_lightning_module.py +++ b/test/unittests_pl/core/test_lightning_module.py @@ -23,8 +23,8 @@ from pytorch_lightning.loggers import TensorBoardLogger from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.imports import _TORCH_GREATER_EQUAL_1_11 -from unittests.helpers import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.runif import RunIf def test_lightning_module_not_abstract(): diff --git a/test/unittests/core/test_lightning_optimizer.py b/test/unittests_pl/core/test_lightning_optimizer.py similarity index 99% rename from test/unittests/core/test_lightning_optimizer.py rename to test/unittests_pl/core/test_lightning_optimizer.py index 51db3103cf798..2b24155fc75f3 100644 --- a/test/unittests/core/test_lightning_optimizer.py +++ b/test/unittests_pl/core/test_lightning_optimizer.py @@ -20,7 +20,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.core.optimizer import LightningOptimizer from pytorch_lightning.loops.optimization.optimizer_loop import Closure -from unittests.helpers.boring_model import BoringModel +from unittests_pl.helpers.boring_model import BoringModel @pytest.mark.parametrize("auto", (True, False)) diff --git a/test/unittests/core/test_metric_result_integration.py b/test/unittests_pl/core/test_metric_result_integration.py similarity index 99% rename from test/unittests/core/test_metric_result_integration.py rename to test/unittests_pl/core/test_metric_result_integration.py index 2edf0391337ba..2c1bd1c9f47d0 100644 --- a/test/unittests/core/test_metric_result_integration.py +++ b/test/unittests_pl/core/test_metric_result_integration.py @@ -24,7 +24,7 @@ from torch.nn import ModuleDict, ModuleList from torchmetrics import Metric, MetricCollection -import unittests.helpers.utils as tutils +import unittests_pl.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.trainer.connectors.logger_connector.result import ( @@ -33,8 +33,8 @@ _ResultMetric, _Sync, ) -from unittests.helpers import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.runif import RunIf class DummyMetric(Metric): diff --git a/test/unittests/core/test_results.py b/test/unittests_pl/core/test_results.py similarity index 94% rename from test/unittests/core/test_results.py rename to test/unittests_pl/core/test_results.py index 507f005d3eeba..021592e9f3946 100644 --- a/test/unittests/core/test_results.py +++ b/test/unittests_pl/core/test_results.py @@ -15,10 +15,10 @@ import torch.distributed as dist import torch.multiprocessing as mp -import unittests.helpers.utils as tutils +import unittests_pl.helpers.utils as tutils from pytorch_lightning.trainer.connectors.logger_connector.result import _Sync from pytorch_lightning.utilities.distributed import sync_ddp_if_available -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.runif import RunIf def _setup_ddp(rank, worldsize): diff --git a/test/unittests/deprecated_api/__init__.py b/test/unittests_pl/deprecated_api/__init__.py similarity index 95% rename from test/unittests/deprecated_api/__init__.py rename to test/unittests_pl/deprecated_api/__init__.py index d1a73c1fa24cc..690494859e599 100644 --- a/test/unittests/deprecated_api/__init__.py +++ b/test/unittests_pl/deprecated_api/__init__.py @@ -16,7 +16,7 @@ from contextlib import contextmanager from typing import Optional -from unittests.helpers.utils import no_warning_call +from unittests_pl.helpers.utils import no_warning_call def _soft_unimport_module(str_module): diff --git a/test/unittests/deprecated_api/test_remove_1-7.py b/test/unittests_pl/deprecated_api/test_remove_1-7.py similarity index 97% rename from test/unittests/deprecated_api/test_remove_1-7.py rename to test/unittests_pl/deprecated_api/test_remove_1-7.py index 5d336d2b2ad51..38220b0756d08 100644 --- a/test/unittests/deprecated_api/test_remove_1-7.py +++ b/test/unittests_pl/deprecated_api/test_remove_1-7.py @@ -31,9 +31,9 @@ TorchElasticEnvironment, ) from pytorch_lightning.strategies import SingleDeviceStrategy -from unittests.deprecated_api import _soft_unimport_module -from unittests.helpers import BoringModel -from unittests.plugins.environments.test_lsf_environment import _make_rankfile +from unittests_pl.deprecated_api import _soft_unimport_module +from unittests_pl.helpers import BoringModel +from unittests_pl.plugins.environments.test_lsf_environment import _make_rankfile def test_v1_7_0_on_interrupt(tmpdir): diff --git a/test/unittests/deprecated_api/test_remove_1-8.py b/test/unittests_pl/deprecated_api/test_remove_1-8.py similarity index 99% rename from test/unittests/deprecated_api/test_remove_1-8.py rename to test/unittests_pl/deprecated_api/test_remove_1-8.py index 8c6b51f538b6a..06585f6d103b3 100644 --- a/test/unittests/deprecated_api/test_remove_1-8.py +++ b/test/unittests_pl/deprecated_api/test_remove_1-8.py @@ -47,10 +47,10 @@ from pytorch_lightning.utilities.enums import DeviceType, DistributedType from pytorch_lightning.utilities.imports import _TORCHTEXT_LEGACY from pytorch_lightning.utilities.rank_zero import rank_zero_only, rank_zero_warn -from unittests.deprecated_api import no_deprecated_call -from unittests.helpers.boring_model import BoringDataModule, BoringModel -from unittests.helpers.runif import RunIf -from unittests.helpers.torchtext_utils import get_dummy_torchtext_data_iterator +from unittests_pl.deprecated_api import no_deprecated_call +from unittests_pl.helpers.boring_model import BoringDataModule, BoringModel +from unittests_pl.helpers.runif import RunIf +from unittests_pl.helpers.torchtext_utils import get_dummy_torchtext_data_iterator def test_v1_8_0_deprecated_distributed_type_enum(): diff --git a/test/unittests/deprecated_api/test_remove_1-9.py b/test/unittests_pl/deprecated_api/test_remove_1-9.py similarity index 100% rename from test/unittests/deprecated_api/test_remove_1-9.py rename to test/unittests_pl/deprecated_api/test_remove_1-9.py diff --git a/test/unittests/deprecated_api/test_remove_2-0.py b/test/unittests_pl/deprecated_api/test_remove_2-0.py similarity index 97% rename from test/unittests/deprecated_api/test_remove_2-0.py rename to test/unittests_pl/deprecated_api/test_remove_2-0.py index f378d8a5c2d0c..498a3517ee1c6 100644 --- a/test/unittests/deprecated_api/test_remove_2-0.py +++ b/test/unittests_pl/deprecated_api/test_remove_2-0.py @@ -18,8 +18,8 @@ import pytorch_lightning from pytorch_lightning import Trainer -from unittests.callbacks.test_callbacks import OldStatefulCallback -from unittests.helpers import BoringModel +from unittests_pl.callbacks.test_callbacks import OldStatefulCallback +from unittests_pl.helpers import BoringModel def test_v2_0_0_deprecated_num_processes(): diff --git a/test/unittests_pl/helpers/__init__.py b/test/unittests_pl/helpers/__init__.py new file mode 100644 index 0000000000000..17c813fd34d68 --- /dev/null +++ b/test/unittests_pl/helpers/__init__.py @@ -0,0 +1,7 @@ +from unittests_pl.helpers.boring_model import ( # noqa: F401 + BoringDataModule, + BoringModel, + ManualOptimBoringModel, + RandomDataset, +) +from unittests_pl.helpers.datasets import TrialMNIST # noqa: F401 diff --git a/test/unittests/helpers/advanced_models.py b/test/unittests_pl/helpers/advanced_models.py similarity index 98% rename from test/unittests/helpers/advanced_models.py rename to test/unittests_pl/helpers/advanced_models.py index a524c47d060be..480a62f924eb9 100644 --- a/test/unittests/helpers/advanced_models.py +++ b/test/unittests_pl/helpers/advanced_models.py @@ -20,8 +20,8 @@ from pytorch_lightning.core.module import LightningModule from pytorch_lightning.utilities.imports import _TORCHVISION_AVAILABLE -from unittests import _PATH_DATASETS -from unittests.helpers.datasets import AverageDataset, MNIST, TrialMNIST +from unittests_pl import _PATH_DATASETS +from unittests_pl.helpers.datasets import AverageDataset, MNIST, TrialMNIST if _TORCHVISION_AVAILABLE: from torchvision import models, transforms diff --git a/test/unittests/helpers/boring_model.py b/test/unittests_pl/helpers/boring_model.py similarity index 100% rename from test/unittests/helpers/boring_model.py rename to test/unittests_pl/helpers/boring_model.py diff --git a/test/unittests/helpers/dataloaders.py b/test/unittests_pl/helpers/dataloaders.py similarity index 100% rename from test/unittests/helpers/dataloaders.py rename to test/unittests_pl/helpers/dataloaders.py diff --git a/test/unittests/helpers/datamodules.py b/test/unittests_pl/helpers/datamodules.py similarity index 98% rename from test/unittests/helpers/datamodules.py rename to test/unittests_pl/helpers/datamodules.py index c9e1262ed16f4..bc444a2f2d2bc 100644 --- a/test/unittests/helpers/datamodules.py +++ b/test/unittests_pl/helpers/datamodules.py @@ -19,7 +19,7 @@ from pytorch_lightning.core.datamodule import LightningDataModule from pytorch_lightning.utilities import _module_available -from unittests.helpers.datasets import MNIST, SklearnDataset, TrialMNIST +from unittests_pl.helpers.datasets import MNIST, SklearnDataset, TrialMNIST _SKLEARN_AVAILABLE = _module_available("sklearn") if _SKLEARN_AVAILABLE: diff --git a/test/unittests/helpers/datasets.py b/test/unittests_pl/helpers/datasets.py similarity index 100% rename from test/unittests/helpers/datasets.py rename to test/unittests_pl/helpers/datasets.py diff --git a/test/unittests/helpers/deterministic_model.py b/test/unittests_pl/helpers/deterministic_model.py similarity index 100% rename from test/unittests/helpers/deterministic_model.py rename to test/unittests_pl/helpers/deterministic_model.py diff --git a/test/unittests/helpers/imports.py b/test/unittests_pl/helpers/imports.py similarity index 100% rename from test/unittests/helpers/imports.py rename to test/unittests_pl/helpers/imports.py diff --git a/test/unittests/helpers/pipelines.py b/test/unittests_pl/helpers/pipelines.py similarity index 96% rename from test/unittests/helpers/pipelines.py rename to test/unittests_pl/helpers/pipelines.py index aae50a3e64a63..5689d02417a84 100644 --- a/test/unittests/helpers/pipelines.py +++ b/test/unittests_pl/helpers/pipelines.py @@ -15,8 +15,8 @@ from torchmetrics.functional import accuracy from pytorch_lightning import LightningDataModule, LightningModule, Trainer -from unittests.helpers import BoringModel -from unittests.helpers.utils import get_default_logger, load_model_from_checkpoint, reset_seed +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.utils import get_default_logger, load_model_from_checkpoint, reset_seed def run_model_test_without_loggers( diff --git a/test/unittests/helpers/runif.py b/test/unittests_pl/helpers/runif.py similarity index 100% rename from test/unittests/helpers/runif.py rename to test/unittests_pl/helpers/runif.py diff --git a/test/unittests/helpers/simple_models.py b/test/unittests_pl/helpers/simple_models.py similarity index 100% rename from test/unittests/helpers/simple_models.py rename to test/unittests_pl/helpers/simple_models.py diff --git a/test/unittests/helpers/test_datasets.py b/test/unittests_pl/helpers/test_datasets.py similarity index 90% rename from test/unittests/helpers/test_datasets.py rename to test/unittests_pl/helpers/test_datasets.py index aa79db8fc7ce0..92d6df6e61854 100644 --- a/test/unittests/helpers/test_datasets.py +++ b/test/unittests_pl/helpers/test_datasets.py @@ -16,8 +16,8 @@ import cloudpickle import pytest -from unittests import _PATH_DATASETS -from unittests.helpers.datasets import AverageDataset, MNIST, TrialMNIST +from unittests_pl import _PATH_DATASETS +from unittests_pl.helpers.datasets import AverageDataset, MNIST, TrialMNIST @pytest.mark.parametrize( diff --git a/test/unittests/helpers/test_models.py b/test/unittests_pl/helpers/test_models.py similarity index 81% rename from test/unittests/helpers/test_models.py rename to test/unittests_pl/helpers/test_models.py index a1dca802c79d5..b67ea398a7c30 100644 --- a/test/unittests/helpers/test_models.py +++ b/test/unittests_pl/helpers/test_models.py @@ -16,10 +16,10 @@ import pytest from pytorch_lightning import Trainer -from unittests.helpers.advanced_models import BasicGAN, ParityModuleMNIST, ParityModuleRNN -from unittests.helpers.boring_model import BoringModel -from unittests.helpers.datamodules import ClassifDataModule, RegressDataModule -from unittests.helpers.simple_models import ClassificationModel, RegressionModel +from unittests_pl.helpers.advanced_models import BasicGAN, ParityModuleMNIST, ParityModuleRNN +from unittests_pl.helpers.boring_model import BoringModel +from unittests_pl.helpers.datamodules import ClassifDataModule, RegressDataModule +from unittests_pl.helpers.simple_models import ClassificationModel, RegressionModel @pytest.mark.parametrize( diff --git a/test/unittests/helpers/torchtext_utils.py b/test/unittests_pl/helpers/torchtext_utils.py similarity index 95% rename from test/unittests/helpers/torchtext_utils.py rename to test/unittests_pl/helpers/torchtext_utils.py index 86693f316be79..ac3e0784ae6fb 100644 --- a/test/unittests/helpers/torchtext_utils.py +++ b/test/unittests_pl/helpers/torchtext_utils.py @@ -14,7 +14,7 @@ import random import string -from unittests.helpers.imports import Dataset, Example, Field, Iterator +from unittests_pl.helpers.imports import Dataset, Example, Field, Iterator def _generate_random_string(length: int = 10): diff --git a/test/unittests/helpers/utils.py b/test/unittests_pl/helpers/utils.py similarity index 97% rename from test/unittests/helpers/utils.py rename to test/unittests_pl/helpers/utils.py index 645d84b3eb432..aaf327feb589b 100644 --- a/test/unittests/helpers/utils.py +++ b/test/unittests_pl/helpers/utils.py @@ -23,8 +23,8 @@ from pytorch_lightning import seed_everything from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.loggers import TensorBoardLogger -from unittests import _TEMP_PATH, RANDOM_PORTS -from unittests.helpers.boring_model import BoringModel +from unittests_pl import _TEMP_PATH, RANDOM_PORTS +from unittests_pl.helpers.boring_model import BoringModel def get_default_logger(save_dir, version=None): diff --git a/test/unittests/lite/__init__.py b/test/unittests_pl/lite/__init__.py similarity index 100% rename from test/unittests/lite/__init__.py rename to test/unittests_pl/lite/__init__.py diff --git a/test/unittests/lite/test_lite.py b/test/unittests_pl/lite/test_lite.py similarity index 99% rename from test/unittests/lite/test_lite.py rename to test/unittests_pl/lite/test_lite.py index 65609ba615b32..c94c36eb1e9c3 100644 --- a/test/unittests/lite/test_lite.py +++ b/test/unittests_pl/lite/test_lite.py @@ -30,7 +30,7 @@ from pytorch_lightning.utilities import _StrategyType from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.seed import pl_worker_init_function -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.runif import RunIf class EmptyLite(LightningLite): diff --git a/test/unittests/lite/test_parity.py b/test/unittests_pl/lite/test_parity.py similarity index 98% rename from test/unittests/lite/test_parity.py rename to test/unittests_pl/lite/test_parity.py index 597727f633c62..ff9fb583837a1 100644 --- a/test/unittests/lite/test_parity.py +++ b/test/unittests_pl/lite/test_parity.py @@ -32,8 +32,8 @@ from pytorch_lightning.strategies.ddp_spawn import DDPSpawnStrategy from pytorch_lightning.utilities.apply_func import apply_to_collection, move_data_to_device from pytorch_lightning.utilities.cloud_io import atomic_save -from unittests.helpers.boring_model import RandomDataset -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import RandomDataset +from unittests_pl.helpers.runif import RunIf class BoringModel(nn.Module): diff --git a/test/unittests/lite/test_wrappers.py b/test/unittests_pl/lite/test_wrappers.py similarity index 99% rename from test/unittests/lite/test_wrappers.py rename to test/unittests_pl/lite/test_wrappers.py index b38431caebfd9..9d491f0cb66aa 100644 --- a/test/unittests/lite/test_wrappers.py +++ b/test/unittests_pl/lite/test_wrappers.py @@ -20,7 +20,7 @@ from pytorch_lightning.core.mixins import DeviceDtypeModuleMixin from pytorch_lightning.lite import LightningLite from pytorch_lightning.lite.wrappers import _LiteDataLoader, _LiteModule, _LiteOptimizer -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.runif import RunIf class EmptyLite(LightningLite): diff --git a/test/unittests/loggers/__init__.py b/test/unittests_pl/loggers/__init__.py similarity index 100% rename from test/unittests/loggers/__init__.py rename to test/unittests_pl/loggers/__init__.py diff --git a/test/unittests/loggers/test_all.py b/test/unittests_pl/loggers/test_all.py similarity index 97% rename from test/unittests/loggers/test_all.py rename to test/unittests_pl/loggers/test_all.py index 30d078a578c37..cc97428e87218 100644 --- a/test/unittests/loggers/test_all.py +++ b/test/unittests_pl/loggers/test_all.py @@ -21,7 +21,7 @@ import pytest import torch -import unittests.helpers.utils as tutils +import unittests_pl.helpers.utils as tutils from pytorch_lightning import Callback, Trainer from pytorch_lightning.loggers import ( CometLogger, @@ -32,11 +32,11 @@ WandbLogger, ) from pytorch_lightning.loggers.logger import DummyExperiment -from unittests.helpers import BoringModel -from unittests.helpers.runif import RunIf -from unittests.loggers.test_comet import _patch_comet_atexit -from unittests.loggers.test_mlflow import mock_mlflow_run_creation -from unittests.loggers.test_neptune import create_neptune_mock +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.runif import RunIf +from unittests_pl.loggers.test_comet import _patch_comet_atexit +from unittests_pl.loggers.test_mlflow import mock_mlflow_run_creation +from unittests_pl.loggers.test_neptune import create_neptune_mock LOGGER_CTX_MANAGERS = ( mock.patch("pytorch_lightning.loggers.comet.comet_ml"), diff --git a/test/unittests/loggers/test_comet.py b/test/unittests_pl/loggers/test_comet.py similarity index 99% rename from test/unittests/loggers/test_comet.py rename to test/unittests_pl/loggers/test_comet.py index 40a3558a48b1a..967046e68436b 100644 --- a/test/unittests/loggers/test_comet.py +++ b/test/unittests_pl/loggers/test_comet.py @@ -20,7 +20,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.loggers import CometLogger from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers import BoringModel +from unittests_pl.helpers import BoringModel def _patch_comet_atexit(monkeypatch): diff --git a/test/unittests/loggers/test_csv.py b/test/unittests_pl/loggers/test_csv.py similarity index 96% rename from test/unittests/loggers/test_csv.py rename to test/unittests_pl/loggers/test_csv.py index a1e1d0dd39de4..95d4943dd2d82 100644 --- a/test/unittests/loggers/test_csv.py +++ b/test/unittests_pl/loggers/test_csv.py @@ -21,8 +21,8 @@ from pytorch_lightning.core.saving import load_hparams_from_yaml from pytorch_lightning.loggers import CSVLogger from pytorch_lightning.loggers.csv_logs import ExperimentWriter -from unittests.helpers.datamodules import ClassifDataModule -from unittests.helpers.simple_models import ClassificationModel +from unittests_pl.helpers.datamodules import ClassifDataModule +from unittests_pl.helpers.simple_models import ClassificationModel def test_file_logger_automatic_versioning(tmpdir): diff --git a/test/unittests/loggers/test_logger.py b/test/unittests_pl/loggers/test_logger.py similarity index 99% rename from test/unittests/loggers/test_logger.py rename to test/unittests_pl/loggers/test_logger.py index 698ec9ef15eb9..f36919d46d52f 100644 --- a/test/unittests/loggers/test_logger.py +++ b/test/unittests_pl/loggers/test_logger.py @@ -27,7 +27,7 @@ from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.logger import _convert_params, _sanitize_params from pytorch_lightning.utilities.rank_zero import rank_zero_only -from unittests.helpers.boring_model import BoringDataModule, BoringModel +from unittests_pl.helpers.boring_model import BoringDataModule, BoringModel def test_logger_collection(): diff --git a/test/unittests/loggers/test_mlflow.py b/test/unittests_pl/loggers/test_mlflow.py similarity index 99% rename from test/unittests/loggers/test_mlflow.py rename to test/unittests_pl/loggers/test_mlflow.py index 8df8ece24f0f4..03eabfd3b3791 100644 --- a/test/unittests/loggers/test_mlflow.py +++ b/test/unittests_pl/loggers/test_mlflow.py @@ -20,7 +20,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.loggers import _MLFLOW_AVAILABLE, MLFlowLogger from pytorch_lightning.loggers.mlflow import MLFLOW_RUN_NAME, resolve_tags -from unittests.helpers import BoringModel +from unittests_pl.helpers import BoringModel def mock_mlflow_run_creation(logger, experiment_name=None, experiment_id=None, run_id=None): diff --git a/test/unittests/loggers/test_neptune.py b/test/unittests_pl/loggers/test_neptune.py similarity index 99% rename from test/unittests/loggers/test_neptune.py rename to test/unittests_pl/loggers/test_neptune.py index 528ca53f909e7..835d32753c9d7 100644 --- a/test/unittests/loggers/test_neptune.py +++ b/test/unittests_pl/loggers/test_neptune.py @@ -22,7 +22,7 @@ from pytorch_lightning import __version__, Trainer from pytorch_lightning.loggers import NeptuneLogger -from unittests.helpers import BoringModel +from unittests_pl.helpers import BoringModel def fetchable_paths(value): diff --git a/test/unittests/loggers/test_tensorboard.py b/test/unittests_pl/loggers/test_tensorboard.py similarity index 99% rename from test/unittests/loggers/test_tensorboard.py rename to test/unittests_pl/loggers/test_tensorboard.py index cb058d0ca85c3..717937ed11b7e 100644 --- a/test/unittests/loggers/test_tensorboard.py +++ b/test/unittests_pl/loggers/test_tensorboard.py @@ -25,8 +25,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.loggers import TensorBoardLogger from pytorch_lightning.utilities.imports import _compare_version, _OMEGACONF_AVAILABLE -from unittests.helpers import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.runif import RunIf if _OMEGACONF_AVAILABLE: from omegaconf import OmegaConf diff --git a/test/unittests/loggers/test_wandb.py b/test/unittests_pl/loggers/test_wandb.py similarity index 99% rename from test/unittests/loggers/test_wandb.py rename to test/unittests_pl/loggers/test_wandb.py index d0416e45b86c7..c8651a31c0889 100644 --- a/test/unittests/loggers/test_wandb.py +++ b/test/unittests_pl/loggers/test_wandb.py @@ -20,8 +20,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.loggers import WandbLogger from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers import BoringModel -from unittests.helpers.utils import no_warning_call +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.utils import no_warning_call @mock.patch("pytorch_lightning.loggers.wandb.wandb") diff --git a/test/unittests/loops/__init__.py b/test/unittests_pl/loops/__init__.py similarity index 100% rename from test/unittests/loops/__init__.py rename to test/unittests_pl/loops/__init__.py diff --git a/test/unittests/loops/batch/__init__.py b/test/unittests_pl/loops/batch/__init__.py similarity index 100% rename from test/unittests/loops/batch/__init__.py rename to test/unittests_pl/loops/batch/__init__.py diff --git a/test/unittests/loops/batch/test_truncated_bptt.py b/test/unittests_pl/loops/batch/test_truncated_bptt.py similarity index 100% rename from test/unittests/loops/batch/test_truncated_bptt.py rename to test/unittests_pl/loops/batch/test_truncated_bptt.py diff --git a/test/unittests/loops/epoch/__init__.py b/test/unittests_pl/loops/epoch/__init__.py similarity index 100% rename from test/unittests/loops/epoch/__init__.py rename to test/unittests_pl/loops/epoch/__init__.py diff --git a/test/unittests/loops/epoch/test_training_epoch_loop.py b/test/unittests_pl/loops/epoch/test_training_epoch_loop.py similarity index 98% rename from test/unittests/loops/epoch/test_training_epoch_loop.py rename to test/unittests_pl/loops/epoch/test_training_epoch_loop.py index 25096971b95ce..e0e278e2e2c91 100644 --- a/test/unittests/loops/epoch/test_training_epoch_loop.py +++ b/test/unittests_pl/loops/epoch/test_training_epoch_loop.py @@ -19,8 +19,8 @@ from pytorch_lightning import LightningModule from pytorch_lightning.loops import TrainingEpochLoop from pytorch_lightning.trainer.trainer import Trainer -from unittests.deprecated_api import no_deprecated_call -from unittests.helpers.boring_model import BoringModel +from unittests_pl.deprecated_api import no_deprecated_call +from unittests_pl.helpers.boring_model import BoringModel _out00 = {"loss": 0.0} _out01 = {"loss": 0.1} diff --git a/test/unittests/loops/optimization/__init__.py b/test/unittests_pl/loops/optimization/__init__.py similarity index 100% rename from test/unittests/loops/optimization/__init__.py rename to test/unittests_pl/loops/optimization/__init__.py diff --git a/test/unittests/loops/optimization/test_closure.py b/test/unittests_pl/loops/optimization/test_closure.py similarity index 97% rename from test/unittests/loops/optimization/test_closure.py rename to test/unittests_pl/loops/optimization/test_closure.py index 306ae143a894e..5f7cce30eadbc 100644 --- a/test/unittests/loops/optimization/test_closure.py +++ b/test/unittests_pl/loops/optimization/test_closure.py @@ -16,7 +16,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers import BoringModel +from unittests_pl.helpers import BoringModel def test_optimizer_step_no_closure_raises(tmpdir): diff --git a/test/unittests/loops/optimization/test_manual_loop.py b/test/unittests_pl/loops/optimization/test_manual_loop.py similarity index 97% rename from test/unittests/loops/optimization/test_manual_loop.py rename to test/unittests_pl/loops/optimization/test_manual_loop.py index ec7006c82d4da..28249d1ab10fc 100644 --- a/test/unittests/loops/optimization/test_manual_loop.py +++ b/test/unittests_pl/loops/optimization/test_manual_loop.py @@ -17,7 +17,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.loops.optimization.manual_loop import ManualResult from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers import BoringModel +from unittests_pl.helpers import BoringModel def test_manual_result(): diff --git a/test/unittests/loops/optimization/test_optimizer_loop.py b/test/unittests_pl/loops/optimization/test_optimizer_loop.py similarity index 99% rename from test/unittests/loops/optimization/test_optimizer_loop.py rename to test/unittests_pl/loops/optimization/test_optimizer_loop.py index f59db8d4159fa..d03515f54dae0 100644 --- a/test/unittests/loops/optimization/test_optimizer_loop.py +++ b/test/unittests_pl/loops/optimization/test_optimizer_loop.py @@ -23,7 +23,7 @@ from pytorch_lightning.core.optimizer import LightningOptimizer from pytorch_lightning.loops.optimization.optimizer_loop import ClosureResult from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers import BoringModel +from unittests_pl.helpers import BoringModel def test_closure_result_deepcopy(): diff --git a/test/unittests/loops/test_all.py b/test/unittests_pl/loops/test_all.py similarity index 97% rename from test/unittests/loops/test_all.py rename to test/unittests_pl/loops/test_all.py index 877ea288e82ce..776272c4ed9b6 100644 --- a/test/unittests/loops/test_all.py +++ b/test/unittests_pl/loops/test_all.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. from pytorch_lightning import Callback, Trainer -from unittests.helpers import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.runif import RunIf class BatchHookObserverCallback(Callback): diff --git a/test/unittests/loops/test_evaluation_loop.py b/test/unittests_pl/loops/test_evaluation_loop.py similarity index 98% rename from test/unittests/loops/test_evaluation_loop.py rename to test/unittests_pl/loops/test_evaluation_loop.py index 1dffb9f456baa..c2f24901c56bb 100644 --- a/test/unittests/loops/test_evaluation_loop.py +++ b/test/unittests_pl/loops/test_evaluation_loop.py @@ -21,8 +21,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.loops import EvaluationEpochLoop from pytorch_lightning.utilities.model_helpers import is_overridden -from unittests.helpers.boring_model import BoringModel, RandomDataset -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringModel, RandomDataset +from unittests_pl.helpers.runif import RunIf @mock.patch("pytorch_lightning.loops.dataloader.evaluation_loop.EvaluationLoop._on_evaluation_epoch_end") diff --git a/test/unittests/loops/test_evaluation_loop_flow.py b/test/unittests_pl/loops/test_evaluation_loop_flow.py similarity index 99% rename from test/unittests/loops/test_evaluation_loop_flow.py rename to test/unittests_pl/loops/test_evaluation_loop_flow.py index cf35e4e3fda90..506c808d357d8 100644 --- a/test/unittests/loops/test_evaluation_loop_flow.py +++ b/test/unittests_pl/loops/test_evaluation_loop_flow.py @@ -18,7 +18,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.core.module import LightningModule from pytorch_lightning.trainer.states import RunningStage -from unittests.helpers.deterministic_model import DeterministicModel +from unittests_pl.helpers.deterministic_model import DeterministicModel def test__eval_step__flow(tmpdir): diff --git a/test/unittests/loops/test_flow_warnings.py b/test/unittests_pl/loops/test_flow_warnings.py similarity index 95% rename from test/unittests/loops/test_flow_warnings.py rename to test/unittests_pl/loops/test_flow_warnings.py index 67a8207d867bf..7cb478979aa2c 100644 --- a/test/unittests/loops/test_flow_warnings.py +++ b/test/unittests_pl/loops/test_flow_warnings.py @@ -14,7 +14,7 @@ import warnings from pytorch_lightning import Trainer -from unittests.helpers.boring_model import BoringModel +from unittests_pl.helpers.boring_model import BoringModel class TestModel(BoringModel): diff --git a/test/unittests/loops/test_loop_state_dict.py b/test/unittests_pl/loops/test_loop_state_dict.py similarity index 100% rename from test/unittests/loops/test_loop_state_dict.py rename to test/unittests_pl/loops/test_loop_state_dict.py diff --git a/test/unittests/loops/test_loops.py b/test/unittests_pl/loops/test_loops.py similarity index 99% rename from test/unittests/loops/test_loops.py rename to test/unittests_pl/loops/test_loops.py index 1f97ed29b6d38..ad672f1ab16a1 100644 --- a/test/unittests/loops/test_loops.py +++ b/test/unittests_pl/loops/test_loops.py @@ -27,8 +27,8 @@ from pytorch_lightning.loops import EvaluationLoop, Loop, TrainingBatchLoop, TrainingEpochLoop from pytorch_lightning.trainer.progress import BaseProgress from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers import BoringModel, RandomDataset -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel, RandomDataset +from unittests_pl.helpers.runif import RunIf class NestedLoop(Loop): diff --git a/test/unittests/loops/test_training_loop.py b/test/unittests_pl/loops/test_training_loop.py similarity index 99% rename from test/unittests/loops/test_training_loop.py rename to test/unittests_pl/loops/test_training_loop.py index 6c612e5472aa4..695a65c035ac5 100644 --- a/test/unittests/loops/test_training_loop.py +++ b/test/unittests_pl/loops/test_training_loop.py @@ -15,7 +15,7 @@ import torch from pytorch_lightning import seed_everything, Trainer -from unittests.helpers import BoringModel +from unittests_pl.helpers import BoringModel def test_outputs_format(tmpdir): diff --git a/test/unittests/loops/test_training_loop_flow_dict.py b/test/unittests_pl/loops/test_training_loop_flow_dict.py similarity index 98% rename from test/unittests/loops/test_training_loop_flow_dict.py rename to test/unittests_pl/loops/test_training_loop_flow_dict.py index b5311946c3d11..55052370bb12c 100644 --- a/test/unittests/loops/test_training_loop_flow_dict.py +++ b/test/unittests_pl/loops/test_training_loop_flow_dict.py @@ -17,7 +17,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.core.module import LightningModule -from unittests.helpers.deterministic_model import DeterministicModel +from unittests_pl.helpers.deterministic_model import DeterministicModel def test__training_step__flow_dict(tmpdir): diff --git a/test/unittests/loops/test_training_loop_flow_scalar.py b/test/unittests_pl/loops/test_training_loop_flow_scalar.py similarity index 98% rename from test/unittests/loops/test_training_loop_flow_scalar.py rename to test/unittests_pl/loops/test_training_loop_flow_scalar.py index bdfcfa7756be1..310e69884d1f4 100644 --- a/test/unittests/loops/test_training_loop_flow_scalar.py +++ b/test/unittests_pl/loops/test_training_loop_flow_scalar.py @@ -20,9 +20,9 @@ from pytorch_lightning.core.module import LightningModule from pytorch_lightning.loops.optimization.optimizer_loop import Closure from pytorch_lightning.trainer.states import RunningStage -from unittests.helpers.boring_model import BoringModel, RandomDataset -from unittests.helpers.deterministic_model import DeterministicModel -from unittests.helpers.utils import no_warning_call +from unittests_pl.helpers.boring_model import BoringModel, RandomDataset +from unittests_pl.helpers.deterministic_model import DeterministicModel +from unittests_pl.helpers.utils import no_warning_call def test__training_step__flow_scalar(tmpdir): diff --git a/test/unittests/loops/test_utilities.py b/test/unittests_pl/loops/test_utilities.py similarity index 100% rename from test/unittests/loops/test_utilities.py rename to test/unittests_pl/loops/test_utilities.py diff --git a/test/unittests/models/__init__.py b/test/unittests_pl/models/__init__.py similarity index 100% rename from test/unittests/models/__init__.py rename to test/unittests_pl/models/__init__.py diff --git a/test/unittests/models/conf/config.yaml b/test/unittests_pl/models/conf/config.yaml similarity index 100% rename from test/unittests/models/conf/config.yaml rename to test/unittests_pl/models/conf/config.yaml diff --git a/test/unittests/models/conf/training/default.yaml b/test/unittests_pl/models/conf/training/default.yaml similarity index 100% rename from test/unittests/models/conf/training/default.yaml rename to test/unittests_pl/models/conf/training/default.yaml diff --git a/test/unittests/models/data/__init__.py b/test/unittests_pl/models/data/__init__.py similarity index 100% rename from test/unittests/models/data/__init__.py rename to test/unittests_pl/models/data/__init__.py diff --git a/test/unittests/models/data/horovod/__init__.py b/test/unittests_pl/models/data/horovod/__init__.py similarity index 100% rename from test/unittests/models/data/horovod/__init__.py rename to test/unittests_pl/models/data/horovod/__init__.py diff --git a/test/unittests/models/data/horovod/test_train_script.py b/test/unittests_pl/models/data/horovod/test_train_script.py similarity index 92% rename from test/unittests/models/data/horovod/test_train_script.py rename to test/unittests_pl/models/data/horovod/test_train_script.py index 50da1c2c6c3ed..1817b2b727840 100644 --- a/test/unittests/models/data/horovod/test_train_script.py +++ b/test/unittests_pl/models/data/horovod/test_train_script.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from unittests.models.data.horovod.train_default_model import run_test_from_config +from unittests_pl.models.data.horovod.train_default_model import run_test_from_config def test_horovod_model_script(tmpdir): diff --git a/test/unittests/models/data/horovod/train_default_model.py b/test/unittests_pl/models/data/horovod/train_default_model.py similarity index 96% rename from test/unittests/models/data/horovod/train_default_model.py rename to test/unittests_pl/models/data/horovod/train_default_model.py index 65e016372104c..c5cade7ab2c22 100644 --- a/test/unittests/models/data/horovod/train_default_model.py +++ b/test/unittests_pl/models/data/horovod/train_default_model.py @@ -36,8 +36,8 @@ else: print("You requested to import Horovod which is missing or not supported for your OS.") -from unittests.helpers import BoringModel # noqa: E402 -from unittests.helpers.utils import reset_seed, set_random_main_port # noqa: E402 +from unittests_pl.helpers import BoringModel # noqa: E402 +from unittests_pl.helpers.utils import reset_seed, set_random_main_port # noqa: E402 parser = argparse.ArgumentParser() parser.add_argument("--trainer-options", required=True) diff --git a/test/unittests/models/test_amp.py b/test/unittests_pl/models/test_amp.py similarity index 98% rename from test/unittests/models/test_amp.py rename to test/unittests_pl/models/test_amp.py index 708deb730fb89..d34c6189a8eda 100644 --- a/test/unittests/models/test_amp.py +++ b/test/unittests_pl/models/test_amp.py @@ -19,11 +19,11 @@ from torch import optim from torch.utils.data import DataLoader -import unittests.helpers.utils as tutils +import unittests_pl.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.plugins.environments import SLURMEnvironment -from unittests.helpers import BoringModel, RandomDataset -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel, RandomDataset +from unittests_pl.helpers.runif import RunIf class AMPTestModel(BoringModel): diff --git a/test/unittests/models/test_cpu.py b/test/unittests_pl/models/test_cpu.py similarity index 96% rename from test/unittests/models/test_cpu.py rename to test/unittests_pl/models/test_cpu.py index 49670e4dc2d86..707a44cd6f6a0 100644 --- a/test/unittests/models/test_cpu.py +++ b/test/unittests_pl/models/test_cpu.py @@ -15,14 +15,14 @@ import torch -import unittests.helpers.pipelines as tpipes -import unittests.helpers.utils as tutils +import unittests_pl.helpers.pipelines as tpipes +import unittests_pl.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.callbacks import Callback, EarlyStopping, ModelCheckpoint -from unittests.helpers import BoringModel -from unittests.helpers.datamodules import ClassifDataModule -from unittests.helpers.runif import RunIf -from unittests.helpers.simple_models import ClassificationModel +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.datamodules import ClassifDataModule +from unittests_pl.helpers.runif import RunIf +from unittests_pl.helpers.simple_models import ClassificationModel def test_cpu_slurm_save_load(tmpdir): diff --git a/test/unittests/models/test_gpu.py b/test/unittests_pl/models/test_gpu.py similarity index 96% rename from test/unittests/models/test_gpu.py rename to test/unittests_pl/models/test_gpu.py index b408d3c26e7de..b46e3dc51e475 100644 --- a/test/unittests/models/test_gpu.py +++ b/test/unittests_pl/models/test_gpu.py @@ -20,19 +20,19 @@ import pytest import torch -import unittests.helpers.pipelines as tpipes -import unittests.helpers.utils as tutils +import unittests_pl.helpers.pipelines as tpipes +import unittests_pl.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.accelerators import CPUAccelerator, GPUAccelerator from pytorch_lightning.plugins.environments import TorchElasticEnvironment from pytorch_lightning.utilities import device_parser from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.imports import _compare_version, _TORCHTEXT_LEGACY -from unittests.helpers import BoringModel -from unittests.helpers.datamodules import ClassifDataModule -from unittests.helpers.imports import Batch, Dataset, Example, Field, LabelField -from unittests.helpers.runif import RunIf -from unittests.helpers.simple_models import ClassificationModel +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.datamodules import ClassifDataModule +from unittests_pl.helpers.imports import Batch, Dataset, Example, Field, LabelField +from unittests_pl.helpers.runif import RunIf +from unittests_pl.helpers.simple_models import ClassificationModel PL_VERSION_LT_1_5 = _compare_version("pytorch_lightning", operator.lt, "1.5") PRETEND_N_OF_GPUS = 16 diff --git a/test/unittests/models/test_grad_norm.py b/test/unittests_pl/models/test_grad_norm.py similarity index 97% rename from test/unittests/models/test_grad_norm.py rename to test/unittests_pl/models/test_grad_norm.py index f01937ca2fadd..2bc6716848d41 100644 --- a/test/unittests/models/test_grad_norm.py +++ b/test/unittests_pl/models/test_grad_norm.py @@ -17,8 +17,8 @@ import pytest from pytorch_lightning import Trainer -from unittests.helpers import BoringModel -from unittests.helpers.utils import reset_seed +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.utils import reset_seed class ModelWithManualGradTracker(BoringModel): diff --git a/test/unittests/models/test_hooks.py b/test/unittests_pl/models/test_hooks.py similarity index 99% rename from test/unittests/models/test_hooks.py rename to test/unittests_pl/models/test_hooks.py index 66be46ab87124..ff0ec48312c92 100644 --- a/test/unittests/models/test_hooks.py +++ b/test/unittests_pl/models/test_hooks.py @@ -21,8 +21,8 @@ from torch.utils.data import DataLoader from pytorch_lightning import __version__, Callback, LightningDataModule, LightningModule, Trainer -from unittests.helpers import BoringDataModule, BoringModel, RandomDataset -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringDataModule, BoringModel, RandomDataset +from unittests_pl.helpers.runif import RunIf @pytest.mark.parametrize("max_steps", [1, 2, 3]) diff --git a/test/unittests/models/test_horovod.py b/test/unittests_pl/models/test_horovod.py similarity index 98% rename from test/unittests/models/test_horovod.py rename to test/unittests_pl/models/test_horovod.py index 6da2f0d54ff30..eb0ed5daa40c5 100644 --- a/test/unittests/models/test_horovod.py +++ b/test/unittests_pl/models/test_horovod.py @@ -25,15 +25,15 @@ from torch import optim from torchmetrics.classification.accuracy import Accuracy -import unittests.helpers.pipelines as tpipes -import unittests.helpers.utils as tutils +import unittests_pl.helpers.pipelines as tpipes +import unittests_pl.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.accelerators import CPUAccelerator from pytorch_lightning.utilities import _HOROVOD_AVAILABLE from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers import BoringModel -from unittests.helpers.advanced_models import BasicGAN -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.advanced_models import BasicGAN +from unittests_pl.helpers.runif import RunIf if _HOROVOD_AVAILABLE: import horovod @@ -42,7 +42,7 @@ @RunIf(min_cuda_gpus=1, horovod=True) def test_nccl_is_available_on_gpu_environment(): - from unittests.helpers.runif import _HOROVOD_NCCL_AVAILABLE + from unittests_pl.helpers.runif import _HOROVOD_NCCL_AVAILABLE # the GPU environment should always install Horovod NCCL assert _HOROVOD_NCCL_AVAILABLE diff --git a/test/unittests/models/test_hparams.py b/test/unittests_pl/models/test_hparams.py similarity index 99% rename from test/unittests/models/test_hparams.py rename to test/unittests_pl/models/test_hparams.py index 51e0cefd96281..632387cabc8f9 100644 --- a/test/unittests/models/test_hparams.py +++ b/test/unittests_pl/models/test_hparams.py @@ -32,10 +32,10 @@ from pytorch_lightning.core.saving import load_hparams_from_yaml, save_hparams_to_yaml from pytorch_lightning.utilities import _HYDRA_EXPERIMENTAL_AVAILABLE, _OMEGACONF_AVAILABLE, AttributeDict, is_picklable from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers import BoringModel, RandomDataset -from unittests.helpers.boring_model import BoringDataModule -from unittests.helpers.runif import RunIf -from unittests.helpers.utils import no_warning_call +from unittests_pl.helpers import BoringModel, RandomDataset +from unittests_pl.helpers.boring_model import BoringDataModule +from unittests_pl.helpers.runif import RunIf +from unittests_pl.helpers.utils import no_warning_call if _HYDRA_EXPERIMENTAL_AVAILABLE: from hydra.experimental import compose, initialize diff --git a/test/unittests/models/test_onnx.py b/test/unittests_pl/models/test_onnx.py similarity index 95% rename from test/unittests/models/test_onnx.py rename to test/unittests_pl/models/test_onnx.py index 1dea692bd474c..978b188df37ef 100644 --- a/test/unittests/models/test_onnx.py +++ b/test/unittests_pl/models/test_onnx.py @@ -18,12 +18,12 @@ import pytest import torch -import unittests.helpers.pipelines as tpipes -import unittests.helpers.utils as tutils +import unittests_pl.helpers.pipelines as tpipes +import unittests_pl.helpers.utils as tutils from pytorch_lightning import Trainer -from unittests.helpers import BoringModel -from unittests.helpers.runif import RunIf -from unittests.utilities.test_model_summary import UnorderedModel +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.runif import RunIf +from unittests_pl.utilities.test_model_summary import UnorderedModel def test_model_saves_with_input_sample(tmpdir): diff --git a/test/unittests/models/test_restore.py b/test/unittests_pl/models/test_restore.py similarity index 98% rename from test/unittests/models/test_restore.py rename to test/unittests_pl/models/test_restore.py index f2c00a01443b4..b6f7e2ae457ae 100644 --- a/test/unittests/models/test_restore.py +++ b/test/unittests_pl/models/test_restore.py @@ -24,16 +24,16 @@ import torch import torch.nn.functional as F -import unittests.helpers.pipelines as tpipes -import unittests.helpers.utils as tutils +import unittests_pl.helpers.pipelines as tpipes +import unittests_pl.helpers.utils as tutils from pytorch_lightning import Callback, Trainer from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.trainer.states import TrainerFn -from unittests.helpers import BoringModel -from unittests.helpers.datamodules import ClassifDataModule -from unittests.helpers.runif import RunIf -from unittests.helpers.simple_models import ClassificationModel -from unittests.loops.test_loops import CustomException +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.datamodules import ClassifDataModule +from unittests_pl.helpers.runif import RunIf +from unittests_pl.helpers.simple_models import ClassificationModel +from unittests_pl.loops.test_loops import CustomException class ModelTrainerPropertyParity(Callback): diff --git a/test/unittests/models/test_torchscript.py b/test/unittests_pl/models/test_torchscript.py similarity index 97% rename from test/unittests/models/test_torchscript.py rename to test/unittests_pl/models/test_torchscript.py index d7d0b26247767..c63eb84b14185 100644 --- a/test/unittests/models/test_torchscript.py +++ b/test/unittests_pl/models/test_torchscript.py @@ -20,9 +20,9 @@ from fsspec.implementations.local import LocalFileSystem from pytorch_lightning.utilities.cloud_io import get_filesystem -from unittests.helpers import BoringModel -from unittests.helpers.advanced_models import BasicGAN, ParityModuleRNN -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.advanced_models import BasicGAN, ParityModuleRNN +from unittests_pl.helpers.runif import RunIf @pytest.mark.parametrize("modelclass", [BoringModel, ParityModuleRNN, BasicGAN]) diff --git a/test/unittests/models/test_tpu.py b/test/unittests_pl/models/test_tpu.py similarity index 98% rename from test/unittests/models/test_tpu.py rename to test/unittests_pl/models/test_tpu.py index 2ee217447c01e..3f29a6d6dc95f 100644 --- a/test/unittests/models/test_tpu.py +++ b/test/unittests_pl/models/test_tpu.py @@ -19,8 +19,8 @@ import torch from torch.utils.data import DataLoader -import unittests.helpers.pipelines as tpipes -import unittests.helpers.utils as tutils +import unittests_pl.helpers.pipelines as tpipes +import unittests_pl.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.accelerators import TPUAccelerator from pytorch_lightning.callbacks import EarlyStopping @@ -29,9 +29,9 @@ from pytorch_lightning.utilities import _TPU_AVAILABLE from pytorch_lightning.utilities.distributed import ReduceOp from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers import BoringModel, RandomDataset -from unittests.helpers.runif import RunIf -from unittests.helpers.utils import pl_multi_process_test +from unittests_pl.helpers import BoringModel, RandomDataset +from unittests_pl.helpers.runif import RunIf +from unittests_pl.helpers.utils import pl_multi_process_test if _TPU_AVAILABLE: import torch_xla diff --git a/test/unittests/overrides/__init__.py b/test/unittests_pl/overrides/__init__.py similarity index 100% rename from test/unittests/overrides/__init__.py rename to test/unittests_pl/overrides/__init__.py diff --git a/test/unittests/overrides/test_base.py b/test/unittests_pl/overrides/test_base.py similarity index 96% rename from test/unittests/overrides/test_base.py rename to test/unittests_pl/overrides/test_base.py index b1847e20c5da2..4da541677a2ff 100644 --- a/test/unittests/overrides/test_base.py +++ b/test/unittests_pl/overrides/test_base.py @@ -20,7 +20,7 @@ _LightningPrecisionModuleWrapperBase, unwrap_lightning_module, ) -from unittests.helpers import BoringModel +from unittests_pl.helpers import BoringModel @pytest.mark.parametrize("wrapper_class", [_LightningModuleWrapperBase, _LightningPrecisionModuleWrapperBase]) diff --git a/test/unittests/overrides/test_data_parallel.py b/test/unittests_pl/overrides/test_data_parallel.py similarity index 98% rename from test/unittests/overrides/test_data_parallel.py rename to test/unittests_pl/overrides/test_data_parallel.py index d415e11b22aa9..375cd22e5dba7 100644 --- a/test/unittests/overrides/test_data_parallel.py +++ b/test/unittests_pl/overrides/test_data_parallel.py @@ -26,8 +26,8 @@ unsqueeze_scalar_tensor, ) from pytorch_lightning.trainer.states import RunningStage -from unittests.helpers import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.runif import RunIf @pytest.mark.parametrize("wrapper_class", [LightningParallelModule, LightningDistributedModule]) diff --git a/test/unittests/overrides/test_distributed.py b/test/unittests_pl/overrides/test_distributed.py similarity index 100% rename from test/unittests/overrides/test_distributed.py rename to test/unittests_pl/overrides/test_distributed.py diff --git a/test/unittests/plugins/__init__.py b/test/unittests_pl/plugins/__init__.py similarity index 100% rename from test/unittests/plugins/__init__.py rename to test/unittests_pl/plugins/__init__.py diff --git a/test/unittests/plugins/environments/__init__.py b/test/unittests_pl/plugins/environments/__init__.py similarity index 100% rename from test/unittests/plugins/environments/__init__.py rename to test/unittests_pl/plugins/environments/__init__.py diff --git a/test/unittests/plugins/environments/test_kubeflow_environment.py b/test/unittests_pl/plugins/environments/test_kubeflow_environment.py similarity index 100% rename from test/unittests/plugins/environments/test_kubeflow_environment.py rename to test/unittests_pl/plugins/environments/test_kubeflow_environment.py diff --git a/test/unittests/plugins/environments/test_lightning_environment.py b/test/unittests_pl/plugins/environments/test_lightning_environment.py similarity index 100% rename from test/unittests/plugins/environments/test_lightning_environment.py rename to test/unittests_pl/plugins/environments/test_lightning_environment.py diff --git a/test/unittests/plugins/environments/test_lsf_environment.py b/test/unittests_pl/plugins/environments/test_lsf_environment.py similarity index 100% rename from test/unittests/plugins/environments/test_lsf_environment.py rename to test/unittests_pl/plugins/environments/test_lsf_environment.py diff --git a/test/unittests/plugins/environments/test_slurm_environment.py b/test/unittests_pl/plugins/environments/test_slurm_environment.py similarity index 100% rename from test/unittests/plugins/environments/test_slurm_environment.py rename to test/unittests_pl/plugins/environments/test_slurm_environment.py diff --git a/test/unittests/plugins/environments/test_torchelastic_environment.py b/test/unittests_pl/plugins/environments/test_torchelastic_environment.py similarity index 98% rename from test/unittests/plugins/environments/test_torchelastic_environment.py rename to test/unittests_pl/plugins/environments/test_torchelastic_environment.py index c590486ba11f1..26f4e2d53002a 100644 --- a/test/unittests/plugins/environments/test_torchelastic_environment.py +++ b/test/unittests_pl/plugins/environments/test_torchelastic_environment.py @@ -18,7 +18,7 @@ import pytest from pytorch_lightning.plugins.environments import TorchElasticEnvironment -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.runif import RunIf @mock.patch.dict(os.environ, {}, clear=True) diff --git a/test/unittests/plugins/environments/torch_elastic_deadlock.py b/test/unittests_pl/plugins/environments/torch_elastic_deadlock.py similarity index 95% rename from test/unittests/plugins/environments/torch_elastic_deadlock.py rename to test/unittests_pl/plugins/environments/torch_elastic_deadlock.py index 4913f33bafd38..889181890b164 100644 --- a/test/unittests/plugins/environments/torch_elastic_deadlock.py +++ b/test/unittests_pl/plugins/environments/torch_elastic_deadlock.py @@ -5,7 +5,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.strategies.ddp import DDPStrategy from pytorch_lightning.utilities.exceptions import DeadlockDetectedException -from unittests.helpers.boring_model import BoringModel +from unittests_pl.helpers.boring_model import BoringModel if os.getenv("PL_RUN_STANDALONE_TESTS", "0") == "1" and os.getenv("PL_RECONCILE_PROCESS", "0") == "1": diff --git a/test/unittests/plugins/precision/__init__.py b/test/unittests_pl/plugins/precision/__init__.py similarity index 100% rename from test/unittests/plugins/precision/__init__.py rename to test/unittests_pl/plugins/precision/__init__.py diff --git a/test/unittests/plugins/precision/hpu/ops_bf16.txt b/test/unittests_pl/plugins/precision/hpu/ops_bf16.txt similarity index 100% rename from test/unittests/plugins/precision/hpu/ops_bf16.txt rename to test/unittests_pl/plugins/precision/hpu/ops_bf16.txt diff --git a/test/unittests/plugins/precision/hpu/ops_fp32.txt b/test/unittests_pl/plugins/precision/hpu/ops_fp32.txt similarity index 100% rename from test/unittests/plugins/precision/hpu/ops_fp32.txt rename to test/unittests_pl/plugins/precision/hpu/ops_fp32.txt diff --git a/test/unittests/plugins/precision/hpu/test_hpu.py b/test/unittests_pl/plugins/precision/hpu/test_hpu.py similarity index 96% rename from test/unittests/plugins/precision/hpu/test_hpu.py rename to test/unittests_pl/plugins/precision/hpu/test_hpu.py index 7be34493e59da..f13ac8116abeb 100644 --- a/test/unittests/plugins/precision/hpu/test_hpu.py +++ b/test/unittests_pl/plugins/precision/hpu/test_hpu.py @@ -19,8 +19,8 @@ from pytorch_lightning import Callback, LightningModule, Trainer from pytorch_lightning.plugins import HPUPrecisionPlugin from pytorch_lightning.strategies.single_hpu import SingleHPUStrategy -from unittests.helpers.boring_model import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringModel +from unittests_pl.helpers.runif import RunIf @pytest.fixture diff --git a/test/unittests/plugins/precision/test_deepspeed_precision.py b/test/unittests_pl/plugins/precision/test_deepspeed_precision.py similarity index 100% rename from test/unittests/plugins/precision/test_deepspeed_precision.py rename to test/unittests_pl/plugins/precision/test_deepspeed_precision.py diff --git a/test/unittests/plugins/precision/test_sharded_precision.py b/test/unittests_pl/plugins/precision/test_sharded_precision.py similarity index 96% rename from test/unittests/plugins/precision/test_sharded_precision.py rename to test/unittests_pl/plugins/precision/test_sharded_precision.py index 3734d1ca3c1e9..64540f194e26b 100644 --- a/test/unittests/plugins/precision/test_sharded_precision.py +++ b/test/unittests_pl/plugins/precision/test_sharded_precision.py @@ -17,7 +17,7 @@ from pytorch_lightning.plugins import ShardedNativeMixedPrecisionPlugin from pytorch_lightning.utilities import _FAIRSCALE_AVAILABLE -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.runif import RunIf ShardedGradScaler = None if _FAIRSCALE_AVAILABLE: diff --git a/test/unittests/plugins/precision/test_tpu_bf16_plugin.py b/test/unittests_pl/plugins/precision/test_tpu_bf16_plugin.py similarity index 100% rename from test/unittests/plugins/precision/test_tpu_bf16_plugin.py rename to test/unittests_pl/plugins/precision/test_tpu_bf16_plugin.py diff --git a/test/unittests/plugins/test_amp_plugins.py b/test/unittests_pl/plugins/test_amp_plugins.py similarity index 99% rename from test/unittests/plugins/test_amp_plugins.py rename to test/unittests_pl/plugins/test_amp_plugins.py index 36cffc5931e1d..7c511a773fa14 100644 --- a/test/unittests/plugins/test_amp_plugins.py +++ b/test/unittests_pl/plugins/test_amp_plugins.py @@ -21,8 +21,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.plugins import ApexMixedPrecisionPlugin, NativeMixedPrecisionPlugin from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.runif import RunIf class MyNativeAMP(NativeMixedPrecisionPlugin): diff --git a/test/unittests/plugins/test_checkpoint_io_plugin.py b/test/unittests_pl/plugins/test_checkpoint_io_plugin.py similarity index 98% rename from test/unittests/plugins/test_checkpoint_io_plugin.py rename to test/unittests_pl/plugins/test_checkpoint_io_plugin.py index 1918428433c2d..16b0b19ac76de 100644 --- a/test/unittests/plugins/test_checkpoint_io_plugin.py +++ b/test/unittests_pl/plugins/test_checkpoint_io_plugin.py @@ -22,7 +22,7 @@ from pytorch_lightning.plugins import CheckpointIO from pytorch_lightning.strategies import SingleDeviceStrategy from pytorch_lightning.utilities.types import _PATH -from unittests.helpers.boring_model import BoringModel +from unittests_pl.helpers.boring_model import BoringModel class CustomCheckpointIO(CheckpointIO): diff --git a/test/unittests/plugins/test_cluster_integration.py b/test/unittests_pl/plugins/test_cluster_integration.py similarity index 99% rename from test/unittests/plugins/test_cluster_integration.py rename to test/unittests_pl/plugins/test_cluster_integration.py index d34643779bdb5..30142777f077b 100644 --- a/test/unittests/plugins/test_cluster_integration.py +++ b/test/unittests_pl/plugins/test_cluster_integration.py @@ -21,7 +21,7 @@ from pytorch_lightning.plugins.environments import LightningEnvironment, SLURMEnvironment, TorchElasticEnvironment from pytorch_lightning.strategies import DDP2Strategy, DDPShardedStrategy, DDPStrategy, DeepSpeedStrategy from pytorch_lightning.utilities.rank_zero import rank_zero_only -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.runif import RunIf def environment_combinations(): diff --git a/test/unittests/plugins/test_double_plugin.py b/test/unittests_pl/plugins/test_double_plugin.py similarity index 97% rename from test/unittests/plugins/test_double_plugin.py rename to test/unittests_pl/plugins/test_double_plugin.py index 0d7731b6afa88..510bd4e199cda 100644 --- a/test/unittests/plugins/test_double_plugin.py +++ b/test/unittests_pl/plugins/test_double_plugin.py @@ -20,8 +20,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.plugins import DoublePrecisionPlugin -from unittests.helpers.boring_model import BoringModel, RandomDataset -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringModel, RandomDataset +from unittests_pl.helpers.runif import RunIf class RandomFloatIntDataset(Dataset): diff --git a/test/unittests/profiler/__init__.py b/test/unittests_pl/profiler/__init__.py similarity index 100% rename from test/unittests/profiler/__init__.py rename to test/unittests_pl/profiler/__init__.py diff --git a/test/unittests/profiler/test_profiler.py b/test/unittests_pl/profiler/test_profiler.py similarity index 99% rename from test/unittests/profiler/test_profiler.py rename to test/unittests_pl/profiler/test_profiler.py index 35081dc248f34..cb5ab755c2b2f 100644 --- a/test/unittests/profiler/test_profiler.py +++ b/test/unittests_pl/profiler/test_profiler.py @@ -29,8 +29,8 @@ from pytorch_lightning.profiler.pytorch import RegisterRecordFunction, warning_cache from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.imports import _KINETO_AVAILABLE -from unittests.helpers import BoringModel, ManualOptimBoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel, ManualOptimBoringModel +from unittests_pl.helpers.runif import RunIf PROFILER_OVERHEAD_MAX_TOLERANCE = 0.0005 diff --git a/test/unittests/profiler/test_xla_profiler.py b/test/unittests_pl/profiler/test_xla_profiler.py similarity index 95% rename from test/unittests/profiler/test_xla_profiler.py rename to test/unittests_pl/profiler/test_xla_profiler.py index cac7ac711f70e..6a6993f81d5c3 100644 --- a/test/unittests/profiler/test_xla_profiler.py +++ b/test/unittests_pl/profiler/test_xla_profiler.py @@ -19,8 +19,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.profiler import XLAProfiler from pytorch_lightning.utilities import _TPU_AVAILABLE -from unittests.helpers import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.runif import RunIf if _TPU_AVAILABLE: import torch_xla.debug.profiler as xp diff --git a/test/unittests/strategies/__init__.py b/test/unittests_pl/strategies/__init__.py similarity index 100% rename from test/unittests/strategies/__init__.py rename to test/unittests_pl/strategies/__init__.py diff --git a/test/unittests/strategies/ddp_model.py b/test/unittests_pl/strategies/ddp_model.py similarity index 93% rename from test/unittests/strategies/ddp_model.py rename to test/unittests_pl/strategies/ddp_model.py index 28bd23a51d152..aad3ac17dff4f 100644 --- a/test/unittests/strategies/ddp_model.py +++ b/test/unittests_pl/strategies/ddp_model.py @@ -18,8 +18,8 @@ import torch from pytorch_lightning import seed_everything, Trainer -from unittests.helpers.datamodules import ClassifDataModule -from unittests.helpers.simple_models import ClassificationModel +from unittests_pl.helpers.datamodules import ClassifDataModule +from unittests_pl.helpers.simple_models import ClassificationModel def main(): diff --git a/test/unittests/strategies/test_bagua_strategy.py b/test/unittests_pl/strategies/test_bagua_strategy.py similarity index 97% rename from test/unittests/strategies/test_bagua_strategy.py rename to test/unittests_pl/strategies/test_bagua_strategy.py index 6fcbd81768f85..16aceaa9f0c32 100644 --- a/test/unittests/strategies/test_bagua_strategy.py +++ b/test/unittests_pl/strategies/test_bagua_strategy.py @@ -20,8 +20,8 @@ from pytorch_lightning.strategies import BaguaStrategy from pytorch_lightning.trainer.states import TrainerFn from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers.boring_model import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringModel +from unittests_pl.helpers.runif import RunIf class BoringModel4QAdam(BoringModel): diff --git a/test/unittests/strategies/test_collaborative.py b/test/unittests_pl/strategies/test_collaborative.py similarity index 99% rename from test/unittests/strategies/test_collaborative.py rename to test/unittests_pl/strategies/test_collaborative.py index 3622d597bbb06..6919a27e6ca42 100644 --- a/test/unittests/strategies/test_collaborative.py +++ b/test/unittests_pl/strategies/test_collaborative.py @@ -17,8 +17,8 @@ from pytorch_lightning.utilities import _HIVEMIND_AVAILABLE from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.types import STEP_OUTPUT -from unittests.helpers import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.runif import RunIf if _HIVEMIND_AVAILABLE: import hivemind diff --git a/test/unittests/strategies/test_common.py b/test/unittests_pl/strategies/test_common.py similarity index 90% rename from test/unittests/strategies/test_common.py rename to test/unittests_pl/strategies/test_common.py index 3296e1c0436be..68f7aeda233ea 100644 --- a/test/unittests/strategies/test_common.py +++ b/test/unittests_pl/strategies/test_common.py @@ -14,14 +14,14 @@ import pytest import torch -import unittests.helpers.utils as tutils +import unittests_pl.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.strategies import DDPStrategy from pytorch_lightning.utilities.seed import seed_everything -from unittests.helpers.boring_model import BoringModel -from unittests.helpers.datamodules import ClassifDataModule -from unittests.helpers.runif import RunIf -from unittests.strategies.test_dp import CustomClassificationModelDP +from unittests_pl.helpers.boring_model import BoringModel +from unittests_pl.helpers.datamodules import ClassifDataModule +from unittests_pl.helpers.runif import RunIf +from unittests_pl.strategies.test_dp import CustomClassificationModelDP @pytest.mark.parametrize( diff --git a/test/unittests/strategies/test_custom_plugin.py b/test/unittests_pl/strategies/test_custom_plugin.py similarity index 97% rename from test/unittests/strategies/test_custom_plugin.py rename to test/unittests_pl/strategies/test_custom_plugin.py index b91423ff01218..717a0b0ad25cd 100644 --- a/test/unittests/strategies/test_custom_plugin.py +++ b/test/unittests_pl/strategies/test_custom_plugin.py @@ -19,7 +19,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.strategies import SingleDeviceStrategy -from unittests.helpers import BoringModel +from unittests_pl.helpers import BoringModel @pytest.mark.parametrize("restore_optimizer_and_schedulers", [True, False]) diff --git a/test/unittests/strategies/test_ddp.py b/test/unittests_pl/strategies/test_ddp.py similarity index 97% rename from test/unittests/strategies/test_ddp.py rename to test/unittests_pl/strategies/test_ddp.py index 94fc43c386138..615af88cbf1f3 100644 --- a/test/unittests/strategies/test_ddp.py +++ b/test/unittests_pl/strategies/test_ddp.py @@ -24,10 +24,10 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import Callback from pytorch_lightning.strategies import DDPStrategy -from unittests.helpers.boring_model import BoringModel -from unittests.helpers.runif import RunIf -from unittests.strategies import ddp_model -from unittests.utilities.distributed import call_training_script +from unittests_pl.helpers.boring_model import BoringModel +from unittests_pl.helpers.runif import RunIf +from unittests_pl.strategies import ddp_model +from unittests_pl.utilities.distributed import call_training_script CLI_ARGS = "--max_epochs 1 --accelerator gpu --devices 2 --strategy ddp" diff --git a/test/unittests/strategies/test_ddp_fully_sharded_native.py b/test/unittests_pl/strategies/test_ddp_fully_sharded_native.py similarity index 98% rename from test/unittests/strategies/test_ddp_fully_sharded_native.py rename to test/unittests_pl/strategies/test_ddp_fully_sharded_native.py index 5775351b143ed..ce1fde8188415 100644 --- a/test/unittests/strategies/test_ddp_fully_sharded_native.py +++ b/test/unittests_pl/strategies/test_ddp_fully_sharded_native.py @@ -10,8 +10,8 @@ from pytorch_lightning.strategies import DDPFullyShardedNativeStrategy from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.imports import _TORCH_GREATER_EQUAL_1_12 -from unittests.helpers.boring_model import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringModel +from unittests_pl.helpers.runif import RunIf if _TORCH_GREATER_EQUAL_1_12: from torch.distributed.fsdp.fully_sharded_data_parallel import FullyShardedDataParallel diff --git a/test/unittests/strategies/test_ddp_fully_sharded_with_full_state_dict.py b/test/unittests_pl/strategies/test_ddp_fully_sharded_with_full_state_dict.py similarity index 98% rename from test/unittests/strategies/test_ddp_fully_sharded_with_full_state_dict.py rename to test/unittests_pl/strategies/test_ddp_fully_sharded_with_full_state_dict.py index 2d4ca824326be..c933ed17bf21b 100644 --- a/test/unittests/strategies/test_ddp_fully_sharded_with_full_state_dict.py +++ b/test/unittests_pl/strategies/test_ddp_fully_sharded_with_full_state_dict.py @@ -11,8 +11,8 @@ from pytorch_lightning.strategies import DDPFullyShardedStrategy from pytorch_lightning.utilities import _FAIRSCALE_FULLY_SHARDED_AVAILABLE from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers.boring_model import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringModel +from unittests_pl.helpers.runif import RunIf if _FAIRSCALE_FULLY_SHARDED_AVAILABLE: from fairscale.nn import FullyShardedDataParallel, wrap diff --git a/test/unittests/strategies/test_ddp_spawn.py b/test/unittests_pl/strategies/test_ddp_spawn.py similarity index 88% rename from test/unittests/strategies/test_ddp_spawn.py rename to test/unittests_pl/strategies/test_ddp_spawn.py index 8c1740de54e51..4b34058eff99b 100644 --- a/test/unittests/strategies/test_ddp_spawn.py +++ b/test/unittests_pl/strategies/test_ddp_spawn.py @@ -11,14 +11,14 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import unittests.helpers.pipelines as tpipes -import unittests.helpers.utils as tutils +import unittests_pl.helpers.pipelines as tpipes +import unittests_pl.helpers.utils as tutils from pytorch_lightning.callbacks import EarlyStopping from pytorch_lightning.trainer import Trainer -from unittests.helpers import BoringModel -from unittests.helpers.datamodules import ClassifDataModule -from unittests.helpers.runif import RunIf -from unittests.helpers.simple_models import ClassificationModel +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.datamodules import ClassifDataModule +from unittests_pl.helpers.runif import RunIf +from unittests_pl.helpers.simple_models import ClassificationModel @RunIf(min_cuda_gpus=2) diff --git a/test/unittests/strategies/test_ddp_spawn_strategy.py b/test/unittests_pl/strategies/test_ddp_spawn_strategy.py similarity index 98% rename from test/unittests/strategies/test_ddp_spawn_strategy.py rename to test/unittests_pl/strategies/test_ddp_spawn_strategy.py index bb94acb92b01f..df0c672964bf8 100644 --- a/test/unittests/strategies/test_ddp_spawn_strategy.py +++ b/test/unittests_pl/strategies/test_ddp_spawn_strategy.py @@ -22,8 +22,8 @@ from pytorch_lightning.strategies import DDPSpawnStrategy from pytorch_lightning.strategies.launchers.spawn import _SpawnLauncher from pytorch_lightning.trainer.states import TrainerFn -from unittests.helpers.boring_model import BoringDataModule, BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringDataModule, BoringModel +from unittests_pl.helpers.runif import RunIf class BoringModelDDPCPU(BoringModel): diff --git a/test/unittests/strategies/test_ddp_strategy.py b/test/unittests_pl/strategies/test_ddp_strategy.py similarity index 98% rename from test/unittests/strategies/test_ddp_strategy.py rename to test/unittests_pl/strategies/test_ddp_strategy.py index b4b9e7f34e361..6921c1aa5fe1a 100644 --- a/test/unittests/strategies/test_ddp_strategy.py +++ b/test/unittests_pl/strategies/test_ddp_strategy.py @@ -22,8 +22,8 @@ from pytorch_lightning.plugins.environments import ClusterEnvironment, LightningEnvironment from pytorch_lightning.strategies import DDPStrategy from pytorch_lightning.trainer.states import TrainerFn -from unittests.helpers.boring_model import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringModel +from unittests_pl.helpers.runif import RunIf class BoringModelGPU(BoringModel): diff --git a/test/unittests/strategies/test_ddp_strategy_with_comm_hook.py b/test/unittests_pl/strategies/test_ddp_strategy_with_comm_hook.py similarity index 98% rename from test/unittests/strategies/test_ddp_strategy_with_comm_hook.py rename to test/unittests_pl/strategies/test_ddp_strategy_with_comm_hook.py index 0ae4ae6c6b2ef..dd204887c484a 100644 --- a/test/unittests/strategies/test_ddp_strategy_with_comm_hook.py +++ b/test/unittests_pl/strategies/test_ddp_strategy_with_comm_hook.py @@ -19,8 +19,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.strategies import DDPSpawnStrategy, DDPStrategy from pytorch_lightning.utilities import _TORCH_GREATER_EQUAL_1_10 -from unittests.helpers import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.runif import RunIf if torch.distributed.is_available(): from torch.distributed.algorithms.ddp_comm_hooks import default_hooks as default diff --git a/test/unittests/strategies/test_deepspeed_strategy.py b/test/unittests_pl/strategies/test_deepspeed_strategy.py similarity index 99% rename from test/unittests/strategies/test_deepspeed_strategy.py rename to test/unittests_pl/strategies/test_deepspeed_strategy.py index bda5bb427d018..58c846dc1b4d2 100644 --- a/test/unittests/strategies/test_deepspeed_strategy.py +++ b/test/unittests_pl/strategies/test_deepspeed_strategy.py @@ -38,9 +38,9 @@ _DEEPSPEED_GREATER_EQUAL_0_6, ) from pytorch_lightning.utilities.meta import init_meta_context -from unittests.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset -from unittests.helpers.datamodules import ClassifDataModule -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset +from unittests_pl.helpers.datamodules import ClassifDataModule +from unittests_pl.helpers.runif import RunIf if _DEEPSPEED_AVAILABLE: import deepspeed diff --git a/test/unittests/strategies/test_dp.py b/test/unittests_pl/strategies/test_dp.py similarity index 95% rename from test/unittests/strategies/test_dp.py rename to test/unittests_pl/strategies/test_dp.py index d8342e27c3456..b965802b0c51a 100644 --- a/test/unittests/strategies/test_dp.py +++ b/test/unittests_pl/strategies/test_dp.py @@ -19,15 +19,15 @@ from torch.utils.data import DataLoader import pytorch_lightning as pl -import unittests.helpers.pipelines as tpipes -import unittests.helpers.utils as tutils +import unittests_pl.helpers.pipelines as tpipes +import unittests_pl.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.callbacks import EarlyStopping from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers import BoringModel, RandomDataset -from unittests.helpers.datamodules import ClassifDataModule -from unittests.helpers.runif import RunIf -from unittests.helpers.simple_models import ClassificationModel +from unittests_pl.helpers import BoringModel, RandomDataset +from unittests_pl.helpers.datamodules import ClassifDataModule +from unittests_pl.helpers.runif import RunIf +from unittests_pl.helpers.simple_models import ClassificationModel class CustomClassificationModelDP(ClassificationModel): diff --git a/test/unittests/strategies/test_sharded_strategy.py b/test/unittests_pl/strategies/test_sharded_strategy.py similarity index 99% rename from test/unittests/strategies/test_sharded_strategy.py rename to test/unittests_pl/strategies/test_sharded_strategy.py index 3673b467ba775..40bfbd3b7a52c 100644 --- a/test/unittests/strategies/test_sharded_strategy.py +++ b/test/unittests_pl/strategies/test_sharded_strategy.py @@ -9,8 +9,8 @@ from pytorch_lightning.strategies import DDPShardedStrategy, DDPSpawnShardedStrategy from pytorch_lightning.trainer.states import TrainerFn from pytorch_lightning.utilities import _FAIRSCALE_AVAILABLE -from unittests.helpers.boring_model import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringModel +from unittests_pl.helpers.runif import RunIf if _FAIRSCALE_AVAILABLE: from fairscale.nn.data_parallel.sharded_ddp import ShardedDataParallel diff --git a/test/unittests/strategies/test_single_device_strategy.py b/test/unittests_pl/strategies/test_single_device_strategy.py similarity index 96% rename from test/unittests/strategies/test_single_device_strategy.py rename to test/unittests_pl/strategies/test_single_device_strategy.py index 408bb22347048..8e46f9e1e0842 100644 --- a/test/unittests/strategies/test_single_device_strategy.py +++ b/test/unittests_pl/strategies/test_single_device_strategy.py @@ -18,8 +18,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.core.optimizer import LightningOptimizer from pytorch_lightning.strategies import SingleDeviceStrategy -from unittests.helpers.boring_model import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringModel +from unittests_pl.helpers.runif import RunIf def test_single_cpu(): diff --git a/test/unittests/strategies/test_strategy_registry.py b/test/unittests_pl/strategies/test_strategy_registry.py similarity index 99% rename from test/unittests/strategies/test_strategy_registry.py rename to test/unittests_pl/strategies/test_strategy_registry.py index 3cbfaa2c9bbed..6399a8ba1fc71 100644 --- a/test/unittests/strategies/test_strategy_registry.py +++ b/test/unittests_pl/strategies/test_strategy_registry.py @@ -25,7 +25,7 @@ StrategyRegistry, TPUSpawnStrategy, ) -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.runif import RunIf def test_strategy_registry_with_new_strategy(): diff --git a/test/unittests/strategies/test_tpu_spawn.py b/test/unittests_pl/strategies/test_tpu_spawn.py similarity index 93% rename from test/unittests/strategies/test_tpu_spawn.py rename to test/unittests_pl/strategies/test_tpu_spawn.py index b63bf4bfccb6a..86d841aba7f5a 100644 --- a/test/unittests/strategies/test_tpu_spawn.py +++ b/test/unittests_pl/strategies/test_tpu_spawn.py @@ -22,10 +22,10 @@ from pytorch_lightning import Trainer from pytorch_lightning.strategies import TPUSpawnStrategy from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers.boring_model import BoringModel, RandomDataset -from unittests.helpers.dataloaders import CustomNotImplementedErrorDataloader -from unittests.helpers.runif import RunIf -from unittests.helpers.utils import pl_multi_process_test +from unittests_pl.helpers.boring_model import BoringModel, RandomDataset +from unittests_pl.helpers.dataloaders import CustomNotImplementedErrorDataloader +from unittests_pl.helpers.runif import RunIf +from unittests_pl.helpers.utils import pl_multi_process_test class BoringModelNoDataloaders(BoringModel): diff --git a/test/unittests/trainer/__init__.py b/test/unittests_pl/trainer/__init__.py similarity index 100% rename from test/unittests/trainer/__init__.py rename to test/unittests_pl/trainer/__init__.py diff --git a/test/unittests/trainer/connectors/__init__.py b/test/unittests_pl/trainer/connectors/__init__.py similarity index 100% rename from test/unittests/trainer/connectors/__init__.py rename to test/unittests_pl/trainer/connectors/__init__.py diff --git a/test/unittests/trainer/connectors/test_callback_connector.py b/test/unittests_pl/trainer/connectors/test_callback_connector.py similarity index 99% rename from test/unittests/trainer/connectors/test_callback_connector.py rename to test/unittests_pl/trainer/connectors/test_callback_connector.py index 03d4f6ec54bac..24e0163760c3c 100644 --- a/test/unittests/trainer/connectors/test_callback_connector.py +++ b/test/unittests_pl/trainer/connectors/test_callback_connector.py @@ -30,7 +30,7 @@ ) from pytorch_lightning.trainer.connectors.callback_connector import CallbackConnector from pytorch_lightning.utilities.imports import _PYTHON_GREATER_EQUAL_3_8_0 -from unittests.helpers import BoringModel +from unittests_pl.helpers import BoringModel def test_checkpoint_callbacks_are_last(tmpdir): diff --git a/test/unittests/trainer/connectors/test_checkpoint_connector.py b/test/unittests_pl/trainer/connectors/test_checkpoint_connector.py similarity index 99% rename from test/unittests/trainer/connectors/test_checkpoint_connector.py rename to test/unittests_pl/trainer/connectors/test_checkpoint_connector.py index 7906ec956dcd4..1bfded60d2374 100644 --- a/test/unittests/trainer/connectors/test_checkpoint_connector.py +++ b/test/unittests_pl/trainer/connectors/test_checkpoint_connector.py @@ -22,7 +22,7 @@ from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.plugins.environments import SLURMEnvironment from pytorch_lightning.trainer.states import TrainerFn -from unittests.helpers import BoringModel +from unittests_pl.helpers import BoringModel # TODO: remove HPCHookedModel in v1.8 diff --git a/test/unittests/trainer/connectors/test_data_connector.py b/test/unittests_pl/trainer/connectors/test_data_connector.py similarity index 99% rename from test/unittests/trainer/connectors/test_data_connector.py rename to test/unittests_pl/trainer/connectors/test_data_connector.py index 090e43914a12c..305de4388aa83 100644 --- a/test/unittests/trainer/connectors/test_data_connector.py +++ b/test/unittests_pl/trainer/connectors/test_data_connector.py @@ -27,9 +27,9 @@ from pytorch_lightning.utilities.data import _update_dataloader from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.warnings import PossibleUserWarning -from unittests.helpers.boring_model import BoringDataModule, BoringModel, RandomDataset -from unittests.helpers.runif import RunIf -from unittests.helpers.utils import no_warning_call +from unittests_pl.helpers.boring_model import BoringDataModule, BoringModel, RandomDataset +from unittests_pl.helpers.runif import RunIf +from unittests_pl.helpers.utils import no_warning_call @RunIf(skip_windows=True) diff --git a/test/unittests/trainer/connectors/test_signal_connector.py b/test/unittests_pl/trainer/connectors/test_signal_connector.py similarity index 98% rename from test/unittests/trainer/connectors/test_signal_connector.py rename to test/unittests_pl/trainer/connectors/test_signal_connector.py index d1b3e4d474cae..967c32a210225 100644 --- a/test/unittests/trainer/connectors/test_signal_connector.py +++ b/test/unittests_pl/trainer/connectors/test_signal_connector.py @@ -23,8 +23,8 @@ from pytorch_lightning.plugins.environments import SLURMEnvironment from pytorch_lightning.trainer.connectors.signal_connector import SignalConnector from pytorch_lightning.utilities.exceptions import ExitGracefullyException -from unittests.helpers import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.runif import RunIf @RunIf(skip_windows=True) diff --git a/test/unittests/trainer/dynamic_args/__init__.py b/test/unittests_pl/trainer/dynamic_args/__init__.py similarity index 100% rename from test/unittests/trainer/dynamic_args/__init__.py rename to test/unittests_pl/trainer/dynamic_args/__init__.py diff --git a/test/unittests/trainer/dynamic_args/test_multiple_eval_dataloaders.py b/test/unittests_pl/trainer/dynamic_args/test_multiple_eval_dataloaders.py similarity index 98% rename from test/unittests/trainer/dynamic_args/test_multiple_eval_dataloaders.py rename to test/unittests_pl/trainer/dynamic_args/test_multiple_eval_dataloaders.py index 0e48968710ae0..3a32cf43cd7d5 100644 --- a/test/unittests/trainer/dynamic_args/test_multiple_eval_dataloaders.py +++ b/test/unittests_pl/trainer/dynamic_args/test_multiple_eval_dataloaders.py @@ -15,7 +15,7 @@ from torch.utils.data import Dataset from pytorch_lightning import Trainer -from unittests.helpers.boring_model import BoringModel +from unittests_pl.helpers.boring_model import BoringModel class RandomDatasetA(Dataset): diff --git a/test/unittests/trainer/flags/__init__.py b/test/unittests_pl/trainer/flags/__init__.py similarity index 100% rename from test/unittests/trainer/flags/__init__.py rename to test/unittests_pl/trainer/flags/__init__.py diff --git a/test/unittests/trainer/flags/test_check_val_every_n_epoch.py b/test/unittests_pl/trainer/flags/test_check_val_every_n_epoch.py similarity index 97% rename from test/unittests/trainer/flags/test_check_val_every_n_epoch.py rename to test/unittests_pl/trainer/flags/test_check_val_every_n_epoch.py index 8ff7c9c74ac40..98046b0f3f8d2 100644 --- a/test/unittests/trainer/flags/test_check_val_every_n_epoch.py +++ b/test/unittests_pl/trainer/flags/test_check_val_every_n_epoch.py @@ -15,7 +15,7 @@ from torch.utils.data import DataLoader from pytorch_lightning.trainer.trainer import Trainer -from unittests.helpers import BoringModel, RandomDataset +from unittests_pl.helpers import BoringModel, RandomDataset @pytest.mark.parametrize( diff --git a/test/unittests/trainer/flags/test_env_vars.py b/test/unittests_pl/trainer/flags/test_env_vars.py similarity index 100% rename from test/unittests/trainer/flags/test_env_vars.py rename to test/unittests_pl/trainer/flags/test_env_vars.py diff --git a/test/unittests/trainer/flags/test_fast_dev_run.py b/test/unittests_pl/trainer/flags/test_fast_dev_run.py similarity index 99% rename from test/unittests/trainer/flags/test_fast_dev_run.py rename to test/unittests_pl/trainer/flags/test_fast_dev_run.py index 16a1db328148e..c46864dc021ac 100644 --- a/test/unittests/trainer/flags/test_fast_dev_run.py +++ b/test/unittests_pl/trainer/flags/test_fast_dev_run.py @@ -7,7 +7,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.loggers.logger import DummyLogger -from unittests.helpers import BoringModel +from unittests_pl.helpers import BoringModel @pytest.mark.parametrize("tuner_alg", ["batch size scaler", "learning rate finder"]) diff --git a/test/unittests/trainer/flags/test_limit_batches.py b/test/unittests_pl/trainer/flags/test_limit_batches.py similarity index 98% rename from test/unittests/trainer/flags/test_limit_batches.py rename to test/unittests_pl/trainer/flags/test_limit_batches.py index da50a1d896ca2..6a380b5606fcb 100644 --- a/test/unittests/trainer/flags/test_limit_batches.py +++ b/test/unittests_pl/trainer/flags/test_limit_batches.py @@ -17,7 +17,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.trainer.states import RunningStage -from unittests.helpers.boring_model import BoringModel +from unittests_pl.helpers.boring_model import BoringModel def test_num_dataloader_batches(tmpdir): diff --git a/test/unittests/trainer/flags/test_min_max_epochs.py b/test/unittests_pl/trainer/flags/test_min_max_epochs.py similarity index 96% rename from test/unittests/trainer/flags/test_min_max_epochs.py rename to test/unittests_pl/trainer/flags/test_min_max_epochs.py index f31e6a9c7a6eb..7f05726416542 100644 --- a/test/unittests/trainer/flags/test_min_max_epochs.py +++ b/test/unittests_pl/trainer/flags/test_min_max_epochs.py @@ -2,7 +2,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.utilities.warnings import PossibleUserWarning -from unittests.helpers import BoringModel +from unittests_pl.helpers import BoringModel @pytest.mark.parametrize( diff --git a/test/unittests/trainer/flags/test_overfit_batches.py b/test/unittests_pl/trainer/flags/test_overfit_batches.py similarity index 97% rename from test/unittests/trainer/flags/test_overfit_batches.py rename to test/unittests_pl/trainer/flags/test_overfit_batches.py index 3433717bd4566..0ea46182ce0a4 100644 --- a/test/unittests/trainer/flags/test_overfit_batches.py +++ b/test/unittests_pl/trainer/flags/test_overfit_batches.py @@ -18,8 +18,8 @@ from legacy.simple_classif_training import ClassifDataModule, ClassificationModel from pytorch_lightning import Trainer from pytorch_lightning.trainer.states import RunningStage -from unittests.helpers.boring_model import BoringModel, RandomDataset -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringModel, RandomDataset +from unittests_pl.helpers.runif import RunIf @pytest.mark.parametrize("overfit_batches", [1, 2, 0.1, 0.25, 1.0]) diff --git a/test/unittests/trainer/flags/test_val_check_interval.py b/test/unittests_pl/trainer/flags/test_val_check_interval.py similarity index 97% rename from test/unittests/trainer/flags/test_val_check_interval.py rename to test/unittests_pl/trainer/flags/test_val_check_interval.py index 33fadf1cc4878..dc4ba3f554467 100644 --- a/test/unittests/trainer/flags/test_val_check_interval.py +++ b/test/unittests_pl/trainer/flags/test_val_check_interval.py @@ -18,8 +18,8 @@ from pytorch_lightning.trainer.trainer import Trainer from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers import BoringModel, RandomDataset -from unittests.helpers.boring_model import RandomIterableDataset +from unittests_pl.helpers import BoringModel, RandomDataset +from unittests_pl.helpers.boring_model import RandomIterableDataset @pytest.mark.parametrize("max_epochs", [1, 2, 3]) diff --git a/test/unittests/trainer/logging_/__init__.py b/test/unittests_pl/trainer/logging_/__init__.py similarity index 100% rename from test/unittests/trainer/logging_/__init__.py rename to test/unittests_pl/trainer/logging_/__init__.py diff --git a/test/unittests/trainer/logging_/test_distributed_logging.py b/test/unittests_pl/trainer/logging_/test_distributed_logging.py similarity index 98% rename from test/unittests/trainer/logging_/test_distributed_logging.py rename to test/unittests_pl/trainer/logging_/test_distributed_logging.py index d8ad154dedbc1..e29d27f547133 100644 --- a/test/unittests/trainer/logging_/test_distributed_logging.py +++ b/test/unittests_pl/trainer/logging_/test_distributed_logging.py @@ -18,8 +18,8 @@ import pytorch_lightning as pl from pytorch_lightning import Callback, Trainer from pytorch_lightning.loggers.logger import Logger -from unittests.helpers import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.runif import RunIf class AllRankLogger(Logger): diff --git a/test/unittests/trainer/logging_/test_eval_loop_logging.py b/test/unittests_pl/trainer/logging_/test_eval_loop_logging.py similarity index 99% rename from test/unittests/trainer/logging_/test_eval_loop_logging.py rename to test/unittests_pl/trainer/logging_/test_eval_loop_logging.py index 9142272dcfe7a..e2a0bb865d653 100644 --- a/test/unittests/trainer/logging_/test_eval_loop_logging.py +++ b/test/unittests_pl/trainer/logging_/test_eval_loop_logging.py @@ -30,8 +30,8 @@ from pytorch_lightning.trainer.states import RunningStage from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.imports import _PYTHON_GREATER_EQUAL_3_8_0, _RICH_AVAILABLE -from unittests.helpers import BoringModel, RandomDataset -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel, RandomDataset +from unittests_pl.helpers.runif import RunIf if _RICH_AVAILABLE: from rich import get_console diff --git a/test/unittests/trainer/logging_/test_logger_connector.py b/test/unittests_pl/trainer/logging_/test_logger_connector.py similarity index 99% rename from test/unittests/trainer/logging_/test_logger_connector.py rename to test/unittests_pl/trainer/logging_/test_logger_connector.py index 1e5b1eff5f097..25e93b5ad5579 100644 --- a/test/unittests/trainer/logging_/test_logger_connector.py +++ b/test/unittests_pl/trainer/logging_/test_logger_connector.py @@ -25,9 +25,9 @@ from pytorch_lightning.trainer.connectors.logger_connector.fx_validator import _FxValidator from pytorch_lightning.trainer.connectors.logger_connector.result import _ResultCollection from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers.boring_model import BoringModel, RandomDataset -from unittests.helpers.runif import RunIf -from unittests.models.test_hooks import get_members +from unittests_pl.helpers.boring_model import BoringModel, RandomDataset +from unittests_pl.helpers.runif import RunIf +from unittests_pl.models.test_hooks import get_members def test_fx_validator(): diff --git a/test/unittests/trainer/logging_/test_loop_logging.py b/test/unittests_pl/trainer/logging_/test_loop_logging.py similarity index 98% rename from test/unittests/trainer/logging_/test_loop_logging.py rename to test/unittests_pl/trainer/logging_/test_loop_logging.py index 895cf9cdcba44..d07a25051e2e7 100644 --- a/test/unittests/trainer/logging_/test_loop_logging.py +++ b/test/unittests_pl/trainer/logging_/test_loop_logging.py @@ -22,7 +22,7 @@ from pytorch_lightning.trainer.connectors.logger_connector.fx_validator import _FxValidator from pytorch_lightning.trainer.connectors.logger_connector.result import _ResultCollection from pytorch_lightning.trainer.states import RunningStage, TrainerFn -from unittests.helpers.boring_model import BoringModel +from unittests_pl.helpers.boring_model import BoringModel def test_default_level_for_hooks_that_support_logging(): diff --git a/test/unittests/trainer/logging_/test_progress_bar_logging.py b/test/unittests_pl/trainer/logging_/test_progress_bar_logging.py similarity index 93% rename from test/unittests/trainer/logging_/test_progress_bar_logging.py rename to test/unittests_pl/trainer/logging_/test_progress_bar_logging.py index c545bd9d22898..8f3776366c683 100644 --- a/test/unittests/trainer/logging_/test_progress_bar_logging.py +++ b/test/unittests_pl/trainer/logging_/test_progress_bar_logging.py @@ -1,7 +1,7 @@ import pytest from pytorch_lightning import Trainer -from unittests.helpers import BoringModel +from unittests_pl.helpers import BoringModel def test_logging_to_progress_bar_with_reserved_key(tmpdir): diff --git a/test/unittests/trainer/logging_/test_train_loop_logging.py b/test/unittests_pl/trainer/logging_/test_train_loop_logging.py similarity index 99% rename from test/unittests/trainer/logging_/test_train_loop_logging.py rename to test/unittests_pl/trainer/logging_/test_train_loop_logging.py index f56900b149578..df5860652dcfa 100644 --- a/test/unittests/trainer/logging_/test_train_loop_logging.py +++ b/test/unittests_pl/trainer/logging_/test_train_loop_logging.py @@ -29,8 +29,8 @@ from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint, TQDMProgressBar from pytorch_lightning.core.module import LightningModule from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers.boring_model import BoringModel, RandomDataset, RandomDictDataset -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringModel, RandomDataset, RandomDictDataset +from unittests_pl.helpers.runif import RunIf def test__training_step__log(tmpdir): diff --git a/test/unittests/trainer/optimization/__init__.py b/test/unittests_pl/trainer/optimization/__init__.py similarity index 100% rename from test/unittests/trainer/optimization/__init__.py rename to test/unittests_pl/trainer/optimization/__init__.py diff --git a/test/unittests/trainer/optimization/test_backward_calls.py b/test/unittests_pl/trainer/optimization/test_backward_calls.py similarity index 97% rename from test/unittests/trainer/optimization/test_backward_calls.py rename to test/unittests_pl/trainer/optimization/test_backward_calls.py index 55b25384f3791..aaddb62ebede5 100644 --- a/test/unittests/trainer/optimization/test_backward_calls.py +++ b/test/unittests_pl/trainer/optimization/test_backward_calls.py @@ -4,7 +4,7 @@ import torch from pytorch_lightning import Trainer -from unittests.helpers import BoringModel +from unittests_pl.helpers import BoringModel @pytest.mark.parametrize("num_steps", [1, 2, 3]) diff --git a/test/unittests/trainer/optimization/test_manual_optimization.py b/test/unittests_pl/trainer/optimization/test_manual_optimization.py similarity index 99% rename from test/unittests/trainer/optimization/test_manual_optimization.py rename to test/unittests_pl/trainer/optimization/test_manual_optimization.py index 683c0fe59560d..f13a9b1de52d5 100644 --- a/test/unittests/trainer/optimization/test_manual_optimization.py +++ b/test/unittests_pl/trainer/optimization/test_manual_optimization.py @@ -23,8 +23,8 @@ from pytorch_lightning import seed_everything, Trainer from pytorch_lightning.strategies import Strategy -from unittests.helpers.boring_model import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringModel +from unittests_pl.helpers.runif import RunIf class ManualOptModel(BoringModel): diff --git a/test/unittests/trainer/optimization/test_multiple_optimizers.py b/test/unittests_pl/trainer/optimization/test_multiple_optimizers.py similarity index 99% rename from test/unittests/trainer/optimization/test_multiple_optimizers.py rename to test/unittests_pl/trainer/optimization/test_multiple_optimizers.py index 362a6bb76f2f2..e006870b51170 100644 --- a/test/unittests/trainer/optimization/test_multiple_optimizers.py +++ b/test/unittests_pl/trainer/optimization/test_multiple_optimizers.py @@ -16,7 +16,7 @@ import torch import pytorch_lightning as pl -from unittests.helpers.boring_model import BoringModel +from unittests_pl.helpers.boring_model import BoringModel class MultiOptModel(BoringModel): diff --git a/test/unittests/trainer/optimization/test_optimizers.py b/test/unittests_pl/trainer/optimization/test_optimizers.py similarity index 99% rename from test/unittests/trainer/optimization/test_optimizers.py rename to test/unittests_pl/trainer/optimization/test_optimizers.py index a8dfed63d272f..767514fa40763 100644 --- a/test/unittests/trainer/optimization/test_optimizers.py +++ b/test/unittests_pl/trainer/optimization/test_optimizers.py @@ -27,8 +27,8 @@ ) from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.types import LRSchedulerConfig -from unittests.helpers.boring_model import BoringDataModule, BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringDataModule, BoringModel +from unittests_pl.helpers.runif import RunIf def test_optimizer_with_scheduling(tmpdir): diff --git a/test/unittests/trainer/properties/__init__.py b/test/unittests_pl/trainer/properties/__init__.py similarity index 100% rename from test/unittests/trainer/properties/__init__.py rename to test/unittests_pl/trainer/properties/__init__.py diff --git a/test/unittests/trainer/properties/test_auto_gpu_select.py b/test/unittests_pl/trainer/properties/test_auto_gpu_select.py similarity index 98% rename from test/unittests/trainer/properties/test_auto_gpu_select.py rename to test/unittests_pl/trainer/properties/test_auto_gpu_select.py index afe07f48880b8..8d0fe5c21a52c 100644 --- a/test/unittests/trainer/properties/test_auto_gpu_select.py +++ b/test/unittests_pl/trainer/properties/test_auto_gpu_select.py @@ -20,7 +20,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.tuner.auto_gpu_select import pick_multiple_gpus from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.runif import RunIf @RunIf(min_cuda_gpus=2) diff --git a/test/unittests/trainer/properties/test_estimated_stepping_batches.py b/test/unittests_pl/trainer/properties/test_estimated_stepping_batches.py similarity index 97% rename from test/unittests/trainer/properties/test_estimated_stepping_batches.py rename to test/unittests_pl/trainer/properties/test_estimated_stepping_batches.py index 523f3bbf5fa35..4403e96f295e4 100644 --- a/test/unittests/trainer/properties/test_estimated_stepping_batches.py +++ b/test/unittests_pl/trainer/properties/test_estimated_stepping_batches.py @@ -23,9 +23,9 @@ from pytorch_lightning.callbacks.gradient_accumulation_scheduler import GradientAccumulationScheduler from pytorch_lightning.strategies.ipu import IPUStrategy from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers.boring_model import BoringModel, RandomIterableDataset -from unittests.helpers.runif import RunIf -from unittests.helpers.utils import pl_multi_process_test +from unittests_pl.helpers.boring_model import BoringModel, RandomIterableDataset +from unittests_pl.helpers.runif import RunIf +from unittests_pl.helpers.utils import pl_multi_process_test def test_num_stepping_batches_basic(): diff --git a/test/unittests/trainer/properties/test_get_model.py b/test/unittests_pl/trainer/properties/test_get_model.py similarity index 95% rename from test/unittests/trainer/properties/test_get_model.py rename to test/unittests_pl/trainer/properties/test_get_model.py index 8eb23ff72a5bb..7ba9cf7b448aa 100644 --- a/test/unittests/trainer/properties/test_get_model.py +++ b/test/unittests_pl/trainer/properties/test_get_model.py @@ -13,8 +13,8 @@ # limitations under the License. from pytorch_lightning import Trainer -from unittests.helpers.boring_model import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringModel +from unittests_pl.helpers.runif import RunIf class TrainerGetModel(BoringModel): diff --git a/test/unittests/trainer/properties/test_log_dir.py b/test/unittests_pl/trainer/properties/test_log_dir.py similarity index 98% rename from test/unittests/trainer/properties/test_log_dir.py rename to test/unittests_pl/trainer/properties/test_log_dir.py index 9567957704baf..4ab82b80cfdd4 100644 --- a/test/unittests/trainer/properties/test_log_dir.py +++ b/test/unittests_pl/trainer/properties/test_log_dir.py @@ -16,7 +16,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.loggers import CSVLogger, TensorBoardLogger -from unittests.helpers.boring_model import BoringModel +from unittests_pl.helpers.boring_model import BoringModel class TestModel(BoringModel): diff --git a/test/unittests/trainer/properties/test_loggers.py b/test/unittests_pl/trainer/properties/test_loggers.py similarity index 98% rename from test/unittests/trainer/properties/test_loggers.py rename to test/unittests_pl/trainer/properties/test_loggers.py index f0c17920c46af..13fc9b0f2cde4 100644 --- a/test/unittests/trainer/properties/test_loggers.py +++ b/test/unittests_pl/trainer/properties/test_loggers.py @@ -16,7 +16,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.loggers import LoggerCollection, TensorBoardLogger -from unittests.loggers.test_logger import CustomLogger +from unittests_pl.loggers.test_logger import CustomLogger def test_trainer_loggers_property(): diff --git a/test/unittests/trainer/test_config_validator.py b/test/unittests_pl/trainer/test_config_validator.py similarity index 99% rename from test/unittests/trainer/test_config_validator.py rename to test/unittests_pl/trainer/test_config_validator.py index 26414e9339444..fe856f51ba91c 100644 --- a/test/unittests/trainer/test_config_validator.py +++ b/test/unittests_pl/trainer/test_config_validator.py @@ -18,7 +18,7 @@ from pytorch_lightning.callbacks.callback import Callback from pytorch_lightning.demos.boring_classes import BoringDataModule from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers import BoringModel, RandomDataset +from unittests_pl.helpers import BoringModel, RandomDataset def test_wrong_train_setting(tmpdir): diff --git a/test/unittests/trainer/test_dataloaders.py b/test/unittests_pl/trainer/test_dataloaders.py similarity index 99% rename from test/unittests/trainer/test_dataloaders.py rename to test/unittests_pl/trainer/test_dataloaders.py index d4b2b257b977c..691c4984ac381 100644 --- a/test/unittests/trainer/test_dataloaders.py +++ b/test/unittests_pl/trainer/test_dataloaders.py @@ -28,14 +28,14 @@ from pytorch_lightning.trainer.states import RunningStage from pytorch_lightning.utilities.data import _auto_add_worker_init_fn, has_iterable_dataset, has_len_all_ranks from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers.boring_model import ( +from unittests_pl.helpers.boring_model import ( BoringModel, RandomDataset, RandomIterableDataset, RandomIterableDatasetWithLen, ) -from unittests.helpers.dataloaders import CustomInfDataloader, CustomNotImplementedErrorDataloader -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.dataloaders import CustomInfDataloader, CustomNotImplementedErrorDataloader +from unittests_pl.helpers.runif import RunIf class MultiValDataLoaderBoringModel(BoringModel): diff --git a/test/unittests/trainer/test_progress.py b/test/unittests_pl/trainer/test_progress.py similarity index 100% rename from test/unittests/trainer/test_progress.py rename to test/unittests_pl/trainer/test_progress.py diff --git a/test/unittests/trainer/test_states.py b/test/unittests_pl/trainer/test_states.py similarity index 98% rename from test/unittests/trainer/test_states.py rename to test/unittests_pl/trainer/test_states.py index a456d9e554cab..3f4f078ecd2e4 100644 --- a/test/unittests/trainer/test_states.py +++ b/test/unittests_pl/trainer/test_states.py @@ -15,7 +15,7 @@ from pytorch_lightning import Callback, Trainer from pytorch_lightning.trainer.states import RunningStage, TrainerFn, TrainerState, TrainerStatus -from unittests.helpers import BoringModel +from unittests_pl.helpers import BoringModel def test_initialize_state(): diff --git a/test/unittests/trainer/test_supporters.py b/test/unittests_pl/trainer/test_supporters.py similarity index 99% rename from test/unittests/trainer/test_supporters.py rename to test/unittests_pl/trainer/test_supporters.py index 690fec004695a..2640a8dd135d1 100644 --- a/test/unittests/trainer/test_supporters.py +++ b/test/unittests_pl/trainer/test_supporters.py @@ -36,8 +36,8 @@ from pytorch_lightning.utilities.auto_restart import CaptureMapDataset, FastForwardSampler from pytorch_lightning.utilities.data import get_len from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers.boring_model import BoringModel, RandomDataset -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringModel, RandomDataset +from unittests_pl.helpers.runif import RunIf def test_tensor_running_accum_reset(): diff --git a/test/unittests/trainer/test_trainer.py b/test/unittests_pl/trainer/test_trainer.py similarity index 99% rename from test/unittests/trainer/test_trainer.py rename to test/unittests_pl/trainer/test_trainer.py index 8663d6cb13d30..b1d285512b43c 100644 --- a/test/unittests/trainer/test_trainer.py +++ b/test/unittests_pl/trainer/test_trainer.py @@ -33,7 +33,7 @@ from torch.utils.data import DataLoader, IterableDataset import pytorch_lightning -import unittests.helpers.utils as tutils +import unittests_pl.helpers.utils as tutils from pytorch_lightning import Callback, LightningDataModule, LightningModule, Trainer from pytorch_lightning.accelerators import CPUAccelerator, GPUAccelerator from pytorch_lightning.callbacks import EarlyStopping, GradientAccumulationScheduler, ModelCheckpoint, Timer @@ -57,11 +57,11 @@ from pytorch_lightning.utilities.exceptions import DeadlockDetectedException, MisconfigurationException from pytorch_lightning.utilities.imports import _OMEGACONF_AVAILABLE from pytorch_lightning.utilities.seed import seed_everything -from unittests.helpers import BoringModel, RandomDataset -from unittests.helpers.boring_model import RandomIterableDataset, RandomIterableDatasetWithLen -from unittests.helpers.datamodules import ClassifDataModule -from unittests.helpers.runif import RunIf -from unittests.helpers.simple_models import ClassificationModel +from unittests_pl.helpers import BoringModel, RandomDataset +from unittests_pl.helpers.boring_model import RandomIterableDataset, RandomIterableDatasetWithLen +from unittests_pl.helpers.datamodules import ClassifDataModule +from unittests_pl.helpers.runif import RunIf +from unittests_pl.helpers.simple_models import ClassificationModel if _OMEGACONF_AVAILABLE: from omegaconf import OmegaConf diff --git a/test/unittests/trainer/test_trainer_cli.py b/test/unittests_pl/trainer/test_trainer_cli.py similarity index 99% rename from test/unittests/trainer/test_trainer_cli.py rename to test/unittests_pl/trainer/test_trainer_cli.py index f3f03201694a2..2e6f8dcbf3ccf 100644 --- a/test/unittests/trainer/test_trainer_cli.py +++ b/test/unittests_pl/trainer/test_trainer_cli.py @@ -19,7 +19,7 @@ import pytest import torch -import unittests.helpers.utils as tutils +import unittests_pl.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.utilities import argparse diff --git a/test/unittests/tuner/__init__.py b/test/unittests_pl/tuner/__init__.py similarity index 100% rename from test/unittests/tuner/__init__.py rename to test/unittests_pl/tuner/__init__.py diff --git a/test/unittests/tuner/test_lr_finder.py b/test/unittests_pl/tuner/test_lr_finder.py similarity index 98% rename from test/unittests/tuner/test_lr_finder.py rename to test/unittests_pl/tuner/test_lr_finder.py index 77cb389c0e72f..f11b230be71cf 100644 --- a/test/unittests/tuner/test_lr_finder.py +++ b/test/unittests_pl/tuner/test_lr_finder.py @@ -19,10 +19,10 @@ from pytorch_lightning import seed_everything, Trainer from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers import BoringModel -from unittests.helpers.datamodules import ClassifDataModule -from unittests.helpers.simple_models import ClassificationModel -from unittests.helpers.utils import no_warning_call +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.datamodules import ClassifDataModule +from unittests_pl.helpers.simple_models import ClassificationModel +from unittests_pl.helpers.utils import no_warning_call def test_error_on_more_than_1_optimizer(tmpdir): diff --git a/test/unittests/tuner/test_scale_batch_size.py b/test/unittests_pl/tuner/test_scale_batch_size.py similarity index 98% rename from test/unittests/tuner/test_scale_batch_size.py rename to test/unittests_pl/tuner/test_scale_batch_size.py index 93e6c9182da41..8bf5e7ff4b56a 100644 --- a/test/unittests/tuner/test_scale_batch_size.py +++ b/test/unittests_pl/tuner/test_scale_batch_size.py @@ -18,14 +18,14 @@ import torch from torch.utils.data import DataLoader -import unittests.helpers.utils as tutils +import unittests_pl.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.tuner.tuning import Tuner from pytorch_lightning.utilities import AMPType from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers import BoringDataModule, BoringModel, RandomDataset -from unittests.helpers.runif import RunIf -from unittests.helpers.utils import no_warning_call +from unittests_pl.helpers import BoringDataModule, BoringModel, RandomDataset +from unittests_pl.helpers.runif import RunIf +from unittests_pl.helpers.utils import no_warning_call class BatchSizeDataModule(BoringDataModule): diff --git a/test/unittests/tuner/test_tuning.py b/test/unittests_pl/tuner/test_tuning.py similarity index 95% rename from test/unittests/tuner/test_tuning.py rename to test/unittests_pl/tuner/test_tuning.py index 8748c592b78ed..c5e641a389db8 100644 --- a/test/unittests/tuner/test_tuning.py +++ b/test/unittests_pl/tuner/test_tuning.py @@ -15,7 +15,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers.boring_model import BoringModel +from unittests_pl.helpers.boring_model import BoringModel def test_tuner_with_distributed_strategies(): diff --git a/test/unittests/utilities/__init__.py b/test/unittests_pl/utilities/__init__.py similarity index 100% rename from test/unittests/utilities/__init__.py rename to test/unittests_pl/utilities/__init__.py diff --git a/test/unittests/utilities/distributed.py b/test/unittests_pl/utilities/distributed.py similarity index 100% rename from test/unittests/utilities/distributed.py rename to test/unittests_pl/utilities/distributed.py diff --git a/test/unittests/utilities/test_all_gather_grad.py b/test/unittests_pl/utilities/test_all_gather_grad.py similarity index 97% rename from test/unittests/utilities/test_all_gather_grad.py rename to test/unittests_pl/utilities/test_all_gather_grad.py index 949fdb3926de0..88b6b155a9bac 100644 --- a/test/unittests/utilities/test_all_gather_grad.py +++ b/test/unittests_pl/utilities/test_all_gather_grad.py @@ -19,8 +19,8 @@ from pytorch_lightning import seed_everything, Trainer from pytorch_lightning.utilities import AllGatherGrad -from unittests.helpers.boring_model import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringModel +from unittests_pl.helpers.runif import RunIf def setup_ddp(rank, world_size): diff --git a/test/unittests/utilities/test_apply_func.py b/test/unittests_pl/utilities/test_apply_func.py similarity index 100% rename from test/unittests/utilities/test_apply_func.py rename to test/unittests_pl/utilities/test_apply_func.py diff --git a/test/unittests/utilities/test_apply_func_torchtext.py b/test/unittests_pl/utilities/test_apply_func_torchtext.py similarity index 93% rename from test/unittests/utilities/test_apply_func_torchtext.py rename to test/unittests_pl/utilities/test_apply_func_torchtext.py index c5386f97f1868..7b71d6c96e9eb 100644 --- a/test/unittests/utilities/test_apply_func_torchtext.py +++ b/test/unittests_pl/utilities/test_apply_func_torchtext.py @@ -16,8 +16,8 @@ from pytorch_lightning.utilities.apply_func import move_data_to_device from pytorch_lightning.utilities.imports import _TORCHTEXT_LEGACY -from unittests.helpers.runif import RunIf -from unittests.helpers.torchtext_utils import get_dummy_torchtext_data_iterator +from unittests_pl.helpers.runif import RunIf +from unittests_pl.helpers.torchtext_utils import get_dummy_torchtext_data_iterator @pytest.mark.parametrize("include_lengths", [False, True]) diff --git a/test/unittests/utilities/test_argparse.py b/test/unittests_pl/utilities/test_argparse.py similarity index 100% rename from test/unittests/utilities/test_argparse.py rename to test/unittests_pl/utilities/test_argparse.py diff --git a/test/unittests/utilities/test_auto_restart.py b/test/unittests_pl/utilities/test_auto_restart.py similarity index 99% rename from test/unittests/utilities/test_auto_restart.py rename to test/unittests_pl/utilities/test_auto_restart.py index 8de569319be34..61abc354990c9 100644 --- a/test/unittests/utilities/test_auto_restart.py +++ b/test/unittests_pl/utilities/test_auto_restart.py @@ -36,7 +36,7 @@ from torch.utils.data.dataset import Dataset, IterableDataset from torch.utils.data.sampler import Sampler -import unittests.helpers.utils as tutils +import unittests_pl.helpers.utils as tutils from pytorch_lightning import Callback, LightningModule, seed_everything, Trainer from pytorch_lightning.trainer.states import RunningStage, TrainerState from pytorch_lightning.trainer.supporters import CombinedLoader @@ -59,8 +59,8 @@ from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.fetching import DataFetcher from pytorch_lightning.utilities.imports import _fault_tolerant_training -from unittests.helpers.boring_model import BoringModel, RandomDataset -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringModel, RandomDataset +from unittests_pl.helpers.runif import RunIf # Credit to PyTorch Team. diff --git a/test/unittests/utilities/test_cli.py b/test/unittests_pl/utilities/test_cli.py similarity index 98% rename from test/unittests/utilities/test_cli.py rename to test/unittests_pl/utilities/test_cli.py index 41cdff37ebc71..1b8fd3d422123 100644 --- a/test/unittests/utilities/test_cli.py +++ b/test/unittests_pl/utilities/test_cli.py @@ -53,9 +53,9 @@ ) from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.imports import _TORCHVISION_AVAILABLE -from unittests.helpers import BoringDataModule, BoringModel -from unittests.helpers.runif import RunIf -from unittests.helpers.utils import no_warning_call +from unittests_pl.helpers import BoringDataModule, BoringModel +from unittests_pl.helpers.runif import RunIf +from unittests_pl.helpers.utils import no_warning_call torchvision_version = version.parse("0") if _TORCHVISION_AVAILABLE: @@ -411,8 +411,8 @@ def test_lightning_cli_save_config_cases(tmpdir): def test_lightning_cli_config_and_subclass_mode(tmpdir): input_config = { "fit": { - "model": {"class_path": "unittests.helpers.BoringModel"}, - "data": {"class_path": "unittests.helpers.BoringDataModule", "init_args": {"data_dir": str(tmpdir)}}, + "model": {"class_path": "unittests_pl.helpers.BoringModel"}, + "data": {"class_path": "unittests_pl.helpers.BoringDataModule", "init_args": {"data_dir": str(tmpdir)}}, "trainer": {"default_root_dir": str(tmpdir), "max_epochs": 1, "enable_model_summary": False}, } } @@ -463,7 +463,7 @@ def test_lightning_cli_help(): if param not in skip_params: assert f"--trainer.{param}" in out - cli_args = ["any.py", "fit", "--data.help=unittests.helpers.BoringDataModule"] + cli_args = ["any.py", "fit", "--data.help=unittests_pl.helpers.BoringDataModule"] out = StringIO() with mock.patch("sys.argv", cli_args), redirect_stdout(out), pytest.raises(SystemExit): any_model_any_data_cli() @@ -476,8 +476,8 @@ def test_lightning_cli_print_config(): "any.py", "predict", "--seed_everything=1234", - "--model=unittests.helpers.BoringModel", - "--data=unittests.helpers.BoringDataModule", + "--model=unittests_pl.helpers.BoringModel", + "--data=unittests_pl.helpers.BoringDataModule", "--print_config", ] out = StringIO() @@ -592,7 +592,7 @@ def add_arguments_to_parser(self, parser): parser.link_arguments("data.batch_size", "model.init_args.batch_size") parser.link_arguments("data.num_classes", "model.init_args.num_classes", apply_on="instantiate") - cli_args[-1] = "--model=unittests.utilities.test_cli.BoringModelRequiredClasses" + cli_args[-1] = "--model=unittests_pl.utilities.test_cli.BoringModelRequiredClasses" with mock.patch("sys.argv", ["any.py"] + cli_args): cli = MyLightningCLI( diff --git a/test/unittests/utilities/test_cloud_io.py b/test/unittests_pl/utilities/test_cloud_io.py similarity index 100% rename from test/unittests/utilities/test_cloud_io.py rename to test/unittests_pl/utilities/test_cloud_io.py diff --git a/test/unittests/utilities/test_data.py b/test/unittests_pl/utilities/test_data.py similarity index 98% rename from test/unittests/utilities/test_data.py rename to test/unittests_pl/utilities/test_data.py index a4aaf17337a57..a9db9d97c41cc 100644 --- a/test/unittests/utilities/test_data.py +++ b/test/unittests_pl/utilities/test_data.py @@ -19,8 +19,8 @@ warning_cache, ) from pytorch_lightning.utilities.exceptions import MisconfigurationException -from unittests.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset -from unittests.helpers.utils import no_warning_call +from unittests_pl.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset +from unittests_pl.helpers.utils import no_warning_call def test_extract_batch_size(): diff --git a/test/unittests/utilities/test_deepspeed_collate_checkpoint.py b/test/unittests_pl/utilities/test_deepspeed_collate_checkpoint.py similarity index 95% rename from test/unittests/utilities/test_deepspeed_collate_checkpoint.py rename to test/unittests_pl/utilities/test_deepspeed_collate_checkpoint.py index ba3cce04ba2db..8f976b7ec5be4 100644 --- a/test/unittests/utilities/test_deepspeed_collate_checkpoint.py +++ b/test/unittests_pl/utilities/test_deepspeed_collate_checkpoint.py @@ -18,8 +18,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.strategies import DeepSpeedStrategy from pytorch_lightning.utilities.deepspeed import convert_zero_checkpoint_to_fp32_state_dict -from unittests.helpers.boring_model import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringModel +from unittests_pl.helpers.runif import RunIf @RunIf(min_cuda_gpus=2, standalone=True, deepspeed=True) diff --git a/test/unittests/utilities/test_distributed.py b/test/unittests_pl/utilities/test_distributed.py similarity index 94% rename from test/unittests/utilities/test_distributed.py rename to test/unittests_pl/utilities/test_distributed.py index f2abe391b350d..33fc64909efe0 100644 --- a/test/unittests/utilities/test_distributed.py +++ b/test/unittests_pl/utilities/test_distributed.py @@ -16,9 +16,9 @@ import torch import torch.multiprocessing as mp -import unittests.helpers.utils as tutils +import unittests_pl.helpers.utils as tutils from pytorch_lightning.utilities.distributed import _collect_states_on_rank_zero -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.runif import RunIf def _test_collect_states(rank, world_size): diff --git a/test/unittests/utilities/test_dtype_device_mixin.py b/test/unittests_pl/utilities/test_dtype_device_mixin.py similarity index 97% rename from test/unittests/utilities/test_dtype_device_mixin.py rename to test/unittests_pl/utilities/test_dtype_device_mixin.py index 44ddc89844b1e..5dae66a7e1aeb 100644 --- a/test/unittests/utilities/test_dtype_device_mixin.py +++ b/test/unittests_pl/utilities/test_dtype_device_mixin.py @@ -17,8 +17,8 @@ from pytorch_lightning import Callback, Trainer from pytorch_lightning.core.mixins import DeviceDtypeModuleMixin -from unittests.helpers import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.runif import RunIf class SubSubModule(DeviceDtypeModuleMixin): diff --git a/test/unittests/utilities/test_enums.py b/test/unittests_pl/utilities/test_enums.py similarity index 100% rename from test/unittests/utilities/test_enums.py rename to test/unittests_pl/utilities/test_enums.py diff --git a/test/unittests/utilities/test_fetching.py b/test/unittests_pl/utilities/test_fetching.py similarity index 99% rename from test/unittests/utilities/test_fetching.py rename to test/unittests_pl/utilities/test_fetching.py index eb1a7556c332f..685c8394e49c6 100644 --- a/test/unittests/utilities/test_fetching.py +++ b/test/unittests_pl/utilities/test_fetching.py @@ -26,8 +26,8 @@ from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.fetching import DataFetcher, DataLoaderIterDataFetcher, InterBatchParallelDataFetcher from pytorch_lightning.utilities.types import STEP_OUTPUT -from unittests.helpers import BoringModel, RandomDataset -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel, RandomDataset +from unittests_pl.helpers.runif import RunIf class IterDataset(IterableDataset): diff --git a/test/unittests/utilities/test_finite_checks.py b/test/unittests_pl/utilities/test_finite_checks.py similarity index 100% rename from test/unittests/utilities/test_finite_checks.py rename to test/unittests_pl/utilities/test_finite_checks.py diff --git a/test/unittests/utilities/test_grads.py b/test/unittests_pl/utilities/test_grads.py similarity index 100% rename from test/unittests/utilities/test_grads.py rename to test/unittests_pl/utilities/test_grads.py diff --git a/test/unittests/utilities/test_imports.py b/test/unittests_pl/utilities/test_imports.py similarity index 100% rename from test/unittests/utilities/test_imports.py rename to test/unittests_pl/utilities/test_imports.py diff --git a/test/unittests/utilities/test_logger.py b/test/unittests_pl/utilities/test_logger.py similarity index 100% rename from test/unittests/utilities/test_logger.py rename to test/unittests_pl/utilities/test_logger.py diff --git a/test/unittests/utilities/test_memory.py b/test/unittests_pl/utilities/test_memory.py similarity index 97% rename from test/unittests/utilities/test_memory.py rename to test/unittests_pl/utilities/test_memory.py index d532a24da56ae..0fb506c8440e0 100644 --- a/test/unittests/utilities/test_memory.py +++ b/test/unittests_pl/utilities/test_memory.py @@ -17,7 +17,7 @@ import torch.nn as nn from pytorch_lightning.utilities.memory import get_model_size_mb, recursive_detach -from unittests.helpers import BoringModel +from unittests_pl.helpers import BoringModel def test_recursive_detach(): diff --git a/test/unittests/utilities/test_meta.py b/test/unittests_pl/utilities/test_meta.py similarity index 96% rename from test/unittests/utilities/test_meta.py rename to test/unittests_pl/utilities/test_meta.py index a788b986b3e18..db47328a649a5 100644 --- a/test/unittests/utilities/test_meta.py +++ b/test/unittests_pl/utilities/test_meta.py @@ -16,8 +16,8 @@ from pytorch_lightning.core.module import LightningModule from pytorch_lightning.utilities.meta import init_meta_context, is_on_meta_device, materialize_module -from unittests.helpers.boring_model import BoringModel -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.boring_model import BoringModel +from unittests_pl.helpers.runif import RunIf class MLP(nn.Module): diff --git a/test/unittests/utilities/test_migration.py b/test/unittests_pl/utilities/test_migration.py similarity index 100% rename from test/unittests/utilities/test_migration.py rename to test/unittests_pl/utilities/test_migration.py diff --git a/test/unittests/utilities/test_model_helpers.py b/test/unittests_pl/utilities/test_model_helpers.py similarity index 97% rename from test/unittests/utilities/test_model_helpers.py rename to test/unittests_pl/utilities/test_model_helpers.py index ebe7ad7d7c3e7..7475a3aa1e002 100644 --- a/test/unittests/utilities/test_model_helpers.py +++ b/test/unittests_pl/utilities/test_model_helpers.py @@ -18,7 +18,7 @@ from pytorch_lightning import LightningDataModule from pytorch_lightning.utilities.model_helpers import is_overridden -from unittests.helpers import BoringDataModule, BoringModel +from unittests_pl.helpers import BoringDataModule, BoringModel def test_is_overridden(): diff --git a/test/unittests/utilities/test_model_summary.py b/test/unittests_pl/utilities/test_model_summary.py similarity index 98% rename from test/unittests/utilities/test_model_summary.py rename to test/unittests_pl/utilities/test_model_summary.py index 30cbfc5b9bb4a..13090096c2a3e 100644 --- a/test/unittests/utilities/test_model_summary.py +++ b/test/unittests_pl/utilities/test_model_summary.py @@ -20,9 +20,9 @@ from pytorch_lightning import LightningModule, Trainer from pytorch_lightning.utilities import _TORCH_GREATER_EQUAL_1_9 from pytorch_lightning.utilities.model_summary import ModelSummary, summarize, UNKNOWN_SIZE -from unittests.helpers import BoringModel -from unittests.helpers.advanced_models import ParityModuleRNN -from unittests.helpers.runif import RunIf +from unittests_pl.helpers import BoringModel +from unittests_pl.helpers.advanced_models import ParityModuleRNN +from unittests_pl.helpers.runif import RunIf class EmptyModule(LightningModule): diff --git a/test/unittests/utilities/test_optimizer.py b/test/unittests_pl/utilities/test_optimizer.py similarity index 100% rename from test/unittests/utilities/test_optimizer.py rename to test/unittests_pl/utilities/test_optimizer.py diff --git a/test/unittests/utilities/test_parameter_tying.py b/test/unittests_pl/utilities/test_parameter_tying.py similarity index 98% rename from test/unittests/utilities/test_parameter_tying.py rename to test/unittests_pl/utilities/test_parameter_tying.py index e8d455539b9d9..f341e51d57ed6 100644 --- a/test/unittests/utilities/test_parameter_tying.py +++ b/test/unittests_pl/utilities/test_parameter_tying.py @@ -16,7 +16,7 @@ from torch import nn from pytorch_lightning.utilities import find_shared_parameters, set_shared_parameters -from unittests.helpers import BoringModel +from unittests_pl.helpers import BoringModel class ParameterSharingModule(BoringModel): diff --git a/test/unittests/utilities/test_parsing.py b/test/unittests_pl/utilities/test_parsing.py similarity index 100% rename from test/unittests/utilities/test_parsing.py rename to test/unittests_pl/utilities/test_parsing.py diff --git a/test/unittests/utilities/test_rank_zero.py b/test/unittests_pl/utilities/test_rank_zero.py similarity index 100% rename from test/unittests/utilities/test_rank_zero.py rename to test/unittests_pl/utilities/test_rank_zero.py diff --git a/test/unittests/utilities/test_remote_filesystem.py b/test/unittests_pl/utilities/test_remote_filesystem.py similarity index 98% rename from test/unittests/utilities/test_remote_filesystem.py rename to test/unittests_pl/utilities/test_remote_filesystem.py index 76e918a264aa6..b324e60c4f1c2 100644 --- a/test/unittests/utilities/test_remote_filesystem.py +++ b/test/unittests_pl/utilities/test_remote_filesystem.py @@ -19,7 +19,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.loggers import TensorBoardLogger -from unittests.helpers import BoringModel +from unittests_pl.helpers import BoringModel GCS_BUCKET_PATH = os.getenv("GCS_BUCKET_PATH", None) _GCS_BUCKET_PATH_AVAILABLE = GCS_BUCKET_PATH is not None diff --git a/test/unittests/utilities/test_seed.py b/test/unittests_pl/utilities/test_seed.py similarity index 100% rename from test/unittests/utilities/test_seed.py rename to test/unittests_pl/utilities/test_seed.py diff --git a/test/unittests/utilities/test_types.py b/test/unittests_pl/utilities/test_types.py similarity index 100% rename from test/unittests/utilities/test_types.py rename to test/unittests_pl/utilities/test_types.py diff --git a/test/unittests/utilities/test_upgrade_checkpoint.py b/test/unittests_pl/utilities/test_upgrade_checkpoint.py similarity index 100% rename from test/unittests/utilities/test_upgrade_checkpoint.py rename to test/unittests_pl/utilities/test_upgrade_checkpoint.py diff --git a/test/unittests/utilities/test_warnings.py b/test/unittests_pl/utilities/test_warnings.py similarity index 100% rename from test/unittests/utilities/test_warnings.py rename to test/unittests_pl/utilities/test_warnings.py diff --git a/test/unittests/utilities/test_xla_device_utils.py b/test/unittests_pl/utilities/test_xla_device_utils.py similarity index 97% rename from test/unittests/utilities/test_xla_device_utils.py rename to test/unittests_pl/utilities/test_xla_device_utils.py index d69af561536ca..85e134752183e 100644 --- a/test/unittests/utilities/test_xla_device_utils.py +++ b/test/unittests_pl/utilities/test_xla_device_utils.py @@ -18,7 +18,7 @@ import pytorch_lightning.utilities.xla_device as xla_utils from pytorch_lightning.utilities import _XLA_AVAILABLE -from unittests.helpers.runif import RunIf +from unittests_pl.helpers.runif import RunIf @pytest.mark.skipif(_XLA_AVAILABLE, reason="test requires torch_xla to be absent") From 20cab4005e9642a987773e7b83774ba5b6b1db70 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 9 Jun 2022 23:22:14 +0200 Subject: [PATCH 15/20] move MNIST to PL.demos --- src/pytorch_lightning/__init__.py | 31 +++++++++++++++++++ src/pytorch_lightning/demos/__init__.py | 6 ++++ src/pytorch_lightning/demos/boring_classes.py | 28 +++++++++++++++++ .../demos}/mnist_datamodule.py | 3 +- 4 files changed, 67 insertions(+), 1 deletion(-) rename src/{pl_examples/basic_examples => pytorch_lightning/demos}/mnist_datamodule.py (99%) diff --git a/src/pytorch_lightning/__init__.py b/src/pytorch_lightning/__init__.py index adc63486d2f8b..60838221f618a 100644 --- a/src/pytorch_lightning/__init__.py +++ b/src/pytorch_lightning/__init__.py @@ -36,3 +36,34 @@ def _detail(self: Any, message: str, *args: Any, **kwargs: Any) -> None: # for compatibility with namespace packages __import__("pkg_resources").declare_namespace(__name__) + +LIGHTNING_LOGO = """ + #### + ########### + #################### + ############################ + ##################################### +############################################## +######################### ################### +####################### ################### +#################### #################### +################## ##################### +################ ###################### +##################### ################# +###################### ################### +##################### ##################### +#################### ####################### +################### ######################### +############################################## + ##################################### + ############################ + #################### + ########## + #### +""" + + +def cli_lightning_logo(): + print() + print("\033[0;35m" + LIGHTNING_LOGO + "\033[0m") + print() diff --git a/src/pytorch_lightning/demos/__init__.py b/src/pytorch_lightning/demos/__init__.py index e69de29bb2d1d..2be74bcdc7e7d 100644 --- a/src/pytorch_lightning/demos/__init__.py +++ b/src/pytorch_lightning/demos/__init__.py @@ -0,0 +1,6 @@ +from six.moves import urllib + +# TorchVision hotfix https://github.com/pytorch/vision/issues/1938 +opener = urllib.request.build_opener() +opener.addheaders = [("User-agent", "Mozilla/5.0")] +urllib.request.install_opener(opener) diff --git a/src/pytorch_lightning/demos/boring_classes.py b/src/pytorch_lightning/demos/boring_classes.py index 00aea18288de7..4fd8fd139e5f4 100644 --- a/src/pytorch_lightning/demos/boring_classes.py +++ b/src/pytorch_lightning/demos/boring_classes.py @@ -14,6 +14,8 @@ from typing import Optional import torch +import torch.nn as nn +import torch.nn.functional as F from torch.utils.data import DataLoader, Dataset, IterableDataset, Subset from pytorch_lightning import LightningDataModule, LightningModule @@ -211,3 +213,29 @@ def training_step(self, batch, batch_nb): def configure_optimizers(self): return torch.optim.Adam(self.parameters(), lr=self.learning_rate) + + +class Net(nn.Module): + def __init__(self): + super().__init__() + self.conv1 = nn.Conv2d(1, 32, 3, 1) + self.conv2 = nn.Conv2d(32, 64, 3, 1) + self.dropout1 = nn.Dropout(0.25) + self.dropout2 = nn.Dropout(0.5) + self.fc1 = nn.Linear(9216, 128) + self.fc2 = nn.Linear(128, 10) + + def forward(self, x): + x = self.conv1(x) + x = F.relu(x) + x = self.conv2(x) + x = F.relu(x) + x = F.max_pool2d(x, 2) + x = self.dropout1(x) + x = torch.flatten(x, 1) + x = self.fc1(x) + x = F.relu(x) + x = self.dropout2(x) + x = self.fc2(x) + output = F.log_softmax(x, dim=1) + return output diff --git a/src/pl_examples/basic_examples/mnist_datamodule.py b/src/pytorch_lightning/demos/mnist_datamodule.py similarity index 99% rename from src/pl_examples/basic_examples/mnist_datamodule.py rename to src/pytorch_lightning/demos/mnist_datamodule.py index 0e7f28d9fe694..3e7f738710b54 100644 --- a/src/pl_examples/basic_examples/mnist_datamodule.py +++ b/src/pytorch_lightning/demos/mnist_datamodule.py @@ -24,13 +24,14 @@ import torch from torch.utils.data import DataLoader, Dataset, random_split -from pl_examples import _DATASETS_PATH from pytorch_lightning import LightningDataModule from pytorch_lightning.utilities.imports import _TORCHVISION_AVAILABLE if _TORCHVISION_AVAILABLE: from torchvision import transforms as transform_lib +_DATASETS_PATH = "./data" + class _MNIST(Dataset): """Carbon copy of ``unittests_pl.helpers.datasets.MNIST``. From ebcf029a8ccac27dd6c8b44f6056da448e947600 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 9 Jun 2022 23:23:02 +0200 Subject: [PATCH 16/20] convert pl_examples package to plain examples --- examples/README.md | 53 ++++++ .../convert_from_pt_to_pl}/README.md | 0 .../image_classifier_1_pytorch.py | 36 +--- .../image_classifier_2_lite.py | 13 +- ...e_classifier_3_lite_to_lightning_module.py | 13 +- .../image_classifier_4_lightning_module.py | 17 +- ...image_classifier_5_lightning_datamodule.py | 17 +- .../pl_basics}/README.md | 0 .../pl_basics}/autoencoder.py | 20 ++- .../pl_basics}/backbone_image_classifier.py | 16 +- .../pl_basics}/profiler_example.py | 11 +- .../pl_bug_report}/bug_report_model.ipynb | 0 .../pl_bug_report}/bug_report_model.py | 0 .../computer_vision_fine_tuning.py | 10 +- .../generative_adversarial_net.py | 6 +- .../pl_domain_templates}/imagenet.py | 0 .../reinforce_learn_Qnet.py | 10 +- .../reinforce_learn_ppo.py | 11 +- .../semantic_segmentation.py | 157 ++++++++++++++++- .../pl_fault_tolerant}/automatic.py | 0 .../pl_hpu/mnist_sample.py | 6 +- .../pl_hpu}/ops_bf16_mnist.txt | 0 .../pl_hpu}/ops_fp32_mnist.txt | 0 .../pl_integrations}/dali_image_classifier.py | 18 +- .../pl_ipu/mnist_sample.py | 8 +- .../pl_loops}/kfold.py | 40 ++++- .../pl_loops}/mnist_lite.py | 13 +- .../pl_loops}/yielding_training_step.py | 146 +++++++++++++++- {src/pl_examples => examples}/run_examples.sh | 0 .../pl_examples => examples}/test_examples.py | 5 +- src/pl_examples/README.md | 53 ------ src/pl_examples/__init__.py | 52 ------ src/pl_examples/basic_examples/__init__.py | 0 .../basic_examples/mnist_examples/__init__.py | 0 src/pl_examples/domain_templates/__init__.py | 0 src/pl_examples/domain_templates/unet.py | 158 ------------------ .../integration_examples/__init__.py | 0 src/pl_examples/ipu_examples/__init__.py | 0 src/pl_examples/loop_examples/__init__.py | 0 src/pytorch_lightning/utilities/imports.py | 1 + 40 files changed, 486 insertions(+), 404 deletions(-) create mode 100644 examples/README.md rename {src/pl_examples/basic_examples/mnist_examples => examples/convert_from_pt_to_pl}/README.md (100%) rename {src/pl_examples/basic_examples/mnist_examples => examples/convert_from_pt_to_pl}/image_classifier_1_pytorch.py (83%) rename {src/pl_examples/basic_examples/mnist_examples => examples/convert_from_pt_to_pl}/image_classifier_2_lite.py (94%) rename {src/pl_examples/basic_examples/mnist_examples => examples/convert_from_pt_to_pl}/image_classifier_3_lite_to_lightning_module.py (93%) rename {src/pl_examples/basic_examples/mnist_examples => examples/convert_from_pt_to_pl}/image_classifier_4_lightning_module.py (84%) rename {src/pl_examples/basic_examples/mnist_examples => examples/convert_from_pt_to_pl}/image_classifier_5_lightning_datamodule.py (84%) rename {src/pl_examples/basic_examples => examples/pl_basics}/README.md (100%) rename {src/pl_examples/basic_examples => examples/pl_basics}/autoencoder.py (90%) rename {src/pl_examples/basic_examples => examples/pl_basics}/backbone_image_classifier.py (88%) rename {src/pl_examples/basic_examples => examples/pl_basics}/profiler_example.py (90%) rename {src/pl_examples/bug_report => examples/pl_bug_report}/bug_report_model.ipynb (100%) rename {src/pl_examples/bug_report => examples/pl_bug_report}/bug_report_model.py (100%) rename {src/pl_examples/domain_templates => examples/pl_domain_templates}/computer_vision_fine_tuning.py (96%) rename {src/pl_examples/domain_templates => examples/pl_domain_templates}/generative_adversarial_net.py (97%) rename {src/pl_examples/domain_templates => examples/pl_domain_templates}/imagenet.py (100%) rename {src/pl_examples/domain_templates => examples/pl_domain_templates}/reinforce_learn_Qnet.py (98%) rename {src/pl_examples/domain_templates => examples/pl_domain_templates}/reinforce_learn_ppo.py (98%) rename {src/pl_examples/domain_templates => examples/pl_domain_templates}/semantic_segmentation.py (69%) rename {src/pl_examples/fault_tolerant => examples/pl_fault_tolerant}/automatic.py (100%) rename src/pl_examples/hpu_examples/simple_mnist/mnist.py => examples/pl_hpu/mnist_sample.py (93%) rename {src/pl_examples/hpu_examples/simple_mnist => examples/pl_hpu}/ops_bf16_mnist.txt (100%) rename {src/pl_examples/hpu_examples/simple_mnist => examples/pl_hpu}/ops_fp32_mnist.txt (100%) rename {src/pl_examples/integration_examples => examples/pl_integrations}/dali_image_classifier.py (91%) rename src/pl_examples/ipu_examples/mnist.py => examples/pl_ipu/mnist_sample.py (92%) rename {src/pl_examples/loop_examples => examples/pl_loops}/kfold.py (90%) rename {src/pl_examples/loop_examples => examples/pl_loops}/mnist_lite.py (93%) rename {src/pl_examples/loop_examples => examples/pl_loops}/yielding_training_step.py (64%) rename {src/pl_examples => examples}/run_examples.sh (100%) rename {src/pl_examples => examples}/test_examples.py (89%) delete mode 100644 src/pl_examples/README.md delete mode 100644 src/pl_examples/__init__.py delete mode 100644 src/pl_examples/basic_examples/__init__.py delete mode 100644 src/pl_examples/basic_examples/mnist_examples/__init__.py delete mode 100644 src/pl_examples/domain_templates/__init__.py delete mode 100644 src/pl_examples/domain_templates/unet.py delete mode 100644 src/pl_examples/integration_examples/__init__.py delete mode 100644 src/pl_examples/ipu_examples/__init__.py delete mode 100644 src/pl_examples/loop_examples/__init__.py diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000000000..e16a8bfcf190b --- /dev/null +++ b/examples/README.md @@ -0,0 +1,53 @@ +# Examples + +Our most robust examples showing all sorts of implementations +can be found in our sister library [Lightning Bolts](https://pytorch-lightning.readthedocs.io/en/latest/ecosystem/bolts.html). + +______________________________________________________________________ + +## MNIST Examples + +5 MNIST examples showing how to gradually convert from pure PyTorch to PyTorch Lightning. + +The transition through [LightningLite](https://pytorch-lightning.readthedocs.io/en/latest/starter/lightning_lite.html) from pure PyTorch is optional, but it might be helpful to learn about it. + +- [MNIST with vanilla PyTorch](convert_from_pt_to_pl/image_classifier_1_pytorch.py) +- [MNIST with LightningLite](convert_from_pt_to_pl/image_classifier_2_lite.py) +- [MNIST LightningLite to LightningModule](convert_from_pt_to_pl/image_classifier_3_lite_to_lightning_module.py) +- [MNIST with LightningModule](convert_from_pt_to_pl/image_classifier_4_lightning_module.py) +- [MNIST with LightningModule + LightningDataModule](convert_from_pt_to_pl/image_classifier_5_lightning_datamodule.py) + +______________________________________________________________________ + +## Basic Examples + +In this folder, we have 2 simple examples: + +- [Image Classifier](pl_basics/backbone_image_classifier.py) (trains arbitrary datasets with arbitrary backbones). +- [Image Classifier + DALI](convert_from_pt_to_pl/image_classifier_4_dali.py) (defines the model inside the `LightningModule`). +- [Autoencoder](pl_basics/autoencoder.py) + +______________________________________________________________________ + +## Domain Examples + +This folder contains older examples. You should instead use the examples +in [Lightning Bolts](https://pytorch-lightning.readthedocs.io/en/latest/ecosystem/bolts.html) +for advanced use cases. + +______________________________________________________________________ + +## Basic Examples + +In this folder, we have 1 simple example: + +- [Image Classifier + DALI](pl_integrations/dali_image_classifier.py) (defines the model inside the `LightningModule`). + +______________________________________________________________________ + +## Loop examples + +Contains implementations leveraging [loop customization](https://pytorch-lightning.readthedocs.io/en/latest/extensions/loops.html) to enhance the Trainer with new optimization routines. + +- [K-fold Cross Validation Loop](pl_loops/kfold.py): Implementation of cross validation in a loop and special datamodule. +- [Yield Loop](pl_loops/yielding_training_step.py): Enables yielding from the training_step like in a Python generator. Useful for automatic optimization with multiple optimizers. diff --git a/src/pl_examples/basic_examples/mnist_examples/README.md b/examples/convert_from_pt_to_pl/README.md similarity index 100% rename from src/pl_examples/basic_examples/mnist_examples/README.md rename to examples/convert_from_pt_to_pl/README.md diff --git a/src/pl_examples/basic_examples/mnist_examples/image_classifier_1_pytorch.py b/examples/convert_from_pt_to_pl/image_classifier_1_pytorch.py similarity index 83% rename from src/pl_examples/basic_examples/mnist_examples/image_classifier_1_pytorch.py rename to examples/convert_from_pt_to_pl/image_classifier_1_pytorch.py index 4073c485e6017..47cbb90c20cda 100644 --- a/src/pl_examples/basic_examples/mnist_examples/image_classifier_1_pytorch.py +++ b/examples/convert_from_pt_to_pl/image_classifier_1_pytorch.py @@ -12,44 +12,20 @@ # See the License for the specific language governing permissions and # limitations under the License. import argparse +from os import path import torch -import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torchvision.transforms as T from torch.optim.lr_scheduler import StepLR -from pl_examples.basic_examples.mnist_datamodule import MNIST - # Credit to the PyTorch Team # Taken from https://github.com/pytorch/examples/blob/master/mnist/main.py and slightly adapted. +from pytorch_lightning.demos.boring_classes import Net +from pytorch_lightning.demos.mnist_datamodule import MNIST - -class Net(nn.Module): - def __init__(self): - super().__init__() - self.conv1 = nn.Conv2d(1, 32, 3, 1) - self.conv2 = nn.Conv2d(32, 64, 3, 1) - self.dropout1 = nn.Dropout(0.25) - self.dropout2 = nn.Dropout(0.5) - self.fc1 = nn.Linear(9216, 128) - self.fc2 = nn.Linear(128, 10) - - def forward(self, x): - x = self.conv1(x) - x = F.relu(x) - x = self.conv2(x) - x = F.relu(x) - x = F.max_pool2d(x, 2) - x = self.dropout1(x) - x = torch.flatten(x, 1) - x = self.fc1(x) - x = F.relu(x) - x = self.dropout2(x) - x = self.fc2(x) - output = F.log_softmax(x, dim=1) - return output +DATASETS_PATH = path.join(path.dirname(__file__), "..", "..", "Datasets") def run(hparams): @@ -60,8 +36,8 @@ def run(hparams): device = torch.device("cuda" if use_cuda else "cpu") transform = T.Compose([T.ToTensor(), T.Normalize((0.1307,), (0.3081,))]) - train_dataset = MNIST("./data", train=True, download=True, transform=transform) - test_dataset = MNIST("./data", train=False, transform=transform) + train_dataset = MNIST(DATASETS_PATH, train=True, download=True, transform=transform) + test_dataset = MNIST(DATASETS_PATH, train=False, transform=transform) train_loader = torch.utils.data.DataLoader( train_dataset, batch_size=hparams.batch_size, diff --git a/src/pl_examples/basic_examples/mnist_examples/image_classifier_2_lite.py b/examples/convert_from_pt_to_pl/image_classifier_2_lite.py similarity index 94% rename from src/pl_examples/basic_examples/mnist_examples/image_classifier_2_lite.py rename to examples/convert_from_pt_to_pl/image_classifier_2_lite.py index db310b8280af5..da82db0328031 100644 --- a/src/pl_examples/basic_examples/mnist_examples/image_classifier_2_lite.py +++ b/examples/convert_from_pt_to_pl/image_classifier_2_lite.py @@ -29,6 +29,7 @@ """ import argparse +from os import path import torch import torch.nn.functional as F @@ -37,11 +38,13 @@ from torch.optim.lr_scheduler import StepLR from torchmetrics.classification import Accuracy -from pl_examples.basic_examples.mnist_datamodule import MNIST -from pl_examples.basic_examples.mnist_examples.image_classifier_1_pytorch import Net from pytorch_lightning import seed_everything +from pytorch_lightning.demos.boring_classes import Net +from pytorch_lightning.demos.mnist_datamodule import MNIST from pytorch_lightning.lite import LightningLite # import LightningLite +DATASETS_PATH = path.join(path.dirname(__file__), "..", "..", "Datasets") + class Lite(LightningLite): def run(self, hparams): @@ -51,10 +54,10 @@ def run(self, hparams): transform = T.Compose([T.ToTensor(), T.Normalize((0.1307,), (0.3081,))]) # This is meant to ensure the data are download only by 1 process. if self.is_global_zero: - MNIST("./data", download=True) + MNIST(DATASETS_PATH, download=True) self.barrier() - train_dataset = MNIST("./data", train=True, transform=transform) - test_dataset = MNIST("./data", train=False, transform=transform) + train_dataset = MNIST(DATASETS_PATH, train=True, transform=transform) + test_dataset = MNIST(DATASETS_PATH, train=False, transform=transform) train_loader = torch.utils.data.DataLoader( train_dataset, batch_size=hparams.batch_size, diff --git a/src/pl_examples/basic_examples/mnist_examples/image_classifier_3_lite_to_lightning_module.py b/examples/convert_from_pt_to_pl/image_classifier_3_lite_to_lightning_module.py similarity index 93% rename from src/pl_examples/basic_examples/mnist_examples/image_classifier_3_lite_to_lightning_module.py rename to examples/convert_from_pt_to_pl/image_classifier_3_lite_to_lightning_module.py index 0d6925fc68c1a..d2dc9a581b59c 100644 --- a/src/pl_examples/basic_examples/mnist_examples/image_classifier_3_lite_to_lightning_module.py +++ b/examples/convert_from_pt_to_pl/image_classifier_3_lite_to_lightning_module.py @@ -25,6 +25,7 @@ """ import argparse +from os import path import torch import torch.nn.functional as F @@ -33,11 +34,13 @@ from torch.optim.lr_scheduler import StepLR from torchmetrics import Accuracy -from pl_examples.basic_examples.mnist_datamodule import MNIST -from pl_examples.basic_examples.mnist_examples.image_classifier_1_pytorch import Net from pytorch_lightning import seed_everything +from pytorch_lightning.demos.boring_classes import Net +from pytorch_lightning.demos.mnist_datamodule import MNIST from pytorch_lightning.lite import LightningLite +DATASETS_PATH = path.join(path.dirname(__file__), "..", "..", "Datasets") + class Lite(LightningLite): """Lite is starting to look like a LightningModule.""" @@ -135,14 +138,14 @@ def transform(self): return T.Compose([T.ToTensor(), T.Normalize((0.1307,), (0.3081,))]) def prepare_data(self) -> None: - MNIST("./data", download=True) + MNIST(DATASETS_PATH, download=True) def train_dataloader(self): - train_dataset = MNIST("./data", train=True, download=False, transform=self.transform) + train_dataset = MNIST(DATASETS_PATH, train=True, download=False, transform=self.transform) return torch.utils.data.DataLoader(train_dataset, batch_size=self.hparams.batch_size) def test_dataloader(self): - test_dataset = MNIST("./data", train=False, download=False, transform=self.transform) + test_dataset = MNIST(DATASETS_PATH, train=False, download=False, transform=self.transform) return torch.utils.data.DataLoader(test_dataset, batch_size=self.hparams.batch_size) diff --git a/src/pl_examples/basic_examples/mnist_examples/image_classifier_4_lightning_module.py b/examples/convert_from_pt_to_pl/image_classifier_4_lightning_module.py similarity index 84% rename from src/pl_examples/basic_examples/mnist_examples/image_classifier_4_lightning_module.py rename to examples/convert_from_pt_to_pl/image_classifier_4_lightning_module.py index cdd58e7d38a93..ec7ff5edb2de6 100644 --- a/src/pl_examples/basic_examples/mnist_examples/image_classifier_4_lightning_module.py +++ b/examples/convert_from_pt_to_pl/image_classifier_4_lightning_module.py @@ -15,17 +15,20 @@ To run: python image_classifier_4_lightning_module.py --trainer.max_epochs=50 """ +from os import path + import torch import torchvision.transforms as T from torch.nn import functional as F from torchmetrics import Accuracy -from pl_examples import cli_lightning_logo -from pl_examples.basic_examples.mnist_datamodule import MNIST -from pl_examples.basic_examples.mnist_examples.image_classifier_1_pytorch import Net -from pytorch_lightning import LightningModule +from pytorch_lightning import cli_lightning_logo, LightningModule +from pytorch_lightning.demos.boring_classes import Net +from pytorch_lightning.demos.mnist_datamodule import MNIST from pytorch_lightning.utilities.cli import LightningCLI +DATASETS_PATH = path.join(path.dirname(__file__), "..", "..", "Datasets") + class ImageClassifier(LightningModule): def __init__(self, model=None, lr=1.0, gamma=0.7, batch_size=32): @@ -62,14 +65,14 @@ def transform(self): return T.Compose([T.ToTensor(), T.Normalize((0.1307,), (0.3081,))]) def prepare_data(self) -> None: - MNIST("./data", download=True) + MNIST(DATASETS_PATH, download=True) def train_dataloader(self): - train_dataset = MNIST("./data", train=True, download=False, transform=self.transform) + train_dataset = MNIST(DATASETS_PATH, train=True, download=False, transform=self.transform) return torch.utils.data.DataLoader(train_dataset, batch_size=self.hparams.batch_size) def test_dataloader(self): - test_dataset = MNIST("./data", train=False, download=False, transform=self.transform) + test_dataset = MNIST(DATASETS_PATH, train=False, download=False, transform=self.transform) return torch.utils.data.DataLoader(test_dataset, batch_size=self.hparams.batch_size) diff --git a/src/pl_examples/basic_examples/mnist_examples/image_classifier_5_lightning_datamodule.py b/examples/convert_from_pt_to_pl/image_classifier_5_lightning_datamodule.py similarity index 84% rename from src/pl_examples/basic_examples/mnist_examples/image_classifier_5_lightning_datamodule.py rename to examples/convert_from_pt_to_pl/image_classifier_5_lightning_datamodule.py index f3fada03c1c08..3e1357e2dfbb5 100644 --- a/src/pl_examples/basic_examples/mnist_examples/image_classifier_5_lightning_datamodule.py +++ b/examples/convert_from_pt_to_pl/image_classifier_5_lightning_datamodule.py @@ -15,17 +15,20 @@ To run: python image_classifier_5_lightning_datamodule.py --trainer.max_epochs=50 """ +from os import path + import torch import torchvision.transforms as T from torch.nn import functional as F from torchmetrics import Accuracy -from pl_examples import cli_lightning_logo -from pl_examples.basic_examples.mnist_datamodule import MNIST -from pl_examples.basic_examples.mnist_examples.image_classifier_1_pytorch import Net -from pytorch_lightning import LightningDataModule, LightningModule +from pytorch_lightning import cli_lightning_logo, LightningDataModule, LightningModule +from pytorch_lightning.demos.boring_classes import Net +from pytorch_lightning.demos.mnist_datamodule import MNIST from pytorch_lightning.utilities.cli import LightningCLI +DATASETS_PATH = path.join(path.dirname(__file__), "..", "..", "Datasets") + class ImageClassifier(LightningModule): def __init__(self, model, lr=1.0, gamma=0.7, batch_size=32): @@ -66,14 +69,14 @@ def transform(self): return T.Compose([T.ToTensor(), T.Normalize((0.1307,), (0.3081,))]) def prepare_data(self) -> None: - MNIST("./data", download=True) + MNIST(DATASETS_PATH, download=True) def train_dataloader(self): - train_dataset = MNIST("./data", train=True, download=False, transform=self.transform) + train_dataset = MNIST(DATASETS_PATH, train=True, download=False, transform=self.transform) return torch.utils.data.DataLoader(train_dataset, batch_size=self.hparams.batch_size) def test_dataloader(self): - test_dataset = MNIST("./data", train=False, download=False, transform=self.transform) + test_dataset = MNIST(DATASETS_PATH, train=False, download=False, transform=self.transform) return torch.utils.data.DataLoader(test_dataset, batch_size=self.hparams.batch_size) diff --git a/src/pl_examples/basic_examples/README.md b/examples/pl_basics/README.md similarity index 100% rename from src/pl_examples/basic_examples/README.md rename to examples/pl_basics/README.md diff --git a/src/pl_examples/basic_examples/autoencoder.py b/examples/pl_basics/autoencoder.py similarity index 90% rename from src/pl_examples/basic_examples/autoencoder.py rename to examples/pl_basics/autoencoder.py index 496d7e6d9b1fb..6fcbeafa4b389 100644 --- a/src/pl_examples/basic_examples/autoencoder.py +++ b/examples/pl_basics/autoencoder.py @@ -15,6 +15,7 @@ To run: python autoencoder.py --trainer.max_epochs=50 """ +from os import path from typing import Optional, Tuple import torch @@ -22,9 +23,8 @@ from torch import nn from torch.utils.data import DataLoader, random_split -import pytorch_lightning as pl -from pl_examples import _DATASETS_PATH, cli_lightning_logo -from pl_examples.basic_examples.mnist_datamodule import MNIST +from pytorch_lightning import callbacks, cli_lightning_logo, LightningDataModule, LightningModule, Trainer +from pytorch_lightning.demos.mnist_datamodule import MNIST from pytorch_lightning.utilities.cli import LightningCLI from pytorch_lightning.utilities.imports import _TORCHVISION_AVAILABLE from pytorch_lightning.utilities.rank_zero import rank_zero_only @@ -34,8 +34,10 @@ from torchvision import transforms from torchvision.utils import save_image +DATASETS_PATH = path.join(path.dirname(__file__), "..", "..", "Datasets") -class ImageSampler(pl.callbacks.Callback): + +class ImageSampler(callbacks.Callback): def __init__( self, num_samples: int = 3, @@ -85,7 +87,7 @@ def _to_grid(self, images): ) @rank_zero_only - def on_train_epoch_end(self, trainer: pl.Trainer, pl_module: pl.LightningModule) -> None: + def on_train_epoch_end(self, trainer: Trainer, pl_module: LightningModule) -> None: if not _TORCHVISION_AVAILABLE: return @@ -103,7 +105,7 @@ def on_train_epoch_end(self, trainer: pl.Trainer, pl_module: pl.LightningModule) save_image(self._to_grid(images_generated.reshape(images.shape)), f"grid_generated_{trainer.current_epoch}.png") -class LitAutoEncoder(pl.LightningModule): +class LitAutoEncoder(LightningModule): """ >>> LitAutoEncoder() # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE LitAutoEncoder( @@ -150,11 +152,11 @@ def _common_step(self, batch, batch_idx, stage: str): return loss -class MyDataModule(pl.LightningDataModule): +class MyDataModule(LightningDataModule): def __init__(self, batch_size: int = 32): super().__init__() - dataset = MNIST(_DATASETS_PATH, train=True, download=True, transform=transforms.ToTensor()) - self.mnist_test = MNIST(_DATASETS_PATH, train=False, download=True, transform=transforms.ToTensor()) + dataset = MNIST(DATASETS_PATH, train=True, download=True, transform=transforms.ToTensor()) + self.mnist_test = MNIST(DATASETS_PATH, train=False, download=True, transform=transforms.ToTensor()) self.mnist_train, self.mnist_val = random_split(dataset, [55000, 5000]) self.batch_size = batch_size diff --git a/src/pl_examples/basic_examples/backbone_image_classifier.py b/examples/pl_basics/backbone_image_classifier.py similarity index 88% rename from src/pl_examples/basic_examples/backbone_image_classifier.py rename to examples/pl_basics/backbone_image_classifier.py index 1f279ca85b4bb..be9a255cf990f 100644 --- a/src/pl_examples/basic_examples/backbone_image_classifier.py +++ b/examples/pl_basics/backbone_image_classifier.py @@ -15,21 +15,23 @@ To run: python backbone_image_classifier.py --trainer.max_epochs=50 """ +from os import path from typing import Optional import torch from torch.nn import functional as F from torch.utils.data import DataLoader, random_split -import pytorch_lightning as pl -from pl_examples import _DATASETS_PATH, cli_lightning_logo -from pl_examples.basic_examples.mnist_datamodule import MNIST +from pytorch_lightning import cli_lightning_logo, LightningDataModule, LightningModule +from pytorch_lightning.demos.mnist_datamodule import MNIST from pytorch_lightning.utilities.cli import LightningCLI from pytorch_lightning.utilities.imports import _TORCHVISION_AVAILABLE if _TORCHVISION_AVAILABLE: from torchvision import transforms +DATASETS_PATH = path.join(path.dirname(__file__), "..", "..", "Datasets") + class Backbone(torch.nn.Module): """ @@ -52,7 +54,7 @@ def forward(self, x): return x -class LitClassifier(pl.LightningModule): +class LitClassifier(LightningModule): """ >>> LitClassifier(Backbone()) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE LitClassifier( @@ -100,11 +102,11 @@ def configure_optimizers(self): return torch.optim.Adam(self.parameters(), lr=self.hparams.learning_rate) -class MyDataModule(pl.LightningDataModule): +class MyDataModule(LightningDataModule): def __init__(self, batch_size: int = 32): super().__init__() - dataset = MNIST(_DATASETS_PATH, train=True, download=True, transform=transforms.ToTensor()) - self.mnist_test = MNIST(_DATASETS_PATH, train=False, download=True, transform=transforms.ToTensor()) + dataset = MNIST(DATASETS_PATH, train=True, download=True, transform=transforms.ToTensor()) + self.mnist_test = MNIST(DATASETS_PATH, train=False, download=True, transform=transforms.ToTensor()) self.mnist_train, self.mnist_val = random_split(dataset, [55000, 5000]) self.batch_size = batch_size diff --git a/src/pl_examples/basic_examples/profiler_example.py b/examples/pl_basics/profiler_example.py similarity index 90% rename from src/pl_examples/basic_examples/profiler_example.py rename to examples/pl_basics/profiler_example.py index 2d64af61476cc..89074548683c2 100644 --- a/src/pl_examples/basic_examples/profiler_example.py +++ b/examples/pl_basics/profiler_example.py @@ -23,14 +23,14 @@ """ import sys +from os import path import torch import torchvision import torchvision.models as models import torchvision.transforms as T -from pl_examples import _DATASETS_PATH, cli_lightning_logo -from pytorch_lightning import LightningDataModule, LightningModule +from pytorch_lightning import cli_lightning_logo, LightningDataModule, LightningModule from pytorch_lightning.profiler.pytorch import PyTorchProfiler from pytorch_lightning.utilities.cli import LightningCLI @@ -43,6 +43,7 @@ "--trainer.accelerator=gpu", f"--trainer.devices={int(torch.cuda.is_available())}", ) +DATASETS_PATH = path.join(path.dirname(__file__), "..", "..", "Datasets") class ModelToProfile(LightningModule): @@ -93,13 +94,11 @@ class CIFAR10DataModule(LightningDataModule): transform = T.Compose([T.Resize(256), T.CenterCrop(224), T.ToTensor()]) def train_dataloader(self, *args, **kwargs): - trainset = torchvision.datasets.CIFAR10( - root=_DATASETS_PATH, train=True, download=True, transform=self.transform - ) + trainset = torchvision.datasets.CIFAR10(root=DATASETS_PATH, train=True, download=True, transform=self.transform) return torch.utils.data.DataLoader(trainset, batch_size=2, shuffle=True, num_workers=0) def val_dataloader(self, *args, **kwargs): - valset = torchvision.datasets.CIFAR10(root=_DATASETS_PATH, train=False, download=True, transform=self.transform) + valset = torchvision.datasets.CIFAR10(root=DATASETS_PATH, train=False, download=True, transform=self.transform) return torch.utils.data.DataLoader(valset, batch_size=2, shuffle=True, num_workers=0) diff --git a/src/pl_examples/bug_report/bug_report_model.ipynb b/examples/pl_bug_report/bug_report_model.ipynb similarity index 100% rename from src/pl_examples/bug_report/bug_report_model.ipynb rename to examples/pl_bug_report/bug_report_model.ipynb diff --git a/src/pl_examples/bug_report/bug_report_model.py b/examples/pl_bug_report/bug_report_model.py similarity index 100% rename from src/pl_examples/bug_report/bug_report_model.py rename to examples/pl_bug_report/bug_report_model.py diff --git a/src/pl_examples/domain_templates/computer_vision_fine_tuning.py b/examples/pl_domain_templates/computer_vision_fine_tuning.py similarity index 96% rename from src/pl_examples/domain_templates/computer_vision_fine_tuning.py rename to examples/pl_domain_templates/computer_vision_fine_tuning.py index cf38e5ee78d26..dc31d79ab0032 100644 --- a/src/pl_examples/domain_templates/computer_vision_fine_tuning.py +++ b/examples/pl_domain_templates/computer_vision_fine_tuning.py @@ -54,9 +54,7 @@ from torchvision.datasets import ImageFolder from torchvision.datasets.utils import download_and_extract_archive -import pytorch_lightning as pl -from pl_examples import cli_lightning_logo -from pytorch_lightning import LightningDataModule +from pytorch_lightning import cli_lightning_logo, LightningDataModule, LightningModule from pytorch_lightning.callbacks.finetuning import BaseFinetuning from pytorch_lightning.utilities.cli import LightningCLI from pytorch_lightning.utilities.rank_zero import rank_zero_info @@ -73,10 +71,10 @@ def __init__(self, milestones: tuple = (5, 10), train_bn: bool = False): self.milestones = milestones self.train_bn = train_bn - def freeze_before_training(self, pl_module: pl.LightningModule): + def freeze_before_training(self, pl_module: LightningModule): self.freeze(modules=pl_module.feature_extractor, train_bn=self.train_bn) - def finetune_function(self, pl_module: pl.LightningModule, epoch: int, optimizer: Optimizer, opt_idx: int): + def finetune_function(self, pl_module: LightningModule, epoch: int, optimizer: Optimizer, opt_idx: int): if epoch == self.milestones[0]: # unfreeze 5 last layers self.unfreeze_and_add_param_group( @@ -155,7 +153,7 @@ def val_dataloader(self): # --- Pytorch-lightning module --- -class TransferLearningModel(pl.LightningModule): +class TransferLearningModel(LightningModule): def __init__( self, backbone: str = "resnet50", diff --git a/src/pl_examples/domain_templates/generative_adversarial_net.py b/examples/pl_domain_templates/generative_adversarial_net.py similarity index 97% rename from src/pl_examples/domain_templates/generative_adversarial_net.py rename to examples/pl_domain_templates/generative_adversarial_net.py index cef2107550bdb..75a0f33b46f84 100644 --- a/src/pl_examples/domain_templates/generative_adversarial_net.py +++ b/examples/pl_domain_templates/generative_adversarial_net.py @@ -24,9 +24,9 @@ import torch.nn as nn import torch.nn.functional as F -from pl_examples import cli_lightning_logo -from pl_examples.basic_examples.mnist_datamodule import MNISTDataModule +from pytorch_lightning import cli_lightning_logo from pytorch_lightning.core import LightningModule +from pytorch_lightning.demos.mnist_datamodule import MNISTDataModule from pytorch_lightning.trainer import Trainer from pytorch_lightning.utilities.imports import _TORCHVISION_AVAILABLE @@ -130,7 +130,7 @@ def __init__( @staticmethod def add_argparse_args(parent_parser: ArgumentParser, *, use_argument_group=True): if use_argument_group: - parser = parent_parser.add_argument_group("pl.GAN") + parser = parent_parser.add_argument_group("GAN") parser_out = parent_parser else: parser = ArgumentParser(parents=[parent_parser], add_help=False) diff --git a/src/pl_examples/domain_templates/imagenet.py b/examples/pl_domain_templates/imagenet.py similarity index 100% rename from src/pl_examples/domain_templates/imagenet.py rename to examples/pl_domain_templates/imagenet.py diff --git a/src/pl_examples/domain_templates/reinforce_learn_Qnet.py b/examples/pl_domain_templates/reinforce_learn_Qnet.py similarity index 98% rename from src/pl_examples/domain_templates/reinforce_learn_Qnet.py rename to examples/pl_domain_templates/reinforce_learn_Qnet.py index 4bf53e8a3d2d5..9fd212493b0e9 100644 --- a/src/pl_examples/domain_templates/reinforce_learn_Qnet.py +++ b/examples/pl_domain_templates/reinforce_learn_Qnet.py @@ -44,8 +44,7 @@ from torch.utils.data import DataLoader from torch.utils.data.dataset import IterableDataset -import pytorch_lightning as pl -from pl_examples import cli_lightning_logo +from pytorch_lightning import cli_lightning_logo, LightningModule, seed_everything, Trainer class DQN(nn.Module): @@ -212,7 +211,7 @@ def play_step(self, net: nn.Module, epsilon: float = 0.0, device: str = "cpu") - return reward, done -class DQNLightning(pl.LightningModule): +class DQNLightning(LightningModule): """Basic DQN Model. >>> DQNLightning(env="CartPole-v1") # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE @@ -391,15 +390,14 @@ def add_model_specific_args(parent_parser): # pragma: no-cover def main(args) -> None: model = DQNLightning(**vars(args)) - trainer = pl.Trainer(accelerator="gpu", devices=1, strategy="dp", val_check_interval=100) + trainer = Trainer(accelerator="gpu", devices=1, strategy="dp", val_check_interval=100) trainer.fit(model) if __name__ == "__main__": cli_lightning_logo() - torch.manual_seed(0) - np.random.seed(0) + seed_everything(0) parser = argparse.ArgumentParser(add_help=False) parser = DQNLightning.add_model_specific_args(parser) diff --git a/src/pl_examples/domain_templates/reinforce_learn_ppo.py b/examples/pl_domain_templates/reinforce_learn_ppo.py similarity index 98% rename from src/pl_examples/domain_templates/reinforce_learn_ppo.py rename to examples/pl_domain_templates/reinforce_learn_ppo.py index a400de062bf6f..c52ac4159e15d 100644 --- a/src/pl_examples/domain_templates/reinforce_learn_ppo.py +++ b/examples/pl_domain_templates/reinforce_learn_ppo.py @@ -37,8 +37,7 @@ from torch.optim.optimizer import Optimizer from torch.utils.data import DataLoader, IterableDataset -import pytorch_lightning as pl -from pl_examples import cli_lightning_logo +from pytorch_lightning import cli_lightning_logo, LightningModule, seed_everything, Trainer def create_mlp(input_shape: Tuple[int], n_actions: int, hidden_size: int = 128): @@ -140,7 +139,7 @@ def __iter__(self) -> Iterator: return iterator -class PPOLightning(pl.LightningModule): +class PPOLightning(LightningModule): """PyTorch Lightning implementation of PPO. Example: @@ -459,16 +458,16 @@ def add_model_specific_args(parent_parser): # pragma: no-cover def main(args) -> None: model = PPOLightning(**vars(args)) - trainer = pl.Trainer.from_argparse_args(args) + trainer = Trainer.from_argparse_args(args) trainer.fit(model) if __name__ == "__main__": cli_lightning_logo() - pl.seed_everything(0) + seed_everything(0) parent_parser = argparse.ArgumentParser(add_help=False) - parent_parser = pl.Trainer.add_argparse_args(parent_parser) + parent_parser = Trainer.add_argparse_args(parent_parser) parser = PPOLightning.add_model_specific_args(parent_parser) args = parser.parse_args() diff --git a/src/pl_examples/domain_templates/semantic_segmentation.py b/examples/pl_domain_templates/semantic_segmentation.py similarity index 69% rename from src/pl_examples/domain_templates/semantic_segmentation.py rename to examples/pl_domain_templates/semantic_segmentation.py index d5a10c4faa6c5..cae48bf449a7d 100644 --- a/src/pl_examples/domain_templates/semantic_segmentation.py +++ b/examples/pl_domain_templates/semantic_segmentation.py @@ -21,11 +21,10 @@ import torch.nn.functional as F import torchvision.transforms as transforms from PIL import Image +from torch import nn from torch.utils.data import DataLoader, Dataset -import pytorch_lightning as pl -from pl_examples import cli_lightning_logo -from pl_examples.domain_templates.unet import UNet +from pytorch_lightning import cli_lightning_logo, LightningModule, Trainer from pytorch_lightning.loggers import WandbLogger DEFAULT_VOID_LABELS = (0, 1, 2, 3, 4, 5, 6, 9, 10, 14, 15, 16, 18, 29, 30, -1) @@ -68,8 +67,8 @@ class KITTI(Dataset): encoded using `encode_segmap`, and given `transform` (if any) are applied to the image only (mask does not usually require transforms, but they can be implemented in a similar way). - >>> from pl_examples import _DATASETS_PATH - >>> dataset_path = os.path.join(_DATASETS_PATH, "Kitti") + >>> from examples import DATASETS_PATH + >>> dataset_path = os.path.join(DATASETS_PATH, "Kitti") >>> _create_synth_kitti_dataset(dataset_path, image_dims=(1024, 512)) >>> KITTI(dataset_path, 'train') # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE <...semantic_segmentation.KITTI object at ...> @@ -146,7 +145,148 @@ def get_filenames(self, path): return files_list -class SegModel(pl.LightningModule): +class UNet(nn.Module): + """Architecture based on U-Net: Convolutional Networks for Biomedical Image Segmentation. + + Link - https://arxiv.org/abs/1505.04597 + + >>> UNet(num_classes=2, num_layers=3) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE + UNet( + (layers): ModuleList( + (0): DoubleConv(...) + (1): Down(...) + (2): Down(...) + (3): Up(...) + (4): Up(...) + (5): Conv2d(64, 2, kernel_size=(1, 1), stride=(1, 1)) + ) + ) + """ + + def __init__(self, num_classes: int = 19, num_layers: int = 5, features_start: int = 64, bilinear: bool = False): + """ + Args: + num_classes: Number of output classes required (default 19 for KITTI dataset) + num_layers: Number of layers in each side of U-net + features_start: Number of features in first layer + bilinear: Whether to use bilinear interpolation or transposed convolutions for upsampling. + """ + super().__init__() + self.num_layers = num_layers + + layers = [DoubleConv(3, features_start)] + + feats = features_start + for _ in range(num_layers - 1): + layers.append(Down(feats, feats * 2)) + feats *= 2 + + for _ in range(num_layers - 1): + layers.append(Up(feats, feats // 2, bilinear)) + feats //= 2 + + layers.append(nn.Conv2d(feats, num_classes, kernel_size=1)) + + self.layers = nn.ModuleList(layers) + + def forward(self, x): + xi = [self.layers[0](x)] + # Down path + for layer in self.layers[1 : self.num_layers]: + xi.append(layer(xi[-1])) + # Up path + for i, layer in enumerate(self.layers[self.num_layers : -1]): + xi[-1] = layer(xi[-1], xi[-2 - i]) + return self.layers[-1](xi[-1]) + + +class DoubleConv(nn.Module): + """Double Convolution and BN and ReLU (3x3 conv -> BN -> ReLU) ** 2. + + >>> DoubleConv(4, 4) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE + DoubleConv( + (net): Sequential(...) + ) + """ + + def __init__(self, in_ch: int, out_ch: int): + super().__init__() + self.net = nn.Sequential( + nn.Conv2d(in_ch, out_ch, kernel_size=3, padding=1), + nn.BatchNorm2d(out_ch), + nn.ReLU(inplace=True), + nn.Conv2d(out_ch, out_ch, kernel_size=3, padding=1), + nn.BatchNorm2d(out_ch), + nn.ReLU(inplace=True), + ) + + def forward(self, x): + return self.net(x) + + +class Down(nn.Module): + """Combination of MaxPool2d and DoubleConv in series. + + >>> Down(4, 8) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE + Down( + (net): Sequential( + (0): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False) + (1): DoubleConv( + (net): Sequential(...) + ) + ) + ) + """ + + def __init__(self, in_ch: int, out_ch: int): + super().__init__() + self.net = nn.Sequential(nn.MaxPool2d(kernel_size=2, stride=2), DoubleConv(in_ch, out_ch)) + + def forward(self, x): + return self.net(x) + + +class Up(nn.Module): + """Upsampling (by either bilinear interpolation or transpose convolutions) followed by concatenation of feature + map from contracting path, followed by double 3x3 convolution. + + >>> Up(8, 4) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE + Up( + (upsample): ConvTranspose2d(8, 4, kernel_size=(2, 2), stride=(2, 2)) + (conv): DoubleConv( + (net): Sequential(...) + ) + ) + """ + + def __init__(self, in_ch: int, out_ch: int, bilinear: bool = False): + super().__init__() + self.upsample = None + if bilinear: + self.upsample = nn.Sequential( + nn.Upsample(scale_factor=2, mode="bilinear", align_corners=True), + nn.Conv2d(in_ch, in_ch // 2, kernel_size=1), + ) + else: + self.upsample = nn.ConvTranspose2d(in_ch, in_ch // 2, kernel_size=2, stride=2) + + self.conv = DoubleConv(in_ch, out_ch) + + def forward(self, x1, x2): + x1 = self.upsample(x1) + + # Pad x1 to the size of x2 + diff_h = x2.shape[2] - x1.shape[2] + diff_w = x2.shape[3] - x1.shape[3] + + x1 = F.pad(x1, [diff_w // 2, diff_w - diff_w // 2, diff_h // 2, diff_h - diff_h // 2]) + + # Concatenate along the channels axis + x = torch.cat([x2, x1], dim=1) + return self.conv(x) + + +class SegModel(LightningModule): """Semantic Segmentation Module. This is a basic semantic segmentation module implemented with Lightning. @@ -158,8 +298,7 @@ class SegModel(pl.LightningModule): Adam optimizer is used along with Cosine Annealing learning rate scheduler. - >>> from pl_examples import _DATASETS_PATH - >>> dataset_path = os.path.join(_DATASETS_PATH, "Kitti") + >>> dataset_path = os.path.join(".", "Kitti") >>> _create_synth_kitti_dataset(dataset_path, image_dims=(1024, 512)) >>> SegModel(dataset_path) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE SegModel( @@ -277,7 +416,7 @@ def main(hparams: Namespace): # ------------------------ # 3 INIT TRAINER # ------------------------ - trainer = pl.Trainer.from_argparse_args(hparams) + trainer = Trainer.from_argparse_args(hparams) # ------------------------ # 5 START TRAINING diff --git a/src/pl_examples/fault_tolerant/automatic.py b/examples/pl_fault_tolerant/automatic.py similarity index 100% rename from src/pl_examples/fault_tolerant/automatic.py rename to examples/pl_fault_tolerant/automatic.py diff --git a/src/pl_examples/hpu_examples/simple_mnist/mnist.py b/examples/pl_hpu/mnist_sample.py similarity index 93% rename from src/pl_examples/hpu_examples/simple_mnist/mnist.py rename to examples/pl_hpu/mnist_sample.py index a5d4b47d6b829..de5d7c62ba1d1 100644 --- a/src/pl_examples/hpu_examples/simple_mnist/mnist.py +++ b/examples/pl_hpu/mnist_sample.py @@ -15,13 +15,13 @@ from jsonargparse import lazy_instance from torch.nn import functional as F -import pytorch_lightning as pl -from pl_examples.basic_examples.mnist_datamodule import MNISTDataModule +from pytorch_lightning import LightningModule +from pytorch_lightning.demos.mnist_datamodule import MNISTDataModule from pytorch_lightning.plugins import HPUPrecisionPlugin from pytorch_lightning.utilities.cli import LightningCLI -class LitClassifier(pl.LightningModule): +class LitClassifier(LightningModule): def __init__(self): super().__init__() self.l1 = torch.nn.Linear(28 * 28, 10) diff --git a/src/pl_examples/hpu_examples/simple_mnist/ops_bf16_mnist.txt b/examples/pl_hpu/ops_bf16_mnist.txt similarity index 100% rename from src/pl_examples/hpu_examples/simple_mnist/ops_bf16_mnist.txt rename to examples/pl_hpu/ops_bf16_mnist.txt diff --git a/src/pl_examples/hpu_examples/simple_mnist/ops_fp32_mnist.txt b/examples/pl_hpu/ops_fp32_mnist.txt similarity index 100% rename from src/pl_examples/hpu_examples/simple_mnist/ops_fp32_mnist.txt rename to examples/pl_hpu/ops_fp32_mnist.txt diff --git a/src/pl_examples/integration_examples/dali_image_classifier.py b/examples/pl_integrations/dali_image_classifier.py similarity index 91% rename from src/pl_examples/integration_examples/dali_image_classifier.py rename to examples/pl_integrations/dali_image_classifier.py index 49bebf44ca522..5d5bfc1fa9769 100644 --- a/src/pl_examples/integration_examples/dali_image_classifier.py +++ b/examples/pl_integrations/dali_image_classifier.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from abc import ABC +from os import path from random import shuffle from warnings import warn @@ -21,11 +22,10 @@ from torch.nn import functional as F from torch.utils.data import random_split -import pytorch_lightning as pl -from pl_examples import _DALI_AVAILABLE, _DATASETS_PATH, cli_lightning_logo -from pl_examples.basic_examples.mnist_datamodule import MNIST +from pytorch_lightning import cli_lightning_logo, LightningDataModule, LightningModule +from pytorch_lightning.demos.mnist_datamodule import MNIST from pytorch_lightning.utilities.cli import LightningCLI -from pytorch_lightning.utilities.imports import _TORCHVISION_AVAILABLE +from pytorch_lightning.utilities.imports import _DALI_AVAILABLE, _TORCHVISION_AVAILABLE if _TORCHVISION_AVAILABLE: from torchvision import transforms @@ -43,6 +43,8 @@ warn("NVIDIA DALI is not available") ops, Pipeline, DALIClassificationIterator, LastBatchPolicy = ..., ABC, ABC, ABC +DATASETS_PATH = path.join(path.dirname(__file__), "..", "..", "Datasets") + class ExternalMNISTInputIterator: """This iterator class wraps torchvision's MNIST dataset and returns the images and labels in batches.""" @@ -120,7 +122,7 @@ def __len__(self): return batch_count + last_batch -class LitClassifier(pl.LightningModule): +class LitClassifier(LightningModule): def __init__(self, hidden_dim: int = 128, learning_rate: float = 0.0001): super().__init__() self.save_hyperparameters() @@ -159,11 +161,11 @@ def configure_optimizers(self): return torch.optim.Adam(self.parameters(), lr=self.hparams.learning_rate) -class MyDataModule(pl.LightningDataModule): +class MyDataModule(LightningDataModule): def __init__(self, batch_size: int = 32): super().__init__() - dataset = MNIST(_DATASETS_PATH, train=True, download=True, transform=transforms.ToTensor()) - self.mnist_test = MNIST(_DATASETS_PATH, train=False, download=True, transform=transforms.ToTensor()) + dataset = MNIST(DATASETS_PATH, train=True, download=True, transform=transforms.ToTensor()) + self.mnist_test = MNIST(DATASETS_PATH, train=False, download=True, transform=transforms.ToTensor()) self.mnist_train, self.mnist_val = random_split(dataset, [55000, 5000]) eii_train = ExternalMNISTInputIterator(self.mnist_train, batch_size) diff --git a/src/pl_examples/ipu_examples/mnist.py b/examples/pl_ipu/mnist_sample.py similarity index 92% rename from src/pl_examples/ipu_examples/mnist.py rename to examples/pl_ipu/mnist_sample.py index 3935269ea029c..56835afec5f64 100644 --- a/src/pl_examples/ipu_examples/mnist.py +++ b/examples/pl_ipu/mnist_sample.py @@ -15,11 +15,11 @@ import torch from torch.nn import functional as F -import pytorch_lightning as pl -from pl_examples.basic_examples.mnist_datamodule import MNISTDataModule +from pytorch_lightning import LightningModule, Trainer +from pytorch_lightning.demos.mnist_datamodule import MNISTDataModule -class LitClassifier(pl.LightningModule): +class LitClassifier(LightningModule): def __init__(self, hidden_dim: int = 128, learning_rate: float = 0.0001): super().__init__() self.save_hyperparameters() @@ -78,7 +78,7 @@ def configure_optimizers(self): model = LitClassifier() - trainer = pl.Trainer(max_epochs=2, accelerator="ipu", devices=8) + trainer = Trainer(max_epochs=2, accelerator="ipu", devices=8) trainer.fit(model, datamodule=dm) trainer.test(model, datamodule=dm) diff --git a/src/pl_examples/loop_examples/kfold.py b/examples/pl_loops/kfold.py similarity index 90% rename from src/pl_examples/loop_examples/kfold.py rename to examples/pl_loops/kfold.py index 9603f072e6cae..028e0be698972 100644 --- a/src/pl_examples/loop_examples/kfold.py +++ b/examples/pl_loops/kfold.py @@ -15,6 +15,7 @@ from abc import ABC, abstractmethod from copy import deepcopy from dataclasses import dataclass +from os import path from typing import Any, Dict, List, Optional, Type import torch @@ -26,15 +27,16 @@ from torch.utils.data.dataset import Dataset, Subset from torchmetrics.classification.accuracy import Accuracy -from pl_examples import _DATASETS_PATH -from pl_examples.basic_examples.mnist_datamodule import MNIST -from pl_examples.basic_examples.mnist_examples.image_classifier_4_lightning_module import ImageClassifier from pytorch_lightning import LightningDataModule, seed_everything, Trainer from pytorch_lightning.core.module import LightningModule +from pytorch_lightning.demos.boring_classes import Net +from pytorch_lightning.demos.mnist_datamodule import MNIST from pytorch_lightning.loops.fit_loop import FitLoop from pytorch_lightning.loops.loop import Loop from pytorch_lightning.trainer.states import TrainerFn +DATASETS_PATH = path.join(path.dirname(__file__), "..", "..", "Datasets") + ############################################################################################# # KFold Loop / Cross Validation Example # # This example demonstrates how to leverage Lightning Loop Customization introduced in v1.5 # @@ -79,11 +81,11 @@ class MNISTKFoldDataModule(BaseKFoldDataModule): def prepare_data(self) -> None: # download the data. - MNIST(_DATASETS_PATH, transform=T.Compose([T.ToTensor(), T.Normalize(mean=(0.5,), std=(0.5,))])) + MNIST(DATASETS_PATH, transform=T.Compose([T.ToTensor(), T.Normalize(mean=(0.5,), std=(0.5,))])) def setup(self, stage: Optional[str] = None) -> None: # load the data - dataset = MNIST(_DATASETS_PATH, transform=T.Compose([T.ToTensor(), T.Normalize(mean=(0.5,), std=(0.5,))])) + dataset = MNIST(DATASETS_PATH, transform=T.Compose([T.ToTensor(), T.Normalize(mean=(0.5,), std=(0.5,))])) self.train_dataset, self.test_dataset = random_split(dataset, [50000, 10000]) def setup_folds(self, num_folds: int) -> None: @@ -243,11 +245,23 @@ def __setstate__(self, state: Dict[str, Any]) -> None: self.__dict__.update(state) -class LitImageClassifier(ImageClassifier): - def __init__(self) -> None: +class LitImageClassifier(LightningModule): + def __init__(self, model, lr=1.0, gamma=0.7, batch_size=32): super().__init__() + self.save_hyperparameters(ignore="model") + self.model = model or Net() + self.test_acc = Accuracy() self.val_acc = Accuracy() + def forward(self, x): + return self.model(x) + + def training_step(self, batch, batch_idx): + x, y = batch + logits = self.forward(x) + loss = F.nll_loss(logits, y.long()) + return loss + def validation_step(self, batch: Any, batch_idx: int) -> None: x, y = batch logits = self.forward(x) @@ -256,6 +270,18 @@ def validation_step(self, batch: Any, batch_idx: int) -> None: self.log("val_acc", self.val_acc) self.log("val_loss", loss) + def test_step(self, batch, batch_idx): + x, y = batch + logits = self.forward(x) + loss = F.nll_loss(logits, y.long()) + self.test_acc(logits, y) + self.log("test_acc", self.test_acc) + self.log("test_loss", loss) + + def configure_optimizers(self): + optimizer = torch.optim.Adadelta(self.model.parameters(), lr=self.hparams.lr) + return [optimizer], [torch.optim.lr_scheduler.StepLR(optimizer, step_size=1, gamma=self.hparams.gamma)] + ############################################################################################# # Step 5 / 5: Connect the KFoldLoop to the Trainer # diff --git a/src/pl_examples/loop_examples/mnist_lite.py b/examples/pl_loops/mnist_lite.py similarity index 93% rename from src/pl_examples/loop_examples/mnist_lite.py rename to examples/pl_loops/mnist_lite.py index 4d59ef326f408..9310705508cb3 100644 --- a/src/pl_examples/loop_examples/mnist_lite.py +++ b/examples/pl_loops/mnist_lite.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import argparse +from os import path from typing import Any import torch @@ -21,12 +22,14 @@ from torch.optim.lr_scheduler import StepLR from torchmetrics import Accuracy -from pl_examples.basic_examples.mnist_datamodule import MNIST -from pl_examples.basic_examples.mnist_examples.image_classifier_1_pytorch import Net from pytorch_lightning import seed_everything +from pytorch_lightning.demos.boring_classes import Net +from pytorch_lightning.demos.mnist_datamodule import MNIST from pytorch_lightning.lite import LightningLite from pytorch_lightning.loops import Loop +DATASETS_PATH = path.join(path.dirname(__file__), "..", "..", "Datasets") + class TrainLoop(Loop): def __init__(self, lite, args, model, optimizer, scheduler, dataloader): @@ -139,10 +142,10 @@ class Lite(LightningLite): def run(self, hparams): transform = T.Compose([T.ToTensor(), T.Normalize((0.1307,), (0.3081,))]) if self.is_global_zero: - MNIST("./data", download=True) + MNIST(DATASETS_PATH, download=True) self.barrier() - train_dataset = MNIST("./data", train=True, transform=transform) - test_dataset = MNIST("./data", train=False, transform=transform) + train_dataset = MNIST(DATASETS_PATH, train=True, transform=transform) + test_dataset = MNIST(DATASETS_PATH, train=False, transform=transform) train_loader = torch.utils.data.DataLoader(train_dataset, hparams.batch_size) test_loader = torch.utils.data.DataLoader(test_dataset, hparams.test_batch_size) diff --git a/src/pl_examples/loop_examples/yielding_training_step.py b/examples/pl_loops/yielding_training_step.py similarity index 64% rename from src/pl_examples/loop_examples/yielding_training_step.py rename to examples/pl_loops/yielding_training_step.py index 52abf768fea4d..7fedf72c4ebda 100644 --- a/src/pl_examples/loop_examples/yielding_training_step.py +++ b/examples/pl_loops/yielding_training_step.py @@ -12,17 +12,23 @@ # See the License for the specific language governing permissions and # limitations under the License. import inspect +from argparse import ArgumentParser from functools import partial -from typing import Generator +import numpy as np import torch +import torch.nn as nn +import torch.nn.functional as F -from pl_examples.domain_templates.generative_adversarial_net import GAN as GANTemplate -from pl_examples.domain_templates.generative_adversarial_net import MNISTDataModule -from pytorch_lightning import Trainer +from pytorch_lightning import LightningModule, Trainer +from pytorch_lightning.demos.mnist_datamodule import MNISTDataModule from pytorch_lightning.loops import OptimizerLoop from pytorch_lightning.loops.optimization.optimizer_loop import ClosureResult from pytorch_lightning.utilities.exceptions import MisconfigurationException +from pytorch_lightning.utilities.imports import _TORCHVISION_AVAILABLE + +if _TORCHVISION_AVAILABLE: + import torchvision ############################################################################################# # Yield Loop # @@ -108,7 +114,119 @@ def _training_step(self, generator): ############################################################################################# -class GAN(GANTemplate): +class Generator(nn.Module): + """ + >>> Generator(img_shape=(1, 8, 8)) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE + Generator( + (model): Sequential(...) + ) + """ + + def __init__(self, latent_dim: int = 100, img_shape: tuple = (1, 28, 28)): + super().__init__() + self.img_shape = img_shape + + def block(in_feat, out_feat, normalize=True): + layers = [nn.Linear(in_feat, out_feat)] + if normalize: + layers.append(nn.BatchNorm1d(out_feat, 0.8)) + layers.append(nn.LeakyReLU(0.2, inplace=True)) + return layers + + self.model = nn.Sequential( + *block(latent_dim, 128, normalize=False), + *block(128, 256), + *block(256, 512), + *block(512, 1024), + nn.Linear(1024, int(np.prod(img_shape))), + nn.Tanh(), + ) + + def forward(self, z): + img = self.model(z) + img = img.view(img.size(0), *self.img_shape) + return img + + +class Discriminator(nn.Module): + """ + >>> Discriminator(img_shape=(1, 28, 28)) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE + Discriminator( + (model): Sequential(...) + ) + """ + + def __init__(self, img_shape): + super().__init__() + + self.model = nn.Sequential( + nn.Linear(int(np.prod(img_shape)), 512), + nn.LeakyReLU(0.2, inplace=True), + nn.Linear(512, 256), + nn.LeakyReLU(0.2, inplace=True), + nn.Linear(256, 1), + ) + + def forward(self, img): + img_flat = img.view(img.size(0), -1) + validity = self.model(img_flat) + + return validity + + +class GAN(LightningModule): + """ + >>> GAN(img_shape=(1, 8, 8)) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE + GAN( + (generator): Generator( + (model): Sequential(...) + ) + (discriminator): Discriminator( + (model): Sequential(...) + ) + ) + """ + + def __init__( + self, + img_shape: tuple = (1, 28, 28), + lr: float = 0.0002, + b1: float = 0.5, + b2: float = 0.999, + latent_dim: int = 100, + ): + super().__init__() + + self.save_hyperparameters() + + # networks + self.generator = Generator(latent_dim=self.hparams.latent_dim, img_shape=img_shape) + self.discriminator = Discriminator(img_shape=img_shape) + + self.validation_z = torch.randn(8, self.hparams.latent_dim) + + self.example_input_array = torch.zeros(2, self.hparams.latent_dim) + + @staticmethod + def add_argparse_args(parent_parser: ArgumentParser, *, use_argument_group=True): + if use_argument_group: + parser = parent_parser.add_argument_group("GAN") + parser_out = parent_parser + else: + parser = ArgumentParser(parents=[parent_parser], add_help=False) + parser_out = parser + parser.add_argument("--lr", type=float, default=0.0002, help="adam: learning rate") + parser.add_argument("--b1", type=float, default=0.5, help="adam: decay of first order momentum of gradient") + parser.add_argument("--b2", type=float, default=0.999, help="adam: decay of second order momentum of gradient") + parser.add_argument("--latent_dim", type=int, default=100, help="dimensionality of the latent space") + return parser_out + + def forward(self, z): + return self.generator(z) + + @staticmethod + def adversarial_loss(y_hat, y): + return F.binary_cross_entropy_with_logits(y_hat, y) # This training_step method is now a Python generator def training_step(self, batch, batch_idx, optimizer_idx=0) -> Generator: @@ -145,6 +263,24 @@ def training_step(self, batch, batch_idx, optimizer_idx=0) -> Generator: yield d_loss + def configure_optimizers(self): + lr = self.hparams.lr + b1 = self.hparams.b1 + b2 = self.hparams.b2 + + opt_g = torch.optim.Adam(self.generator.parameters(), lr=lr, betas=(b1, b2)) + opt_d = torch.optim.Adam(self.discriminator.parameters(), lr=lr, betas=(b1, b2)) + return [opt_g, opt_d], [] + + def on_train_epoch_end(self): + z = self.validation_z.type_as(self.generator.model[0].weight) + + # log sampled images + sample_imgs = self(z) + grid = torchvision.utils.make_grid(sample_imgs) + for logger in self.loggers: + logger.experiment.add_image("generated_images", grid, self.current_epoch) + ############################################################################################# # Step 3 / 3: Connect the loop to the Trainer # diff --git a/src/pl_examples/run_examples.sh b/examples/run_examples.sh similarity index 100% rename from src/pl_examples/run_examples.sh rename to examples/run_examples.sh diff --git a/src/pl_examples/test_examples.py b/examples/test_examples.py similarity index 89% rename from src/pl_examples/test_examples.py rename to examples/test_examples.py index c918b9561c936..a47ed2b771634 100644 --- a/src/pl_examples/test_examples.py +++ b/examples/test_examples.py @@ -16,8 +16,7 @@ import pytest import torch -from pl_examples import _DALI_AVAILABLE -from pytorch_lightning.utilities.imports import _IS_WINDOWS +from pytorch_lightning.utilities.imports import _DALI_AVAILABLE, _IS_WINDOWS ARGS_DEFAULT = ( "--trainer.default_root_dir %(tmpdir)s " @@ -36,7 +35,7 @@ @pytest.mark.skipif(_IS_WINDOWS, reason="Not supported on Windows") @pytest.mark.parametrize("cli_args", [ARGS_GPU]) def test_examples_mnist_dali(tmpdir, cli_args): - from pl_examples.integration_examples.dali_image_classifier import cli_main + from examples.pl_integrations.dali_image_classifier import cli_main # update the temp dir cli_args = cli_args % {"tmpdir": tmpdir} diff --git a/src/pl_examples/README.md b/src/pl_examples/README.md deleted file mode 100644 index 307075828fd1f..0000000000000 --- a/src/pl_examples/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# Examples - -Our most robust examples showing all sorts of implementations -can be found in our sister library [Lightning Bolts](https://pytorch-lightning.readthedocs.io/en/latest/ecosystem/bolts.html). - -______________________________________________________________________ - -## MNIST Examples - -5 MNIST examples showing how to gradually convert from pure PyTorch to PyTorch Lightning. - -The transition through [LightningLite](https://pytorch-lightning.readthedocs.io/en/latest/starter/lightning_lite.html) from pure PyTorch is optional but it might be helpful to learn about it. - -- [MNIST with vanilla PyTorch](./basic_examples/mnist_examples/image_classifier_1_pytorch.py) -- [MNIST with LightningLite](./basic_examples/mnist_examples/image_classifier_2_lite.py) -- [MNIST LightningLite to LightningModule](./basic_examples/mnist_examples/image_classifier_3_lite_to_lightning_module.py) -- [MNIST with LightningModule](./basic_examples/mnist_examples/image_classifier_4_lightning_module.py) -- [MNIST with LightningModule + LightningDataModule](./basic_examples/mnist_examples/image_classifier_5_lightning_datamodule.py) - -______________________________________________________________________ - -## Basic Examples - -In this folder, we have 2 simple examples: - -- [Image Classifier](./basic_examples/backbone_image_classifier.py) (trains arbitrary datasets with arbitrary backbones). -- [Image Classifier + DALI](./basic_examples/mnist_examples/image_classifier_4_dali.py) (defines the model inside the `LightningModule`). -- [Autoencoder](./basic_examples/autoencoder.py) - -______________________________________________________________________ - -## Domain Examples - -This folder contains older examples. You should instead use the examples -in [Lightning Bolts](https://pytorch-lightning.readthedocs.io/en/latest/ecosystem/bolts.html) -for advanced use cases. - -______________________________________________________________________ - -## Basic Examples - -In this folder, we have 1 simple example: - -- [Image Classifier + DALI](./integration_examples/dali_image_classifier.py) (defines the model inside the `LightningModule`). - -______________________________________________________________________ - -## Loop examples - -Contains implementations leveraging [loop customization](https://pytorch-lightning.readthedocs.io/en/latest/extensions/loops.html) to enhance the Trainer with new optimization routines. - -- [K-fold Cross Validation Loop](./loop_examples/kfold.py): Implementation of cross validation in a loop and special datamodule. -- [Yield Loop](./loop_examples/yielding_training_step.py): Enables yielding from the training_step like in a Python generator. Useful for automatic optimization with multiple optimizers. diff --git a/src/pl_examples/__init__.py b/src/pl_examples/__init__.py deleted file mode 100644 index 088caed5e5e39..0000000000000 --- a/src/pl_examples/__init__.py +++ /dev/null @@ -1,52 +0,0 @@ -import os - -from six.moves import urllib - -from pytorch_lightning.utilities import _module_available - -# TorchVision hotfix https://github.com/pytorch/vision/issues/1938 -opener = urllib.request.build_opener() -opener.addheaders = [("User-agent", "Mozilla/5.0")] -urllib.request.install_opener(opener) - -_EXAMPLES_ROOT = os.path.dirname(__file__) -_PACKAGE_ROOT = os.path.dirname(_EXAMPLES_ROOT) -_DATASETS_PATH = os.path.join(_PACKAGE_ROOT, "Datasets") - -_DALI_AVAILABLE = _module_available("nvidia.dali") - -LIGHTNING_LOGO = """ - #### - ########### - #################### - ############################ - ##################################### -############################################## -######################### ################### -####################### ################### -#################### #################### -################## ##################### -################ ###################### -##################### ################# -###################### ################### -##################### ##################### -#################### ####################### -################### ######################### -############################################## - ##################################### - ############################ - #################### - ########## - #### -""" - - -def nice_print(msg, last=False): - print() - print("\033[0;35m" + msg + "\033[0m") - if last: - print() - - -def cli_lightning_logo(): - nice_print(LIGHTNING_LOGO) diff --git a/src/pl_examples/basic_examples/__init__.py b/src/pl_examples/basic_examples/__init__.py deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/pl_examples/basic_examples/mnist_examples/__init__.py b/src/pl_examples/basic_examples/mnist_examples/__init__.py deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/pl_examples/domain_templates/__init__.py b/src/pl_examples/domain_templates/__init__.py deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/pl_examples/domain_templates/unet.py b/src/pl_examples/domain_templates/unet.py deleted file mode 100644 index 6714699883ab4..0000000000000 --- a/src/pl_examples/domain_templates/unet.py +++ /dev/null @@ -1,158 +0,0 @@ -# Copyright The PyTorch Lightning team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import torch -import torch.nn as nn -import torch.nn.functional as F - - -class UNet(nn.Module): - """Architecture based on U-Net: Convolutional Networks for Biomedical Image Segmentation. - - Link - https://arxiv.org/abs/1505.04597 - - >>> UNet(num_classes=2, num_layers=3) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE - UNet( - (layers): ModuleList( - (0): DoubleConv(...) - (1): Down(...) - (2): Down(...) - (3): Up(...) - (4): Up(...) - (5): Conv2d(64, 2, kernel_size=(1, 1), stride=(1, 1)) - ) - ) - """ - - def __init__(self, num_classes: int = 19, num_layers: int = 5, features_start: int = 64, bilinear: bool = False): - """ - Args: - num_classes: Number of output classes required (default 19 for KITTI dataset) - num_layers: Number of layers in each side of U-net - features_start: Number of features in first layer - bilinear: Whether to use bilinear interpolation or transposed convolutions for upsampling. - """ - super().__init__() - self.num_layers = num_layers - - layers = [DoubleConv(3, features_start)] - - feats = features_start - for _ in range(num_layers - 1): - layers.append(Down(feats, feats * 2)) - feats *= 2 - - for _ in range(num_layers - 1): - layers.append(Up(feats, feats // 2, bilinear)) - feats //= 2 - - layers.append(nn.Conv2d(feats, num_classes, kernel_size=1)) - - self.layers = nn.ModuleList(layers) - - def forward(self, x): - xi = [self.layers[0](x)] - # Down path - for layer in self.layers[1 : self.num_layers]: - xi.append(layer(xi[-1])) - # Up path - for i, layer in enumerate(self.layers[self.num_layers : -1]): - xi[-1] = layer(xi[-1], xi[-2 - i]) - return self.layers[-1](xi[-1]) - - -class DoubleConv(nn.Module): - """Double Convolution and BN and ReLU (3x3 conv -> BN -> ReLU) ** 2. - - >>> DoubleConv(4, 4) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE - DoubleConv( - (net): Sequential(...) - ) - """ - - def __init__(self, in_ch: int, out_ch: int): - super().__init__() - self.net = nn.Sequential( - nn.Conv2d(in_ch, out_ch, kernel_size=3, padding=1), - nn.BatchNorm2d(out_ch), - nn.ReLU(inplace=True), - nn.Conv2d(out_ch, out_ch, kernel_size=3, padding=1), - nn.BatchNorm2d(out_ch), - nn.ReLU(inplace=True), - ) - - def forward(self, x): - return self.net(x) - - -class Down(nn.Module): - """Combination of MaxPool2d and DoubleConv in series. - - >>> Down(4, 8) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE - Down( - (net): Sequential( - (0): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False) - (1): DoubleConv( - (net): Sequential(...) - ) - ) - ) - """ - - def __init__(self, in_ch: int, out_ch: int): - super().__init__() - self.net = nn.Sequential(nn.MaxPool2d(kernel_size=2, stride=2), DoubleConv(in_ch, out_ch)) - - def forward(self, x): - return self.net(x) - - -class Up(nn.Module): - """Upsampling (by either bilinear interpolation or transpose convolutions) followed by concatenation of feature - map from contracting path, followed by double 3x3 convolution. - - >>> Up(8, 4) # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE - Up( - (upsample): ConvTranspose2d(8, 4, kernel_size=(2, 2), stride=(2, 2)) - (conv): DoubleConv( - (net): Sequential(...) - ) - ) - """ - - def __init__(self, in_ch: int, out_ch: int, bilinear: bool = False): - super().__init__() - self.upsample = None - if bilinear: - self.upsample = nn.Sequential( - nn.Upsample(scale_factor=2, mode="bilinear", align_corners=True), - nn.Conv2d(in_ch, in_ch // 2, kernel_size=1), - ) - else: - self.upsample = nn.ConvTranspose2d(in_ch, in_ch // 2, kernel_size=2, stride=2) - - self.conv = DoubleConv(in_ch, out_ch) - - def forward(self, x1, x2): - x1 = self.upsample(x1) - - # Pad x1 to the size of x2 - diff_h = x2.shape[2] - x1.shape[2] - diff_w = x2.shape[3] - x1.shape[3] - - x1 = F.pad(x1, [diff_w // 2, diff_w - diff_w // 2, diff_h // 2, diff_h - diff_h // 2]) - - # Concatenate along the channels axis - x = torch.cat([x2, x1], dim=1) - return self.conv(x) diff --git a/src/pl_examples/integration_examples/__init__.py b/src/pl_examples/integration_examples/__init__.py deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/pl_examples/ipu_examples/__init__.py b/src/pl_examples/ipu_examples/__init__.py deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/pl_examples/loop_examples/__init__.py b/src/pl_examples/loop_examples/__init__.py deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/pytorch_lightning/utilities/imports.py b/src/pytorch_lightning/utilities/imports.py index 83850f8e7415a..90ff3e076ab02 100644 --- a/src/pytorch_lightning/utilities/imports.py +++ b/src/pytorch_lightning/utilities/imports.py @@ -134,6 +134,7 @@ def __repr__(self) -> str: _APEX_AVAILABLE = _module_available("apex.amp") _BAGUA_AVAILABLE = _package_available("bagua") +_DALI_AVAILABLE = _module_available("nvidia.dali") _DEEPSPEED_AVAILABLE = _package_available("deepspeed") _DEEPSPEED_GREATER_EQUAL_0_5_9 = _DEEPSPEED_AVAILABLE and _compare_version("deepspeed", operator.ge, "0.5.9") _DEEPSPEED_GREATER_EQUAL_0_6 = _DEEPSPEED_AVAILABLE and _compare_version("deepspeed", operator.ge, "0.6.0") From 180e330d16d32e84b0a26ada27e0d6724851e9a5 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 9 Jun 2022 23:32:58 +0200 Subject: [PATCH 17/20] update CI for examples --- .azure-pipelines/gpu-benchmark.yml | 16 ++++--- .azure-pipelines/gpu-tests.yml | 9 ++-- .azure-pipelines/hpu-tests.yml | 4 +- .azure-pipelines/ipu-tests.yml | 3 +- .github/ISSUE_TEMPLATE/bug_report.md | 4 +- .github/workflows/ci_test-full.yml | 18 ++++---- Makefile | 2 +- dockers/nvidia/Dockerfile | 2 +- dockers/release/Dockerfile | 2 +- .../accelerators/hpu_intermediate.rst | 2 +- docs/source-PL/accelerators/ipu_basic.rst | 2 +- docs/source-PL/clouds/cluster_advanced.rst | 2 +- .../clouds/fault_tolerant_training_faq.rst | 2 +- docs/source-PL/extensions/loops.rst | 4 +- docs/source-PL/starter/lightning_lite.rst | 2 +- {src => examples}/run_ddp_examples.sh | 4 +- examples/run_examples.sh | 39 ----------------- examples/run_pl_examples.sh | 39 +++++++++++++++++ .../{test_examples.py => test_pl_examples.py} | 0 pyproject.toml | 2 +- src/pytorch_lightning/__init__.py | 4 +- .../demos/mnist_datamodule.py | 43 ++++++++++--------- test/README.md | 2 +- 23 files changed, 106 insertions(+), 101 deletions(-) rename {src => examples}/run_ddp_examples.sh (73%) delete mode 100644 examples/run_examples.sh create mode 100644 examples/run_pl_examples.sh rename examples/{test_examples.py => test_pl_examples.py} (100%) diff --git a/.azure-pipelines/gpu-benchmark.yml b/.azure-pipelines/gpu-benchmark.yml index bc37e7b300232..edb41147594c6 100644 --- a/.azure-pipelines/gpu-benchmark.yml +++ b/.azure-pipelines/gpu-benchmark.yml @@ -35,8 +35,14 @@ jobs: clean: all steps: - - bash: python -m pytest unittests_pl/benchmarks -v --durations=0 - env: - PL_RUNNING_BENCHMARKS: 1 - workingDirectory: test - displayName: 'Testing: benchmarks' + + - bash: | + pip install -e . -r requirements/strategies.txt + pip list + displayName: 'Install package' + + - bash: python -m pytest unittests_pl/benchmarks -v --durations=0 + env: + PL_RUNNING_BENCHMARKS: 1 + workingDirectory: test + displayName: 'Testing: benchmarks' diff --git a/.azure-pipelines/gpu-tests.yml b/.azure-pipelines/gpu-tests.yml index 8a0214a962d2c..95df07821237a 100644 --- a/.azure-pipelines/gpu-tests.yml +++ b/.azure-pipelines/gpu-tests.yml @@ -115,11 +115,10 @@ jobs: - script: | set -e bash run_ddp_examples.sh - python -m pytest pl_examples -v --maxfail=2 --durations=0 - bash pl_examples/run_examples.sh --trainer.accelerator=gpu --trainer.devices=1 - bash pl_examples/run_examples.sh --trainer.accelerator=gpu --trainer.devices=2 --trainer.strategy=ddp - bash pl_examples/run_examples.sh --trainer.accelerator=gpu --trainer.devices=2 --trainer.strategy=ddp --trainer.precision=16 - workingDirectory: src + bash run_pl_examples.sh --trainer.accelerator=gpu --trainer.devices=1 + bash run_pl_examples.sh --trainer.accelerator=gpu --trainer.devices=2 --trainer.strategy=ddp + bash run_pl_examples.sh --trainer.accelerator=gpu --trainer.devices=2 --trainer.strategy=ddp --trainer.precision=16 + workingDirectory: examples env: PL_USE_MOCKED_MNIST: "1" displayName: 'Testing: examples' diff --git a/.azure-pipelines/hpu-tests.yml b/.azure-pipelines/hpu-tests.yml index 91b717d45820a..3b4ae881373c4 100644 --- a/.azure-pipelines/hpu-tests.yml +++ b/.azure-pipelines/hpu-tests.yml @@ -56,8 +56,8 @@ jobs: - bash: | export PYTHONPATH="${PYTHONPATH}:$(pwd)" - python "pl_examples/hpu_examples/simple_mnist/mnist.py" - workingDirectory: src + python "pl_hpu/mnist_sample.py" + workingDirectory: examples displayName: 'Testing: HPU examples' - task: PublishTestResults@2 diff --git a/.azure-pipelines/ipu-tests.yml b/.azure-pipelines/ipu-tests.yml index f74199f573eeb..bd6118f6b44a4 100644 --- a/.azure-pipelines/ipu-tests.yml +++ b/.azure-pipelines/ipu-tests.yml @@ -55,8 +55,7 @@ jobs: export GIT_TERMINAL_PROMPT=1 python ./requirements/adjust-versions.py requirements/extra.txt python ./requirements/adjust-versions.py requirements/examples.txt - pip install -e . - pip install . --requirement ./requirements/devel.txt + pip install -e . --requirement ./requirements/devel.txt pip list displayName: 'Install dependencies' diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index d1b47ccb71b6e..73f09d8bf3580 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -16,11 +16,11 @@ assignees: '' Please reproduce using the BoringModel! You can use the following Colab link: -https://colab.research.google.com/github/PytorchLightning/pytorch-lightning/blob/master/pl_examples/bug_report/bug_report_model.ipynb +https://colab.research.google.com/github/PytorchLightning/pytorch-lightning/blob/master/examples/pl_bug_report/bug_report_model.ipynb IMPORTANT: has to be public. or this simple template: -https://github.com/PyTorchLightning/pytorch-lightning/blob/master/pl_examples/bug_report/bug_report_model.py +https://github.com/PyTorchLightning/pytorch-lightning/blob/master/examples/pl_bug_report/bug_report_model.py If you could not reproduce using the BoringModel and still think there's a bug, please post here but remember, bugs with code are fixed faster! diff --git a/.github/workflows/ci_test-full.yml b/.github/workflows/ci_test-full.yml index 03901381cc7c8..a1c16742fcbd8 100644 --- a/.github/workflows/ci_test-full.yml +++ b/.github/workflows/ci_test-full.yml @@ -131,6 +131,13 @@ jobs: # NOTE: do not include coverage report here, see: https://github.com/nedbat/coveragepy/issues/1003 run: coverage run --source pytorch_lightning -m pytest unittests_pl -v --durations=50 --junitxml=results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}.xml + - name: Upload pytest results + uses: actions/upload-artifact@v2 + with: + name: unittest-results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }} + path: test/results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}.xml + if: failure() + - name: Prepare Examples run: | # adjust versions according installed Torch version @@ -138,15 +145,8 @@ jobs: pip install -r requirements/examples.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --upgrade - name: Run Examples - working-directory: ./src - run: python -m pytest pl_examples -v --durations=10 - - - name: Upload pytest results - uses: actions/upload-artifact@v2 - with: - name: unittest-results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }} - path: test/results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}.xml - if: failure() + working-directory: ./examples + run: python -m pytest test_pl_examples.py -v --durations=10 - name: Statistics if: success() diff --git a/Makefile b/Makefile index 8af270c534d7d..0f5f62e6b6e49 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ test: clean pip install -r requirements/devel.txt pip install -r requirements/strategies.txt # run tests with coverage - python -m coverage run --source pytorch_lightning -m pytest pytorch_lightning tests pl_examples -v + python -m coverage run --source pytorch_lightning -m pytest pytorch_lightning tests -v python -m coverage report docs: clean diff --git a/dockers/nvidia/Dockerfile b/dockers/nvidia/Dockerfile index 6848f6cf34eae..f23fd4d240a85 100644 --- a/dockers/nvidia/Dockerfile +++ b/dockers/nvidia/Dockerfile @@ -38,7 +38,7 @@ RUN \ fi && \ # save the examples mv pytorch-lightning/_notebooks/.notebooks/ notebooks && \ - mv pytorch-lightning/pl_examples . && \ + mv pytorch-lightning/examples . && \ # Installations \ pip install -q fire && \ diff --git a/dockers/release/Dockerfile b/dockers/release/Dockerfile index 6093f745ab086..ec34ab825f5d8 100644 --- a/dockers/release/Dockerfile +++ b/dockers/release/Dockerfile @@ -27,7 +27,7 @@ COPY ./ /home/pytorch-lightning/ RUN \ cd /home && \ mv pytorch-lightning/_notebooks notebooks && \ - mv pytorch-lightning/src/pl_examples . && \ + mv pytorch-lightning/examples . && \ # replace by specific version if asked if [ ! -z "$LIGHTNING_VERSION" ] ; then \ rm -rf pytorch-lightning ; \ diff --git a/docs/source-PL/accelerators/hpu_intermediate.rst b/docs/source-PL/accelerators/hpu_intermediate.rst index 65dca85479407..0e08683211431 100644 --- a/docs/source-PL/accelerators/hpu_intermediate.rst +++ b/docs/source-PL/accelerators/hpu_intermediate.rst @@ -45,7 +45,7 @@ This enables advanced users to provide their own BF16 and FP32 operator list ins accelerator="hpu", devices=1, # Optional Habana mixed precision params to be set - # Checkout `pl_examples/hpu_examples/simple_mnist/ops_bf16_mnist.txt` for the format + # Checkout `examples/pl_hpu/ops_bf16_mnist.txt` for the format plugins=[ HPUPrecisionPlugin( precision=16, diff --git a/docs/source-PL/accelerators/ipu_basic.rst b/docs/source-PL/accelerators/ipu_basic.rst index 492c7bf27ade6..523b000a35b5f 100644 --- a/docs/source-PL/accelerators/ipu_basic.rst +++ b/docs/source-PL/accelerators/ipu_basic.rst @@ -60,7 +60,7 @@ Known limitations Currently there are some known limitations that are being addressed in the near future to make the experience seamless when moving from different devices. -Please see the `MNIST example `__ which displays most of the limitations and how to overcome them till they are resolved. +Please see the `MNIST example `__ which displays most of the limitations and how to overcome them till they are resolved. * ``self.log`` is not supported in the ``training_step``, ``validation_step``, ``test_step`` or ``predict_step``. This is due to the step function being traced and sent to the IPU devices. We're actively working on fixing this * Multiple optimizers are not supported. ``training_step`` only supports returning one loss from the ``training_step`` function as a result diff --git a/docs/source-PL/clouds/cluster_advanced.rst b/docs/source-PL/clouds/cluster_advanced.rst index bb15cbbe18a89..5999b17b39150 100644 --- a/docs/source-PL/clouds/cluster_advanced.rst +++ b/docs/source-PL/clouds/cluster_advanced.rst @@ -134,7 +134,7 @@ in a `HyperOptArgumentParser Here is an example where you run a grid search of 9 combinations of hyperparameters. See also the multi-node examples -`here `__. +`here `__. .. code-block:: python diff --git a/docs/source-PL/clouds/fault_tolerant_training_faq.rst b/docs/source-PL/clouds/fault_tolerant_training_faq.rst index 4f2bdf436a06d..5501d76b0b084 100644 --- a/docs/source-PL/clouds/fault_tolerant_training_faq.rst +++ b/docs/source-PL/clouds/fault_tolerant_training_faq.rst @@ -93,7 +93,7 @@ If you believe this to be useful, please open a `feature request `_ +On tiny models like the `BoringModel and RandomDataset `_ which has virtually no data loading and processing overhead, we noticed up to 50% longer training time with fault tolerance enabled. In this worst-case scenario, fault-tolerant adds an overhead that is noticeable in comparison to the compute time for dataloading itself. However, for more realistic training workloads where data loading and preprocessing is more expensive, the constant overhead that fault tolerance adds becomes less noticeable or not noticeable at all. diff --git a/docs/source-PL/extensions/loops.rst b/docs/source-PL/extensions/loops.rst index bb5c701900a07..48c803e64ce21 100644 --- a/docs/source-PL/extensions/loops.rst +++ b/docs/source-PL/extensions/loops.rst @@ -441,12 +441,12 @@ Advanced Examples * - Link to Example - Description - * - `K-fold Cross Validation `_ + * - `K-fold Cross Validation `_ - `KFold / Cross Validation `__ is a machine learning practice in which the training dataset is being partitioned into ``num_folds`` complementary subsets. One cross validation round will perform fitting where one fold is left out for validation and the other folds are used for training. To reduce variability, once all rounds are performed using the different folds, the trained models are ensembled and their predictions are averaged when estimating the model's predictive performance on the test dataset. - * - `Yielding Training Step `_ + * - `Yielding Training Step `_ - This loop enables you to write the :meth:`~pytorch_lightning.core.module.LightningModule.training_step` hook as a Python Generator for automatic optimization with multiple optimizers, i.e., you can :code:`yield` loss values from it instead of returning them. This can enable more elegant and expressive implementations, as shown diff --git a/docs/source-PL/starter/lightning_lite.rst b/docs/source-PL/starter/lightning_lite.rst index 36deb507b9395..1941e9a5cc759 100644 --- a/docs/source-PL/starter/lightning_lite.rst +++ b/docs/source-PL/starter/lightning_lite.rst @@ -123,7 +123,7 @@ Here are five required steps to convert to :class:`~pytorch_lightning.lite.Light Lite(...).run(args) -That's all. You can now train on any kind of device and scale your training. Check out `this `_ full MNIST training example with LightningLite. +That's all. You can now train on any kind of device and scale your training. Check out `this `_ full MNIST training example with LightningLite. :class:`~pytorch_lightning.lite.LightningLite` takes care of device management, so you don't have to. You should remove any device-specific logic within your code. diff --git a/src/run_ddp_examples.sh b/examples/run_ddp_examples.sh similarity index 73% rename from src/run_ddp_examples.sh rename to examples/run_ddp_examples.sh index 6041f4b6a2a8f..5b1fe9cada5aa 100644 --- a/src/run_ddp_examples.sh +++ b/examples/run_ddp_examples.sh @@ -17,5 +17,5 @@ set -e # test that a user can manually launch individual processes export PYTHONPATH="${PYTHONPATH}:$(pwd)" args="--trainer.gpus 2 --trainer.strategy ddp --trainer.max_epochs=1 --trainer.limit_train_batches=1 --trainer.limit_val_batches=1 --trainer.limit_test_batches=1" -MASTER_ADDR="localhost" MASTER_PORT=1234 LOCAL_RANK=1 python pl_examples/basic_examples/mnist_examples/image_classifier_5_lightning_datamodule.py ${args} & -MASTER_ADDR="localhost" MASTER_PORT=1234 LOCAL_RANK=0 python pl_examples/basic_examples/mnist_examples/image_classifier_5_lightning_datamodule.py ${args} +MASTER_ADDR="localhost" MASTER_PORT=1234 LOCAL_RANK=1 python convert_from_pt_to_pl/image_classifier_5_lightning_datamodule.py ${args} & +MASTER_ADDR="localhost" MASTER_PORT=1234 LOCAL_RANK=0 python convert_from_pt_to_pl/image_classifier_5_lightning_datamodule.py ${args} diff --git a/examples/run_examples.sh b/examples/run_examples.sh deleted file mode 100644 index 792894137a463..0000000000000 --- a/examples/run_examples.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -set -ex - -export PYTHONPATH="${PYTHONPATH}:$(pwd)" -dir_path=$(dirname "${BASH_SOURCE[0]}") -args=" - --data.batch_size=32 - --trainer.max_epochs=1 - --trainer.limit_train_batches=2 - --trainer.limit_val_batches=2 - --trainer.limit_test_batches=2 - --trainer.limit_predict_batches=2 - --optimizer=Adam -" - -python "${dir_path}/basic_examples/backbone_image_classifier.py" ${args} "$@" -python "${dir_path}/basic_examples/autoencoder.py" ${args} "$@" - - -args="--dry-run" -python "${dir_path}/basic_examples/mnist_examples/image_classifier_1_pytorch.py" ${args} -python "${dir_path}/basic_examples/mnist_examples/image_classifier_2_lite.py" ${args} -python "${dir_path}/basic_examples/mnist_examples/image_classifier_3_lite_to_lightning_module.py" ${args} -python "${dir_path}/loop_examples/mnist_lite.py" ${args} - - -args=" - --trainer.max_epochs=1 - --trainer.limit_train_batches=2 - --trainer.limit_val_batches=2 - --trainer.limit_test_batches=2 - --trainer.limit_predict_batches=2 - --optimizer=Adam -" - -python "${dir_path}/basic_examples/mnist_examples/image_classifier_4_lightning_module.py" ${args} "$@" -python "${dir_path}/basic_examples/mnist_examples/image_classifier_5_lightning_datamodule.py" ${args} "$@" - -python "${dir_path}/fault_tolerant/automatic.py" diff --git a/examples/run_pl_examples.sh b/examples/run_pl_examples.sh new file mode 100644 index 0000000000000..49c7fb716d3be --- /dev/null +++ b/examples/run_pl_examples.sh @@ -0,0 +1,39 @@ +#!/bin/bash +set -ex + +export PYTHONPATH="${PYTHONPATH}:$(pwd)" +dir_path=$(dirname "${BASH_SOURCE[0]}") +args=" + --data.batch_size=32 + --trainer.max_epochs=1 + --trainer.limit_train_batches=2 + --trainer.limit_val_batches=2 + --trainer.limit_test_batches=2 + --trainer.limit_predict_batches=2 + --optimizer=Adam +" + +python "${dir_path}/pl_basics/backbone_image_classifier.py" ${args} "$@" +python "${dir_path}/pl_basics/autoencoder.py" ${args} "$@" + + +args="--dry-run" +python "${dir_path}/convert_from_pt_to_pl/image_classifier_1_pytorch.py" ${args} +python "${dir_path}/convert_from_pt_to_pl/image_classifier_2_lite.py" ${args} +python "${dir_path}/convert_from_pt_to_pl/image_classifier_3_lite_to_lightning_module.py" ${args} +python "${dir_path}/pl_loops/mnist_lite.py" ${args} + + +args=" + --trainer.max_epochs=1 + --trainer.limit_train_batches=2 + --trainer.limit_val_batches=2 + --trainer.limit_test_batches=2 + --trainer.limit_predict_batches=2 + --optimizer=Adam +" + +python "${dir_path}/convert_from_pt_to_pl/image_classifier_4_lightning_module.py" ${args} "$@" +python "${dir_path}/convert_from_pt_to_pl/image_classifier_5_lightning_datamodule.py" ${args} "$@" + +python "${dir_path}/pl_fault_tolerant/automatic.py" diff --git a/examples/test_examples.py b/examples/test_pl_examples.py similarity index 100% rename from examples/test_examples.py rename to examples/test_pl_examples.py diff --git a/pyproject.toml b/pyproject.toml index bbb2977903d86..f9770e1724017 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,6 @@ requires = [ [tool.isort] known_first_party = [ - "pl_examples", "pytorch_lightning", "legacy", "unittests_pl", @@ -53,6 +52,7 @@ module = [ "pytorch_lightning.core.mixins.device_dtype_mixin", "pytorch_lightning.core.saving", "pytorch_lightning.demos.boring_classes", + "pytorch_lightning.demos.mnist_datamodule", "pytorch_lightning.distributed.dist", "pytorch_lightning.loggers.base", "pytorch_lightning.loggers.logger", diff --git a/src/pytorch_lightning/__init__.py b/src/pytorch_lightning/__init__.py index 60838221f618a..0194477467d90 100644 --- a/src/pytorch_lightning/__init__.py +++ b/src/pytorch_lightning/__init__.py @@ -37,7 +37,7 @@ def _detail(self: Any, message: str, *args: Any, **kwargs: Any) -> None: # for compatibility with namespace packages __import__("pkg_resources").declare_namespace(__name__) -LIGHTNING_LOGO = """ +LIGHTNING_LOGO: str = """ #### ########### #################### @@ -63,7 +63,7 @@ def _detail(self: Any, message: str, *args: Any, **kwargs: Any) -> None: """ -def cli_lightning_logo(): +def cli_lightning_logo() -> None: print() print("\033[0;35m" + LIGHTNING_LOGO + "\033[0m") print() diff --git a/src/pytorch_lightning/demos/mnist_datamodule.py b/src/pytorch_lightning/demos/mnist_datamodule.py index 3e7f738710b54..fc8a8bb2e9c70 100644 --- a/src/pytorch_lightning/demos/mnist_datamodule.py +++ b/src/pytorch_lightning/demos/mnist_datamodule.py @@ -17,11 +17,12 @@ import random import time import urllib -from typing import Optional, Tuple +from typing import Any, Callable, Optional, Tuple from urllib.error import HTTPError from warnings import warn import torch +from torch import Tensor from torch.utils.data import DataLoader, Dataset, random_split from pytorch_lightning import LightningDataModule @@ -50,8 +51,8 @@ class _MNIST(Dataset): cache_folder_name = "complete" def __init__( - self, root: str, train: bool = True, normalize: tuple = (0.1307, 0.3081), download: bool = True, **kwargs - ): + self, root: str, train: bool = True, normalize: tuple = (0.1307, 0.3081), download: bool = True, **kwargs: Any + ) -> None: super().__init__() self.root = root self.train = train # training set or test set @@ -62,7 +63,7 @@ def __init__( data_file = self.TRAIN_FILE_NAME if self.train else self.TEST_FILE_NAME self.data, self.targets = self._try_load(os.path.join(self.cached_folder_path, data_file)) - def __getitem__(self, idx: int) -> Tuple[torch.Tensor, int]: + def __getitem__(self, idx: int) -> Tuple[Tensor, int]: img = self.data[idx].float().unsqueeze(0) target = int(self.targets[idx]) @@ -84,7 +85,7 @@ def _check_exists(self, data_folder: str) -> bool: existing = existing and os.path.isfile(os.path.join(data_folder, fname)) return existing - def prepare_data(self, download: bool = True): + def prepare_data(self, download: bool = True) -> None: if download and not self._check_exists(self.cached_folder_path): self._download(self.cached_folder_path) if not self._check_exists(self.cached_folder_path): @@ -98,7 +99,7 @@ def _download(self, data_folder: str) -> None: urllib.request.urlretrieve(url, fpath) @staticmethod - def _try_load(path_data, trials: int = 30, delta: float = 1.0): + def _try_load(path_data: str, trials: int = 30, delta: float = 1.0) -> Tuple[Tensor, Tensor]: """Resolving loading from the same time from multiple concurrent processes.""" res, exception = None, None assert trials, "at least some trial has to be set" @@ -107,8 +108,8 @@ def _try_load(path_data, trials: int = 30, delta: float = 1.0): try: res = torch.load(path_data) # todo: specify the possible exception - except Exception as e: - exception = e + except Exception as ex: + exception = ex time.sleep(delta * random.random()) else: break @@ -118,13 +119,13 @@ def _try_load(path_data, trials: int = 30, delta: float = 1.0): return res @staticmethod - def normalize_tensor(tensor: torch.Tensor, mean: float = 0.0, std: float = 1.0) -> torch.Tensor: + def normalize_tensor(tensor: Tensor, mean: float = 0.0, std: float = 1.0) -> Tensor: mean = torch.as_tensor(mean, dtype=tensor.dtype, device=tensor.device) std = torch.as_tensor(std, dtype=tensor.dtype, device=tensor.device) return tensor.sub(mean).div(std) -def MNIST(*args, **kwargs): +def MNIST(*args: Any, **kwargs: Any) -> Dataset: torchvision_mnist_available = not bool(os.getenv("PL_USE_MOCKED_MNIST", False)) if torchvision_mnist_available: try: @@ -157,9 +158,9 @@ def __init__( normalize: bool = False, seed: int = 42, batch_size: int = 32, - *args, - **kwargs, - ): + *args: Any, + **kwargs: Any, + ) -> None: """ Args: data_dir: where to save/load the data @@ -188,22 +189,22 @@ def __init__( self.dataset_val = ... @property - def num_classes(self): + def num_classes(self) -> int: return 10 - def prepare_data(self): + def prepare_data(self) -> None: """Saves MNIST files to `data_dir`""" MNIST(self.data_dir, train=True, download=True) MNIST(self.data_dir, train=False, download=True) - def setup(self, stage: Optional[str] = None): + def setup(self, stage: Optional[str] = None) -> None: """Split the train and valid dataset.""" extra = dict(transform=self.default_transforms) if self.default_transforms else {} - dataset = MNIST(self.data_dir, train=True, download=False, **extra) + dataset: Dataset = MNIST(self.data_dir, train=True, download=False, **extra) train_length = len(dataset) self.dataset_train, self.dataset_val = random_split(dataset, [train_length - self.val_split, self.val_split]) - def train_dataloader(self): + def train_dataloader(self) -> DataLoader: """MNIST train set removes a subset to use for validation.""" loader = DataLoader( self.dataset_train, @@ -215,7 +216,7 @@ def train_dataloader(self): ) return loader - def val_dataloader(self): + def val_dataloader(self) -> DataLoader: """MNIST val set uses a subset of the training set for validation.""" loader = DataLoader( self.dataset_val, @@ -227,7 +228,7 @@ def val_dataloader(self): ) return loader - def test_dataloader(self): + def test_dataloader(self) -> DataLoader: """MNIST test set uses the test split.""" extra = dict(transform=self.default_transforms) if self.default_transforms else {} dataset = MNIST(self.data_dir, train=False, download=False, **extra) @@ -242,7 +243,7 @@ def test_dataloader(self): return loader @property - def default_transforms(self): + def default_transforms(self) -> Optional[Callable]: if not _TORCHVISION_AVAILABLE: return None if self.normalize: diff --git a/test/README.md b/test/README.md index 2951896748daf..606bc799db94f 100644 --- a/test/README.md +++ b/test/README.md @@ -41,7 +41,7 @@ This is useful if you do not test against all required dependency versions. **Docker:** Another option is to utilize the [pytorch lightning cuda base docker image](https://hub.docker.com/repository/docker/pytorchlightning/pytorch_lightning/tags?page=1&name=cuda). You can then run: ```bash -python -m pytest pytorch_lightning tests pl_examples -v +python -m pytest src/pytorch_lightning test/unitests_pl -v ``` You can also run a single test as follows: From 64090ecb478aae3295dc7a044722b97532a2e772 Mon Sep 17 00:00:00 2001 From: Jirka Date: Fri, 10 Jun 2022 00:31:24 +0200 Subject: [PATCH 18/20] unify torch.Tensor >> Tensor --- src/pytorch_lightning/callbacks/callback.py | 4 +-- .../callbacks/early_stopping.py | 5 ++-- .../callbacks/model_checkpoint.py | 13 ++++----- src/pytorch_lightning/callbacks/pruning.py | 9 +++--- .../callbacks/stochastic_weight_avg.py | 8 ++--- src/pytorch_lightning/core/hooks.py | 3 +- .../core/mixins/device_dtype_mixin.py | 3 +- src/pytorch_lightning/core/module.py | 12 ++++---- src/pytorch_lightning/lite/lite.py | 6 ++-- src/pytorch_lightning/loggers/comet.py | 5 ++-- src/pytorch_lightning/loggers/csv_logs.py | 4 +-- src/pytorch_lightning/loggers/neptune.py | 5 ++-- src/pytorch_lightning/loggers/tensorboard.py | 6 ++-- .../loops/dataloader/evaluation_loop.py | 4 +-- src/pytorch_lightning/loops/utilities.py | 3 +- .../overrides/data_parallel.py | 9 +++--- src/pytorch_lightning/plugins/layer_sync.py | 3 +- .../plugins/precision/double.py | 7 +++-- .../plugins/precision/native_amp.py | 2 +- src/pytorch_lightning/strategies/bagua.py | 7 +++-- .../strategies/collaborative.py | 5 ++-- src/pytorch_lightning/strategies/ddp.py | 7 +++-- src/pytorch_lightning/strategies/ddp2.py | 6 ++-- src/pytorch_lightning/strategies/ddp_spawn.py | 7 +++-- src/pytorch_lightning/strategies/deepspeed.py | 5 ++-- src/pytorch_lightning/strategies/dp.py | 7 +++-- .../strategies/fully_sharded_native.py | 7 +++-- src/pytorch_lightning/strategies/horovod.py | 7 ++--- src/pytorch_lightning/strategies/ipu.py | 9 +++--- .../strategies/launchers/spawn.py | 3 +- src/pytorch_lightning/strategies/parallel.py | 3 +- src/pytorch_lightning/strategies/sharded.py | 4 +-- .../strategies/sharded_spawn.py | 4 +-- .../strategies/single_device.py | 5 ++-- src/pytorch_lightning/strategies/strategy.py | 10 +++---- src/pytorch_lightning/strategies/tpu_spawn.py | 7 +++-- .../trainer/callback_hook.py | 4 +-- .../connectors/checkpoint_connector.py | 3 +- .../logger_connector/logger_connector.py | 4 +-- .../connectors/logger_connector/result.py | 29 +++++++++---------- src/pytorch_lightning/trainer/trainer.py | 5 ++-- src/pytorch_lightning/utilities/apply_func.py | 13 +++++---- src/pytorch_lightning/utilities/data.py | 5 ++-- .../utilities/distributed.py | 21 +++++++------- src/pytorch_lightning/utilities/logger.py | 3 +- src/pytorch_lightning/utilities/memory.py | 7 +++-- src/pytorch_lightning/utilities/meta.py | 2 +- src/pytorch_lightning/utilities/metrics.py | 6 ++-- src/pytorch_lightning/utilities/optimizer.py | 4 +-- src/pytorch_lightning/utilities/types.py | 7 +++-- 50 files changed, 173 insertions(+), 154 deletions(-) diff --git a/src/pytorch_lightning/callbacks/callback.py b/src/pytorch_lightning/callbacks/callback.py index 86912297f90cb..ed106076e41a7 100644 --- a/src/pytorch_lightning/callbacks/callback.py +++ b/src/pytorch_lightning/callbacks/callback.py @@ -18,7 +18,7 @@ from typing import Any, Dict, List, Optional, Type -import torch +from torch import Tensor from torch.optim import Optimizer import pytorch_lightning as pl @@ -342,7 +342,7 @@ def on_load_checkpoint( checkpoint dictionary instead of only the callback state from the checkpoint. """ - def on_before_backward(self, trainer: "pl.Trainer", pl_module: "pl.LightningModule", loss: torch.Tensor) -> None: + def on_before_backward(self, trainer: "pl.Trainer", pl_module: "pl.LightningModule", loss: Tensor) -> None: """Called before ``loss.backward()``.""" def on_after_backward(self, trainer: "pl.Trainer", pl_module: "pl.LightningModule") -> None: diff --git a/src/pytorch_lightning/callbacks/early_stopping.py b/src/pytorch_lightning/callbacks/early_stopping.py index 859fe324bac77..51bab7f98d941 100644 --- a/src/pytorch_lightning/callbacks/early_stopping.py +++ b/src/pytorch_lightning/callbacks/early_stopping.py @@ -23,6 +23,7 @@ import numpy as np import torch +from torch import Tensor import pytorch_lightning as pl from pytorch_lightning.callbacks.callback import Callback @@ -203,7 +204,7 @@ def _run_early_stopping_check(self, trainer: "pl.Trainer") -> None: if reason and self.verbose: self._log_info(trainer, reason) - def _evaluate_stopping_criteria(self, current: torch.Tensor) -> Tuple[bool, Optional[str]]: + def _evaluate_stopping_criteria(self, current: Tensor) -> Tuple[bool, Optional[str]]: should_stop = False reason = None if self.check_finite and not torch.isfinite(current): @@ -242,7 +243,7 @@ def _evaluate_stopping_criteria(self, current: torch.Tensor) -> Tuple[bool, Opti return should_stop, reason - def _improvement_message(self, current: torch.Tensor) -> str: + def _improvement_message(self, current: Tensor) -> str: """Formats a log message that informs the user about an improvement in the monitored score.""" if torch.isfinite(self.best_score): msg = ( diff --git a/src/pytorch_lightning/callbacks/model_checkpoint.py b/src/pytorch_lightning/callbacks/model_checkpoint.py index 89d49939c8025..8522bb49b7292 100644 --- a/src/pytorch_lightning/callbacks/model_checkpoint.py +++ b/src/pytorch_lightning/callbacks/model_checkpoint.py @@ -31,6 +31,7 @@ import numpy as np import torch import yaml +from torch import Tensor import pytorch_lightning as pl from pytorch_lightning.callbacks.callback import Callback @@ -477,7 +478,7 @@ def __init_triggers( def every_n_epochs(self) -> Optional[int]: return self._every_n_epochs - def check_monitor_top_k(self, trainer: "pl.Trainer", current: Optional[torch.Tensor] = None) -> bool: + def check_monitor_top_k(self, trainer: "pl.Trainer", current: Optional[Tensor] = None) -> bool: if current is None: return False @@ -628,11 +629,9 @@ def _monitor_candidates(self, trainer: "pl.Trainer") -> Dict[str, _METRIC]: # cast to int if necessary because `self.log("epoch", 123)` will convert it to float. if it's not a tensor # or does not exist we overwrite it as it's likely an error epoch = monitor_candidates.get("epoch") - monitor_candidates["epoch"] = ( - epoch.int() if isinstance(epoch, torch.Tensor) else torch.tensor(trainer.current_epoch) - ) + monitor_candidates["epoch"] = epoch.int() if isinstance(epoch, Tensor) else torch.tensor(trainer.current_epoch) step = monitor_candidates.get("step") - monitor_candidates["step"] = step.int() if isinstance(step, torch.Tensor) else torch.tensor(trainer.global_step) + monitor_candidates["step"] = step.int() if isinstance(step, Tensor) else torch.tensor(trainer.global_step) return monitor_candidates def _save_last_checkpoint(self, trainer: "pl.Trainer", monitor_candidates: Dict[str, _METRIC]) -> None: @@ -670,7 +669,7 @@ def _save_none_monitor_checkpoint(self, trainer: "pl.Trainer", monitor_candidate trainer.strategy.remove_checkpoint(previous) def _update_best_and_save( - self, current: torch.Tensor, trainer: "pl.Trainer", monitor_candidates: Dict[str, _METRIC] + self, current: Tensor, trainer: "pl.Trainer", monitor_candidates: Dict[str, _METRIC] ) -> None: k = len(self.best_k_models) + 1 if self.save_top_k == -1 else self.save_top_k @@ -680,7 +679,7 @@ def _update_best_and_save( self.best_k_models.pop(del_filepath) # do not save nan, replace with +/- inf - if isinstance(current, torch.Tensor) and torch.isnan(current): + if isinstance(current, Tensor) and torch.isnan(current): current = torch.tensor(float("inf" if self.mode == "min" else "-inf"), device=current.device) filepath = self._get_metric_interpolated_filepath_name(monitor_candidates, trainer, del_filepath) diff --git a/src/pytorch_lightning/callbacks/pruning.py b/src/pytorch_lightning/callbacks/pruning.py index 3bee8be4e5b32..37e8caa32b669 100644 --- a/src/pytorch_lightning/callbacks/pruning.py +++ b/src/pytorch_lightning/callbacks/pruning.py @@ -21,9 +21,8 @@ from functools import partial from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union -import torch import torch.nn.utils.prune as pytorch_prune -from torch import nn +from torch import nn, Tensor from typing_extensions import TypedDict import pytorch_lightning as pl @@ -275,7 +274,7 @@ def make_pruning_permanent(self, module: nn.Module) -> None: def _copy_param(new: nn.Module, old: nn.Module, name: str) -> None: dst = getattr(new, name) src = getattr(old, name) - if dst is None or src is None or not isinstance(dst, torch.Tensor) or not isinstance(src, torch.Tensor): + if dst is None or src is None or not isinstance(dst, Tensor) or not isinstance(src, Tensor): return dst.data = src.data.to(dst.device) @@ -418,11 +417,11 @@ def _make_pruning_permanent_on_state_dict(self, pl_module: LightningModule) -> D # make weights permanent state_dict[tensor_name] = mask.to(dtype=orig.dtype) * orig - def move_to_cpu(tensor: torch.Tensor) -> torch.Tensor: + def move_to_cpu(tensor: Tensor) -> Tensor: # each tensor and move them on cpu return tensor.cpu() - return apply_to_collection(state_dict, torch.Tensor, move_to_cpu) + return apply_to_collection(state_dict, Tensor, move_to_cpu) def on_save_checkpoint( self, trainer: "pl.Trainer", pl_module: "pl.LightningModule", checkpoint: Dict[str, Any] diff --git a/src/pytorch_lightning/callbacks/stochastic_weight_avg.py b/src/pytorch_lightning/callbacks/stochastic_weight_avg.py index 7c8b33e272568..83fb1cf169794 100644 --- a/src/pytorch_lightning/callbacks/stochastic_weight_avg.py +++ b/src/pytorch_lightning/callbacks/stochastic_weight_avg.py @@ -19,7 +19,7 @@ from typing import Callable, List, Optional, Union import torch -from torch import nn +from torch import FloatTensor, nn, Tensor from torch.optim.swa_utils import SWALR import pytorch_lightning as pl @@ -28,7 +28,7 @@ from pytorch_lightning.utilities.rank_zero import rank_zero_info, rank_zero_warn from pytorch_lightning.utilities.types import LRSchedulerConfig -_AVG_FN = Callable[[torch.Tensor, torch.Tensor, torch.LongTensor], torch.FloatTensor] +_AVG_FN = Callable[[Tensor, Tensor, torch.LongTensor], FloatTensor] class StochasticWeightAveraging(Callback): @@ -269,7 +269,7 @@ def update_parameters( @staticmethod def avg_fn( - averaged_model_parameter: torch.Tensor, model_parameter: torch.Tensor, num_averaged: torch.LongTensor - ) -> torch.FloatTensor: + averaged_model_parameter: Tensor, model_parameter: Tensor, num_averaged: torch.LongTensor + ) -> FloatTensor: """Adapted from https://github.com/pytorch/pytorch/blob/v1.7.1/torch/optim/swa_utils.py#L95-L97.""" return averaged_model_parameter + (model_parameter - averaged_model_parameter) / (num_averaged + 1) diff --git a/src/pytorch_lightning/core/hooks.py b/src/pytorch_lightning/core/hooks.py index d5f9483c0ae37..9a7b0dbfa59c4 100644 --- a/src/pytorch_lightning/core/hooks.py +++ b/src/pytorch_lightning/core/hooks.py @@ -16,6 +16,7 @@ from typing import Any, Dict, List, Optional import torch +from torch import Tensor from torch.optim.optimizer import Optimizer from pytorch_lightning.utilities import move_data_to_device @@ -254,7 +255,7 @@ def on_before_zero_grad(self, optimizer: Optimizer) -> None: optimizer: The optimizer for which grads should be zeroed. """ - def on_before_backward(self, loss: torch.Tensor) -> None: + def on_before_backward(self, loss: Tensor) -> None: """Called before ``loss.backward()``. Args: diff --git a/src/pytorch_lightning/core/mixins/device_dtype_mixin.py b/src/pytorch_lightning/core/mixins/device_dtype_mixin.py index ed9f1f7683555..5f6397e4562e5 100644 --- a/src/pytorch_lightning/core/mixins/device_dtype_mixin.py +++ b/src/pytorch_lightning/core/mixins/device_dtype_mixin.py @@ -89,8 +89,9 @@ def to(self, *args: Any, **kwargs: Any) -> Self: Module: self Example:: + >>> from torch import Tensor >>> class ExampleModule(DeviceDtypeModuleMixin): - ... def __init__(self, weight: torch.Tensor): + ... def __init__(self, weight: Tensor): ... super().__init__() ... self.register_buffer('weight', weight) >>> _ = torch.manual_seed(0) diff --git a/src/pytorch_lightning/core/module.py b/src/pytorch_lightning/core/module.py index eac0b10f48c9d..4d400ef15d329 100644 --- a/src/pytorch_lightning/core/module.py +++ b/src/pytorch_lightning/core/module.py @@ -528,7 +528,7 @@ def __check_not_nested(value: dict, name: str) -> dict: def __check_allowed(v: Any, name: str, value: Any) -> None: raise ValueError(f"`self.log({name}, {value})` was called, but `{type(v).__name__}` values cannot be logged") - def __to_tensor(self, value: numbers.Number) -> torch.Tensor: + def __to_tensor(self, value: numbers.Number) -> Tensor: return torch.tensor(value, device=self.device) def log_grad_norm(self, grad_norm_dict: Dict[str, float]) -> None: @@ -547,9 +547,7 @@ def log_grad_norm(self, grad_norm_dict): """ self.log_dict(grad_norm_dict, on_step=True, on_epoch=True, prog_bar=False, logger=True) - def all_gather( - self, data: Union[torch.Tensor, Dict, List, Tuple], group: Optional[Any] = None, sync_grads: bool = False - ): + def all_gather(self, data: Union[Tensor, Dict, List, Tuple], group: Optional[Any] = None, sync_grads: bool = False): r""" Allows users to call ``self.all_gather()`` from the LightningModule, thus making the ``all_gather`` operation accelerator agnostic. ``all_gather`` is a function provided by accelerators to gather a tensor from several @@ -567,7 +565,7 @@ def all_gather( group = group if group is not None else torch.distributed.group.WORLD all_gather = self.trainer.strategy.all_gather data = convert_to_tensors(data, device=self.device) - return apply_to_collection(data, torch.Tensor, all_gather, group=group, sync_grads=sync_grads) + return apply_to_collection(data, Tensor, all_gather, group=group, sync_grads=sync_grads) def forward(self, *args, **kwargs) -> Any: r""" @@ -1701,7 +1699,7 @@ def tbptt_split_batch(self, batch, split_size): if :paramref:`~pytorch_lightning.core.module.LightningModule.truncated_bptt_steps` > 0. Each returned batch split is passed separately to :meth:`training_step`. """ - time_dims = [len(x[0]) for x in batch if isinstance(x, (torch.Tensor, collections.Sequence))] + time_dims = [len(x[0]) for x in batch if isinstance(x, (Tensor, collections.Sequence))] assert len(time_dims) >= 1, "Unable to determine batch time dimension" assert all(x == time_dims[0] for x in time_dims), "Batch time dimension length is ambiguous" @@ -1709,7 +1707,7 @@ def tbptt_split_batch(self, batch, split_size): for t in range(0, time_dims[0], split_size): batch_split = [] for i, x in enumerate(batch): - if isinstance(x, torch.Tensor): + if isinstance(x, Tensor): split_x = x[:, t : t + split_size] elif isinstance(x, collections.Sequence): split_x = [None] * len(x) diff --git a/src/pytorch_lightning/lite/lite.py b/src/pytorch_lightning/lite/lite.py index 7eea21698be71..83f6b53715977 100644 --- a/src/pytorch_lightning/lite/lite.py +++ b/src/pytorch_lightning/lite/lite.py @@ -342,8 +342,8 @@ def barrier(self, name: Optional[str] = None) -> None: self._strategy.barrier(name=name) def all_gather( - self, data: Union[torch.Tensor, Dict, List, Tuple], group: Optional[Any] = None, sync_grads: bool = False - ) -> Union[torch.Tensor, Dict, List, Tuple]: + self, data: Union[Tensor, Dict, List, Tuple], group: Optional[Any] = None, sync_grads: bool = False + ) -> Union[Tensor, Dict, List, Tuple]: r""" Gather tensors or collections of tensors from multiple processes. @@ -358,7 +358,7 @@ def all_gather( """ group = group if group is not None else torch.distributed.group.WORLD data = convert_to_tensors(data, device=self.device) - return apply_to_collection(data, torch.Tensor, self._strategy.all_gather, group=group, sync_grads=sync_grads) + return apply_to_collection(data, Tensor, self._strategy.all_gather, group=group, sync_grads=sync_grads) def broadcast(self, obj: TBroadcast, src: int = 0) -> TBroadcast: return self._strategy.broadcast(obj, src=src) diff --git a/src/pytorch_lightning/loggers/comet.py b/src/pytorch_lightning/loggers/comet.py index 7d166b59a685b..2b853f59259ff 100644 --- a/src/pytorch_lightning/loggers/comet.py +++ b/src/pytorch_lightning/loggers/comet.py @@ -21,8 +21,7 @@ from argparse import Namespace from typing import Any, Callable, Dict, Mapping, Optional, Sequence, Union -import torch -from torch import is_tensor +from torch import is_tensor, Tensor import pytorch_lightning as pl from pytorch_lightning.loggers.logger import Logger, rank_zero_experiment @@ -241,7 +240,7 @@ def log_hyperparams(self, params: Union[Dict[str, Any], Namespace]) -> None: self.experiment.log_parameters(params) @rank_zero_only - def log_metrics(self, metrics: Dict[str, Union[torch.Tensor, float]], step: Optional[int] = None) -> None: + def log_metrics(self, metrics: Dict[str, Union[Tensor, float]], step: Optional[int] = None) -> None: assert rank_zero_only.rank == 0, "experiment tried to log from global_rank != 0" # Comet.ml expects metrics to be a dictionary of detached tensors on CPU metrics_without_epoch = metrics.copy() diff --git a/src/pytorch_lightning/loggers/csv_logs.py b/src/pytorch_lightning/loggers/csv_logs.py index 5d4748a6bfa17..3316a5e86e64b 100644 --- a/src/pytorch_lightning/loggers/csv_logs.py +++ b/src/pytorch_lightning/loggers/csv_logs.py @@ -24,7 +24,7 @@ from argparse import Namespace from typing import Any, Dict, Optional, Union -import torch +from torch import Tensor from pytorch_lightning.core.saving import save_hparams_to_yaml from pytorch_lightning.loggers.logger import Logger, rank_zero_experiment @@ -70,7 +70,7 @@ def log_metrics(self, metrics_dict: Dict[str, float], step: Optional[int] = None """Record metrics.""" def _handle_value(value): - if isinstance(value, torch.Tensor): + if isinstance(value, Tensor): return value.item() return value diff --git a/src/pytorch_lightning/loggers/neptune.py b/src/pytorch_lightning/loggers/neptune.py index 4829be2602e8a..4d2f6897a21aa 100644 --- a/src/pytorch_lightning/loggers/neptune.py +++ b/src/pytorch_lightning/loggers/neptune.py @@ -28,6 +28,7 @@ from weakref import ReferenceType import torch +from torch import Tensor from pytorch_lightning import __version__ from pytorch_lightning.callbacks.model_checkpoint import ModelCheckpoint @@ -491,7 +492,7 @@ def log_hyperparams(self, params: Union[Dict[str, Any], Namespace]) -> None: # self.run[parameters_key] = params @rank_zero_only - def log_metrics(self, metrics: Dict[str, Union[torch.Tensor, float]], step: Optional[int] = None) -> None: + def log_metrics(self, metrics: Dict[str, Union[Tensor, float]], step: Optional[int] = None) -> None: """Log metrics (numeric values) in Neptune runs. Args: @@ -640,7 +641,7 @@ def _signal_deprecated_api_usage(f_name, sample_code, raise_exception=False): raise ValueError("The function you've used is deprecated.\n" + msg_suffix) @rank_zero_only - def log_metric(self, metric_name: str, metric_value: Union[torch.Tensor, float, str], step: Optional[int] = None): + def log_metric(self, metric_name: str, metric_value: Union[Tensor, float, str], step: Optional[int] = None): key = f"{self._prefix}/{metric_name}" self._signal_deprecated_api_usage("log_metric", f"logger.run['{key}'].log(42)") if torch.is_tensor(metric_value): diff --git a/src/pytorch_lightning/loggers/tensorboard.py b/src/pytorch_lightning/loggers/tensorboard.py index febfbb6adbdb7..9f3023ee443ef 100644 --- a/src/pytorch_lightning/loggers/tensorboard.py +++ b/src/pytorch_lightning/loggers/tensorboard.py @@ -22,7 +22,7 @@ from typing import Any, Callable, Dict, Mapping, Optional, Sequence, Union import numpy as np -import torch +from torch import Tensor from torch.utils.tensorboard import SummaryWriter from torch.utils.tensorboard.summary import hparams @@ -222,7 +222,7 @@ def log_metrics(self, metrics: Dict[str, float], step: Optional[int] = None) -> metrics = _add_prefix(metrics, self._prefix, self.LOGGER_JOIN_CHAR) for k, v in metrics.items(): - if isinstance(v, torch.Tensor): + if isinstance(v, Tensor): v = v.item() if isinstance(v, dict): @@ -316,7 +316,7 @@ def _get_next_version(self): def _sanitize_params(params: Dict[str, Any]) -> Dict[str, Any]: params = _utils_sanitize_params(params) # logging of arrays with dimension > 1 is not supported, sanitize as string - return {k: str(v) if isinstance(v, (torch.Tensor, np.ndarray)) and v.ndim > 1 else v for k, v in params.items()} + return {k: str(v) if isinstance(v, (Tensor, np.ndarray)) and v.ndim > 1 else v for k, v in params.items()} def __getstate__(self): state = self.__dict__.copy() diff --git a/src/pytorch_lightning/loops/dataloader/evaluation_loop.py b/src/pytorch_lightning/loops/dataloader/evaluation_loop.py index 85f8ce8a9c47b..53dbce9cacdf1 100644 --- a/src/pytorch_lightning/loops/dataloader/evaluation_loop.py +++ b/src/pytorch_lightning/loops/dataloader/evaluation_loop.py @@ -18,8 +18,8 @@ from functools import partial from typing import Any, Iterable, List, Optional, Sequence, Tuple, Type, Union -import torch from deprecate.utils import void +from torch import Tensor from torch.utils.data.dataloader import DataLoader import pytorch_lightning as pl @@ -350,7 +350,7 @@ def _print_results(results: List[_OUT_DICT], stage: str) -> None: for metric, row in zip(metrics_paths, rows): val = EvaluationLoop._find_value(result, metric) if val is not None: - if isinstance(val, torch.Tensor): + if isinstance(val, Tensor): val = val.item() if val.numel() == 1 else val.tolist() row.append(f"{val}") else: diff --git a/src/pytorch_lightning/loops/utilities.py b/src/pytorch_lightning/loops/utilities.py index 8b0f98efe64f7..b5fefcd4b0011 100644 --- a/src/pytorch_lightning/loops/utilities.py +++ b/src/pytorch_lightning/loops/utilities.py @@ -20,6 +20,7 @@ import numpy as np import torch +from torch import Tensor from torch.optim import Optimizer import pytorch_lightning as pl @@ -34,7 +35,7 @@ from pytorch_lightning.utilities.warnings import PossibleUserWarning -def check_finite_loss(loss: Optional[torch.Tensor]) -> None: +def check_finite_loss(loss: Optional[Tensor]) -> None: """Checks for finite loss value. Args: diff --git a/src/pytorch_lightning/overrides/data_parallel.py b/src/pytorch_lightning/overrides/data_parallel.py index 2d9a7d9a3acca..9fa253b9d8321 100644 --- a/src/pytorch_lightning/overrides/data_parallel.py +++ b/src/pytorch_lightning/overrides/data_parallel.py @@ -16,6 +16,7 @@ from typing import Any, cast, Union import torch +from torch import Tensor import pytorch_lightning as pl from pytorch_lightning.overrides.base import _LightningModuleWrapperBase, _LightningPrecisionModuleWrapperBase @@ -69,7 +70,7 @@ def output_transform(data: Any) -> Any: data = unsqueeze_scalar_tensor(data) return data - output = apply_to_collection(output, dtype=(numbers.Number, torch.Tensor), function=output_transform) + output = apply_to_collection(output, dtype=(numbers.Number, Tensor), function=output_transform) return output def update_replica_device_attributes(self, inputs: Any) -> None: @@ -84,13 +85,13 @@ def update_replica_device_attributes(self, inputs: Any) -> None: """ replica_device = None - def find_tensor_with_device(tensor: torch.Tensor) -> torch.Tensor: + def find_tensor_with_device(tensor: Tensor) -> Tensor: nonlocal replica_device if replica_device is None and tensor.device != torch.device("cpu"): replica_device = tensor.device return tensor - apply_to_collection(inputs, dtype=torch.Tensor, function=find_tensor_with_device) + apply_to_collection(inputs, dtype=Tensor, function=find_tensor_with_device) if replica_device is not None: # by calling .to() we force the update to the self.device property @@ -112,6 +113,6 @@ def python_scalar_to_tensor(data: Any, device: Union[str, torch.device] = torch. def unsqueeze_scalar_tensor(data: Any) -> Any: """Un-squeezes a 0-dim tensor.""" - if isinstance(data, torch.Tensor) and data.dim() == 0: + if isinstance(data, Tensor) and data.dim() == 0: data = data.unsqueeze(0) return data diff --git a/src/pytorch_lightning/plugins/layer_sync.py b/src/pytorch_lightning/plugins/layer_sync.py index 92719265c39aa..b2012358936e8 100644 --- a/src/pytorch_lightning/plugins/layer_sync.py +++ b/src/pytorch_lightning/plugins/layer_sync.py @@ -15,6 +15,7 @@ from abc import ABC, abstractmethod import torch +from torch import Tensor from torch.nn import Module @@ -86,7 +87,7 @@ def revert(self, model: Module) -> Module: class _BatchNormXd(torch.nn.modules.batchnorm._BatchNorm): - def _check_input_dim(self, input: torch.Tensor) -> None: + def _check_input_dim(self, input: Tensor) -> None: # The only difference between BatchNorm1d, BatchNorm2d, BatchNorm3d, etc # is this method that is overwritten by the subclass. # Here, we are bypassing some tensor sanity checks and trusting that the user diff --git a/src/pytorch_lightning/plugins/precision/double.py b/src/pytorch_lightning/plugins/precision/double.py index 5e9e8bd43b820..814ff659a9dc9 100644 --- a/src/pytorch_lightning/plugins/precision/double.py +++ b/src/pytorch_lightning/plugins/precision/double.py @@ -16,6 +16,7 @@ import torch import torch.nn as nn +from torch import FloatTensor, Tensor from torch.optim import Optimizer import pytorch_lightning as pl @@ -33,14 +34,14 @@ class LightningDoublePrecisionModule(_LightningPrecisionModuleWrapperBase): """ @staticmethod - def _to_double_precision(data: torch.Tensor) -> torch.Tensor: + def _to_double_precision(data: Tensor) -> Tensor: if data.is_floating_point(): return data.double() return data @staticmethod def _move_float_tensors_to_double(collection: Any) -> Any: - return apply_to_collection(collection, torch.Tensor, LightningDoublePrecisionModule._to_double_precision) + return apply_to_collection(collection, Tensor, LightningDoublePrecisionModule._to_double_precision) def training_step(self, *args: Any, **kwargs: Any) -> Any: return self.module.training_step( @@ -99,4 +100,4 @@ def forward_context(self) -> Generator[None, None, None]: """ torch.set_default_tensor_type(torch.DoubleTensor) yield - torch.set_default_tensor_type(torch.FloatTensor) + torch.set_default_tensor_type(FloatTensor) diff --git a/src/pytorch_lightning/plugins/precision/native_amp.py b/src/pytorch_lightning/plugins/precision/native_amp.py index fa749af1d4a08..07f8c03babd55 100644 --- a/src/pytorch_lightning/plugins/precision/native_amp.py +++ b/src/pytorch_lightning/plugins/precision/native_amp.py @@ -57,7 +57,7 @@ def __init__( self.device = device self.scaler = scaler - def pre_backward(self, model: "pl.LightningModule", closure_loss: torch.Tensor) -> torch.Tensor: + def pre_backward(self, model: "pl.LightningModule", closure_loss: Tensor) -> Tensor: if self.scaler is not None: closure_loss = self.scaler.scale(closure_loss) return super().pre_backward(model, closure_loss) diff --git a/src/pytorch_lightning/strategies/bagua.py b/src/pytorch_lightning/strategies/bagua.py index 641ff6b98bd32..0506463cd7677 100644 --- a/src/pytorch_lightning/strategies/bagua.py +++ b/src/pytorch_lightning/strategies/bagua.py @@ -3,6 +3,7 @@ from typing import Any, Dict, List, Optional, Union import torch +from torch import Tensor from torch.nn import Module import pytorch_lightning as pl @@ -234,8 +235,8 @@ def broadcast(self, obj: TBroadcast, src: int = 0) -> TBroadcast: return broadcast_object(obj, src) def reduce( - self, tensor: torch.Tensor, group: Optional[Any] = None, reduce_op: Optional[Union[ReduceOp, str]] = "mean" - ) -> torch.Tensor: + self, tensor: Tensor, group: Optional[Any] = None, reduce_op: Optional[Union[ReduceOp, str]] = "mean" + ) -> Tensor: """Reduces a tensor from several distributed processes to one aggregated tensor. Args: @@ -247,7 +248,7 @@ def reduce( Return: The reduced value, except when the input was not a tensor the output remains is unchanged. """ - if not isinstance(tensor, torch.Tensor): + if not isinstance(tensor, Tensor): return tensor if group is not None: raise ValueError("`Bagua` does not support allreduce using a subcommunicator at this time. Unset `group`.") diff --git a/src/pytorch_lightning/strategies/collaborative.py b/src/pytorch_lightning/strategies/collaborative.py index 3eafe595a7323..715f0d58e9c07 100644 --- a/src/pytorch_lightning/strategies/collaborative.py +++ b/src/pytorch_lightning/strategies/collaborative.py @@ -12,6 +12,7 @@ import requests import torch +from torch import Tensor import pytorch_lightning as pl from pytorch_lightning.strategies.strategy import Strategy, TBroadcast @@ -306,10 +307,10 @@ def on_train_batch_start(self, batch: Any, batch_idx: int, dataloader_idx: int = ) from e self._initialize_hivemind() - def reduce(self, tensor: Union[Any, torch.Tensor], *args: Any, **kwargs: Any) -> Union[Any, torch.Tensor]: + def reduce(self, tensor: Union[Any, Tensor], *args: Any, **kwargs: Any) -> Union[Any, Tensor]: return tensor - def all_gather(self, tensor: torch.Tensor, group: Optional[Any] = None, sync_grads: bool = False) -> torch.Tensor: + def all_gather(self, tensor: Tensor, group: Optional[Any] = None, sync_grads: bool = False) -> Tensor: return tensor def model_to_device(self) -> None: diff --git a/src/pytorch_lightning/strategies/ddp.py b/src/pytorch_lightning/strategies/ddp.py index 655da334eb2f2..e1a1c2bb5fb60 100644 --- a/src/pytorch_lightning/strategies/ddp.py +++ b/src/pytorch_lightning/strategies/ddp.py @@ -22,6 +22,7 @@ import torch import torch.distributed +from torch import Tensor from torch.nn import Module from torch.nn.parallel.distributed import DistributedDataParallel from torch.optim.optimizer import Optimizer @@ -321,7 +322,7 @@ def broadcast(self, obj: object, src: int = 0) -> object: torch.distributed.broadcast_object_list(obj, src, group=_group.WORLD) return obj[0] - def pre_backward(self, closure_loss: torch.Tensor) -> None: + def pre_backward(self, closure_loss: Tensor) -> None: """Run before precision plugin executes backward.""" if not self.lightning_module.automatic_optimization: prepare_for_backward(self.model, closure_loss) @@ -330,7 +331,7 @@ def model_to_device(self): log.detail(f"{self.__class__.__name__}: moving model to device [{self.root_device}]...") self.model.to(self.root_device) - def reduce(self, tensor, group: Optional[Any] = None, reduce_op: Union[ReduceOp, str] = "mean") -> torch.Tensor: + def reduce(self, tensor, group: Optional[Any] = None, reduce_op: Union[ReduceOp, str] = "mean") -> Tensor: """Reduces a tensor from several distributed processes to one aggregated tensor. Args: @@ -342,7 +343,7 @@ def reduce(self, tensor, group: Optional[Any] = None, reduce_op: Union[ReduceOp, Return: reduced value, except when the input was not a tensor the output remains is unchanged """ - if isinstance(tensor, torch.Tensor): + if isinstance(tensor, Tensor): tensor = sync_ddp_if_available(tensor, group, reduce_op=reduce_op) return tensor diff --git a/src/pytorch_lightning/strategies/ddp2.py b/src/pytorch_lightning/strategies/ddp2.py index 2023316e0e118..6046c831a8a69 100644 --- a/src/pytorch_lightning/strategies/ddp2.py +++ b/src/pytorch_lightning/strategies/ddp2.py @@ -13,7 +13,7 @@ # limitations under the License. from typing import Dict -import torch +from torch import Tensor from pytorch_lightning.strategies.ddp import DDPStrategy from pytorch_lightning.utilities.apply_func import apply_to_collection @@ -46,11 +46,11 @@ def reduce(self, collection: _METRIC_COLLECTION, *args, **kwargs) -> _METRIC_COL Reduced tensor values or the same value if it was not or did not contain a tensor. """ - def mean(t: torch.Tensor) -> torch.Tensor: + def mean(t: Tensor) -> Tensor: original_dtype = t.dtype return t.float().mean().to(original_dtype) - return apply_to_collection(collection, torch.Tensor, mean) + return apply_to_collection(collection, Tensor, mean) @property def root_device(self): diff --git a/src/pytorch_lightning/strategies/ddp_spawn.py b/src/pytorch_lightning/strategies/ddp_spawn.py index 4882972f7e861..f9d386ed3fa2b 100644 --- a/src/pytorch_lightning/strategies/ddp_spawn.py +++ b/src/pytorch_lightning/strategies/ddp_spawn.py @@ -17,6 +17,7 @@ import torch import torch.distributed +from torch import Tensor from torch.nn import Module from torch.nn.parallel.distributed import DistributedDataParallel @@ -221,12 +222,12 @@ def model_to_device(self): torch.cuda.set_device(self.root_device) self.model.to(self.root_device) - def pre_backward(self, closure_loss: torch.Tensor) -> None: + def pre_backward(self, closure_loss: Tensor) -> None: """Run before precision plugin executes backward.""" if not self.lightning_module.automatic_optimization: prepare_for_backward(self.model, closure_loss) - def reduce(self, tensor, group: Optional[Any] = None, reduce_op: Union[ReduceOp, str] = "mean") -> torch.Tensor: + def reduce(self, tensor, group: Optional[Any] = None, reduce_op: Union[ReduceOp, str] = "mean") -> Tensor: """Reduces a tensor from several distributed processes to one aggregated tensor. Args: @@ -238,7 +239,7 @@ def reduce(self, tensor, group: Optional[Any] = None, reduce_op: Union[ReduceOp, Return: reduced value, except when the input was not a tensor the output remains is unchanged """ - if isinstance(tensor, torch.Tensor): + if isinstance(tensor, Tensor): tensor = sync_ddp_if_available(tensor, group, reduce_op=reduce_op) return tensor diff --git a/src/pytorch_lightning/strategies/deepspeed.py b/src/pytorch_lightning/strategies/deepspeed.py index d2637fb52b505..56933e1a23e75 100644 --- a/src/pytorch_lightning/strategies/deepspeed.py +++ b/src/pytorch_lightning/strategies/deepspeed.py @@ -22,6 +22,7 @@ from typing import Any, Dict, Generator, List, Mapping, Optional, Tuple, Union import torch +from torch import Tensor from torch.nn import Module from torch.optim import Optimizer @@ -75,10 +76,10 @@ def __init__( self.precision = precision def forward(self, *inputs, **kwargs): - inputs = apply_to_collection(inputs, torch.Tensor, function=self._batch_to) + inputs = apply_to_collection(inputs, Tensor, function=self._batch_to) return super().forward(*inputs, **kwargs) - def _batch_to(self, batch: torch.Tensor) -> torch.Tensor: + def _batch_to(self, batch: Tensor) -> Tensor: if torch.is_floating_point(batch): if self.precision == PrecisionType.HALF: return batch.half() diff --git a/src/pytorch_lightning/strategies/dp.py b/src/pytorch_lightning/strategies/dp.py index 7b6c5abf72c23..bed25e1e56671 100644 --- a/src/pytorch_lightning/strategies/dp.py +++ b/src/pytorch_lightning/strategies/dp.py @@ -14,6 +14,7 @@ from typing import Any, Dict, List, Optional import torch +from torch import Tensor from torch.nn import DataParallel, Module import pytorch_lightning as pl @@ -98,11 +99,11 @@ def reduce(self, collection: _METRIC_COLLECTION, *args, **kwargs) -> _METRIC_COL Reduced tensor values or the same value if it was not or did not contain a tensor. """ - def mean(t: torch.Tensor) -> torch.Tensor: + def mean(t: Tensor) -> Tensor: original_dtype = t.dtype return t.float().mean().to(original_dtype) - return apply_to_collection(collection, torch.Tensor, mean) + return apply_to_collection(collection, Tensor, mean) @property def root_device(self): @@ -143,7 +144,7 @@ def training_step_end(self, output): if isinstance(output, dict) and "loss" in output: output["loss"] = self.reduce(output["loss"]) - elif isinstance(output, torch.Tensor): + elif isinstance(output, Tensor): output = self.reduce(output) return output diff --git a/src/pytorch_lightning/strategies/fully_sharded_native.py b/src/pytorch_lightning/strategies/fully_sharded_native.py index 091b6b176a542..9a11f61c42e52 100644 --- a/src/pytorch_lightning/strategies/fully_sharded_native.py +++ b/src/pytorch_lightning/strategies/fully_sharded_native.py @@ -16,6 +16,7 @@ from typing import Any, Dict, Generator, List, Optional, Union import torch +from torch import Tensor from torch.distributed.distributed_c10d import _get_default_group, ProcessGroup import pytorch_lightning as pl @@ -194,10 +195,10 @@ def broadcast(self, obj: TBroadcast, src: int = 0) -> TBroadcast: def reduce( self, - tensor: Union[torch.Tensor, Any], + tensor: Union[Tensor, Any], group: Optional[Any] = None, reduce_op: Optional[Union[ReduceOp, str]] = "mean", - ) -> torch.Tensor: + ) -> Tensor: """Reduces a tensor from several distributed processes to one aggregated tensor. Args: @@ -209,7 +210,7 @@ def reduce( Return: reduced value, except when the input was not a tensor the output remains is unchanged """ - if isinstance(tensor, torch.Tensor): + if isinstance(tensor, Tensor): tensor = sync_ddp_if_available(tensor, group, reduce_op=reduce_op) return tensor diff --git a/src/pytorch_lightning/strategies/horovod.py b/src/pytorch_lightning/strategies/horovod.py index d4a8710bd6ba6..40fdd6f1120cd 100644 --- a/src/pytorch_lightning/strategies/horovod.py +++ b/src/pytorch_lightning/strategies/horovod.py @@ -16,6 +16,7 @@ import torch import torch.nn as nn +from torch import Tensor from torch.optim import Optimizer import pytorch_lightning as pl @@ -174,9 +175,7 @@ def reduce(self, tensor, group: Optional[Any] = None, reduce_op: Optional[Union[ self.join() return hvd.allreduce(tensor, op=reduce_op) - def all_gather( - self, result: torch.Tensor, group: Optional[Any] = dist_group.WORLD, sync_grads: bool = False - ) -> torch.Tensor: + def all_gather(self, result: Tensor, group: Optional[Any] = dist_group.WORLD, sync_grads: bool = False) -> Tensor: if group is not None and group != dist_group.WORLD: raise ValueError("Horovod does not support allgather using a subcommunicator at this time. Unset `group`.") @@ -188,7 +187,7 @@ def all_gather( self.join() return hvd.allgather(result) - def post_backward(self, closure_loss: torch.Tensor) -> None: + def post_backward(self, closure_loss: Tensor) -> None: # synchronize all horovod optimizers. for optimizer in self.optimizers: optimizer.synchronize() diff --git a/src/pytorch_lightning/strategies/ipu.py b/src/pytorch_lightning/strategies/ipu.py index 705510d81b44c..ece4e92b94c59 100644 --- a/src/pytorch_lightning/strategies/ipu.py +++ b/src/pytorch_lightning/strategies/ipu.py @@ -16,6 +16,7 @@ from typing import Any, Callable, Dict, List, Optional, Union import torch +from torch import FloatTensor, Tensor from torch.utils.data import DataLoader import pytorch_lightning as pl @@ -54,11 +55,11 @@ def forward(self, *inputs: Any, **kwargs: Any) -> Any: return super().forward(*inputs, **kwargs) @staticmethod - def batch_to(data: torch.Tensor) -> torch.Tensor: + def batch_to(data: Tensor) -> Tensor: return data.half() def _move_float_tensors_to_half(self, batch: Any) -> Any: - batch = apply_to_collection(batch, (torch.FloatTensor, torch.cuda.FloatTensor), function=self.batch_to) + batch = apply_to_collection(batch, (FloatTensor, torch.cuda.FloatTensor), function=self.batch_to) return batch @@ -376,13 +377,13 @@ def model_to_device(self) -> None: def is_global_zero(self) -> bool: return True - def reduce(self, tensor: Union[torch.Tensor, Any], *args: Any, **kwargs: Any) -> Union[torch.Tensor, Any]: + def reduce(self, tensor: Union[Tensor, Any], *args: Any, **kwargs: Any) -> Union[Tensor, Any]: return tensor def barrier(self, name: Optional[str] = None) -> None: pass - def all_gather(self, tensor: torch.Tensor, group: Optional[Any] = None, sync_grads: bool = False) -> torch.Tensor: + def all_gather(self, tensor: Tensor, group: Optional[Any] = None, sync_grads: bool = False) -> Tensor: return tensor def broadcast(self, obj: object, src: int = 0) -> object: diff --git a/src/pytorch_lightning/strategies/launchers/spawn.py b/src/pytorch_lightning/strategies/launchers/spawn.py index d67f9e620a45d..eb8265904cbfb 100644 --- a/src/pytorch_lightning/strategies/launchers/spawn.py +++ b/src/pytorch_lightning/strategies/launchers/spawn.py @@ -19,6 +19,7 @@ import numpy as np import torch import torch.multiprocessing as mp +from torch import Tensor import pytorch_lightning as pl from pytorch_lightning.strategies.launchers.base import _Launcher @@ -162,7 +163,7 @@ def add_to_queue(self, trainer: "pl.Trainer", queue: "_FakeQueue") -> None: queue: the instance of the queue to append the data. """ callback_metrics: dict = apply_to_collection( - trainer.callback_metrics, torch.Tensor, lambda x: x.cpu().numpy() + trainer.callback_metrics, Tensor, lambda x: x.cpu().numpy() ) # send as numpy to avoid issues with memory sharing queue.put(callback_metrics) diff --git a/src/pytorch_lightning/strategies/parallel.py b/src/pytorch_lightning/strategies/parallel.py index 342ae9851ce9f..4fc846870ad59 100644 --- a/src/pytorch_lightning/strategies/parallel.py +++ b/src/pytorch_lightning/strategies/parallel.py @@ -16,6 +16,7 @@ from typing import Any, List, Optional import torch +from torch import Tensor from torch.nn.parallel import DistributedDataParallel import pytorch_lightning as pl @@ -106,7 +107,7 @@ def torch_distributed_backend(self) -> str: def reconciliate_processes(self, trace: str): """Function to re-conciliate processes on failure.""" - def all_gather(self, tensor: torch.Tensor, group: Optional[Any] = None, sync_grads: bool = False) -> torch.Tensor: + def all_gather(self, tensor: Tensor, group: Optional[Any] = None, sync_grads: bool = False) -> Tensor: """Perform a all_gather on all processes.""" return all_gather_ddp_if_available(tensor, group=group, sync_grads=sync_grads) diff --git a/src/pytorch_lightning/strategies/sharded.py b/src/pytorch_lightning/strategies/sharded.py index e22dbe0a95199..191f8eedf1a40 100644 --- a/src/pytorch_lightning/strategies/sharded.py +++ b/src/pytorch_lightning/strategies/sharded.py @@ -14,7 +14,7 @@ from contextlib import contextmanager from typing import Dict, Generator, List, Optional, Tuple, Union -import torch +from torch import Tensor from torch.nn import Module from torch.optim import Optimizer @@ -136,7 +136,7 @@ def lightning_module(self) -> Optional["pl.LightningModule"]: ) return unwrap_lightning_module_sharded(self.model) if self.model is not None else None - def pre_backward(self, closure_loss: torch.Tensor) -> None: + def pre_backward(self, closure_loss: Tensor) -> None: pass @contextmanager diff --git a/src/pytorch_lightning/strategies/sharded_spawn.py b/src/pytorch_lightning/strategies/sharded_spawn.py index 19c38004739f7..5dcd18a4bd970 100644 --- a/src/pytorch_lightning/strategies/sharded_spawn.py +++ b/src/pytorch_lightning/strategies/sharded_spawn.py @@ -14,7 +14,7 @@ from contextlib import contextmanager from typing import Dict, Generator, List, Optional, Tuple -import torch +from torch import Tensor from torch.nn import Module from torch.optim import Optimizer @@ -109,7 +109,7 @@ def lightning_module(self) -> Optional["pl.LightningModule"]: ) return unwrap_lightning_module_sharded(self.model) if self.model is not None else None - def pre_backward(self, closure_loss: torch.Tensor) -> None: + def pre_backward(self, closure_loss: Tensor) -> None: pass def post_training_step(self): diff --git a/src/pytorch_lightning/strategies/single_device.py b/src/pytorch_lightning/strategies/single_device.py index 526e82f7453ac..82681ad423199 100644 --- a/src/pytorch_lightning/strategies/single_device.py +++ b/src/pytorch_lightning/strategies/single_device.py @@ -16,6 +16,7 @@ from typing import Any import torch +from torch import Tensor import pytorch_lightning as pl from pytorch_lightning.plugins.io.checkpoint_plugin import CheckpointIO @@ -42,7 +43,7 @@ def __init__( self.local_rank = 0 self.world_size = 1 - def reduce(self, tensor: Any | torch.Tensor, *args: Any, **kwargs: Any) -> Any | torch.Tensor: + def reduce(self, tensor: Any | Tensor, *args: Any, **kwargs: Any) -> Any | Tensor: """Reduces a tensor from several distributed processes to one aggregated tensor. As this plugin only operates with a single device, the reduction is simply the identity. @@ -56,7 +57,7 @@ def reduce(self, tensor: Any | torch.Tensor, *args: Any, **kwargs: Any) -> Any | """ return tensor - def all_gather(self, tensor: torch.Tensor, group: Any | None = None, sync_grads: bool = False) -> torch.Tensor: + def all_gather(self, tensor: Tensor, group: Any | None = None, sync_grads: bool = False) -> Tensor: """Perform a all_gather on all processes.""" return tensor diff --git a/src/pytorch_lightning/strategies/strategy.py b/src/pytorch_lightning/strategies/strategy.py index 8b6d03fcc284f..9de30889336fe 100644 --- a/src/pytorch_lightning/strategies/strategy.py +++ b/src/pytorch_lightning/strategies/strategy.py @@ -250,10 +250,10 @@ def is_global_zero(self) -> bool: @abstractmethod def reduce( self, - tensor: Union[torch.Tensor, Any], + tensor: Union[Tensor, Any], group: Optional[Any] = None, reduce_op: Optional[Union[ReduceOp, str]] = "mean", - ) -> Union[torch.Tensor, Any]: + ) -> Union[Tensor, Any]: """Reduces the given tensor (e.g. across GPUs/processes). Args: @@ -281,7 +281,7 @@ def broadcast(self, obj: TBroadcast, src: int = 0) -> TBroadcast: """ @abstractmethod - def all_gather(self, tensor: torch.Tensor, group: Optional[Any] = None, sync_grads: bool = False) -> torch.Tensor: + def all_gather(self, tensor: Tensor, group: Optional[Any] = None, sync_grads: bool = False) -> Tensor: """Perform an all_gather on all processes. Args: @@ -294,10 +294,10 @@ def reduce_boolean_decision(self, decision: bool) -> bool: """Reduce the early stopping decision across all processes.""" return decision - def pre_backward(self, closure_loss: torch.Tensor) -> None: + def pre_backward(self, closure_loss: Tensor) -> None: """Run before precision plugin executes backward.""" - def post_backward(self, closure_loss: torch.Tensor) -> None: + def post_backward(self, closure_loss: Tensor) -> None: """Run after precision plugin executes backward.""" @property diff --git a/src/pytorch_lightning/strategies/tpu_spawn.py b/src/pytorch_lightning/strategies/tpu_spawn.py index fd57f97039492..9fd3796f89009 100644 --- a/src/pytorch_lightning/strategies/tpu_spawn.py +++ b/src/pytorch_lightning/strategies/tpu_spawn.py @@ -16,6 +16,7 @@ from typing import Any, Dict, List, Optional, Union import torch +from torch import Tensor from torch.nn import Module from torch.utils.data import DataLoader @@ -198,7 +199,7 @@ def reduce_boolean_decision(self, decision: bool) -> bool: return decision def reduce(self, output, group: Optional[Any] = None, reduce_op: Optional[Union[ReduceOp, str]] = None): - if not isinstance(output, torch.Tensor): + if not isinstance(output, Tensor): output = torch.tensor(output, device=self.root_device) _invalid_reduce_op = isinstance(reduce_op, ReduceOp) and reduce_op != ReduceOp.SUM @@ -275,7 +276,7 @@ def remove_checkpoint(self, filepath: _PATH) -> None: if self.local_rank == 0: self.checkpoint_io.remove_checkpoint(filepath) - def all_gather(self, tensor: torch.Tensor, group: Optional[Any] = None, sync_grads: bool = False) -> torch.Tensor: + def all_gather(self, tensor: Tensor, group: Optional[Any] = None, sync_grads: bool = False) -> Tensor: """ Function to gather a tensor from several distributed processes Args: @@ -285,7 +286,7 @@ def all_gather(self, tensor: torch.Tensor, group: Optional[Any] = None, sync_gra Return: A tensor of shape (world_size, batch, ...) """ - if isinstance(tensor, torch.Tensor) and tensor.dim() == 0: + if isinstance(tensor, Tensor) and tensor.dim() == 0: tensor = tensor.unsqueeze(0) return xm.all_gather(tensor) diff --git a/src/pytorch_lightning/trainer/callback_hook.py b/src/pytorch_lightning/trainer/callback_hook.py index 274b828a8143d..904cbc872376f 100644 --- a/src/pytorch_lightning/trainer/callback_hook.py +++ b/src/pytorch_lightning/trainer/callback_hook.py @@ -15,8 +15,8 @@ from copy import deepcopy from typing import Any, Dict, List, Optional, Type, Union -import torch from packaging.version import Version +from torch import Tensor import pytorch_lightning as pl from pytorch_lightning.callbacks import Callback @@ -627,7 +627,7 @@ def on_load_checkpoint(self, checkpoint: Dict[str, Any]) -> None: state = deepcopy(state) callback.on_load_checkpoint(self, self.lightning_module, state) - def on_before_backward(self, loss: torch.Tensor) -> None: + def on_before_backward(self, loss: Tensor) -> None: r""" .. deprecated:: v1.6 `TrainerCallbackHookMixin.on_before_backward` was deprecated in v1.6 and will be removed in v1.8. diff --git a/src/pytorch_lightning/trainer/connectors/checkpoint_connector.py b/src/pytorch_lightning/trainer/connectors/checkpoint_connector.py index 666c1d6e49ea4..5bc591c7c6719 100644 --- a/src/pytorch_lightning/trainer/connectors/checkpoint_connector.py +++ b/src/pytorch_lightning/trainer/connectors/checkpoint_connector.py @@ -19,6 +19,7 @@ from typing import Any, Dict, Optional import torch +from torch import Tensor from torchmetrics import Metric import pytorch_lightning as pl @@ -448,7 +449,7 @@ def save_checkpoint( _checkpoint = self.dump_checkpoint(weights_only) self.trainer.strategy.save_checkpoint(_checkpoint, filepath, storage_options=storage_options) - def _get_lightning_module_state_dict(self) -> Dict[str, torch.Tensor]: + def _get_lightning_module_state_dict(self) -> Dict[str, Tensor]: metrics = ( [m for m in self.trainer.lightning_module.modules() if isinstance(m, Metric)] if _fault_tolerant_training() diff --git a/src/pytorch_lightning/trainer/connectors/logger_connector/logger_connector.py b/src/pytorch_lightning/trainer/connectors/logger_connector/logger_connector.py index b6e8d425dbb02..ff882912625d0 100644 --- a/src/pytorch_lightning/trainer/connectors/logger_connector/logger_connector.py +++ b/src/pytorch_lightning/trainer/connectors/logger_connector/logger_connector.py @@ -13,7 +13,7 @@ # limitations under the License. from typing import Any, Iterable, Optional, Union -import torch +from torch import Tensor import pytorch_lightning as pl from pytorch_lightning.loggers import Logger, TensorBoardLogger @@ -260,7 +260,7 @@ def progress_bar_metrics(self) -> _PBAR_DICT: return self._progress_bar_metrics def teardown(self) -> None: - args = (torch.Tensor, move_data_to_device, "cpu") + args = (Tensor, move_data_to_device, "cpu") self._logged_metrics = apply_to_collection(self._logged_metrics, *args) self._progress_bar_metrics = apply_to_collection(self._progress_bar_metrics, *args) self._callback_metrics = apply_to_collection(self._callback_metrics, *args) diff --git a/src/pytorch_lightning/trainer/connectors/logger_connector/result.py b/src/pytorch_lightning/trainer/connectors/logger_connector/result.py index 3e61591729662..b1d8a064e122e 100644 --- a/src/pytorch_lightning/trainer/connectors/logger_connector/result.py +++ b/src/pytorch_lightning/trainer/connectors/logger_connector/result.py @@ -17,6 +17,7 @@ from typing import Any, Callable, cast, Dict, List, Optional, Tuple, Union import torch +from torch import Tensor from torchmetrics import Metric from typing_extensions import TypedDict @@ -29,8 +30,8 @@ from pytorch_lightning.utilities.rank_zero import rank_zero_warn from pytorch_lightning.utilities.warnings import WarningCache -_IN_METRIC = Union[Metric, torch.Tensor] # Do not include scalars as they were converted to tensors -_OUT_METRIC = Union[torch.Tensor, Dict[str, torch.Tensor]] +_IN_METRIC = Union[Metric, Tensor] # Do not include scalars as they were converted to tensors +_OUT_METRIC = Union[Tensor, Dict[str, Tensor]] _PBAR_METRIC = Union[float, Dict[str, float]] _OUT_DICT = Dict[str, _OUT_METRIC] _PBAR_DICT = Dict[str, _PBAR_METRIC] @@ -216,14 +217,14 @@ def __init__(self, metadata: _Metadata, is_tensor: bool) -> None: # do not set a dtype in case the default dtype was changed self.add_state("value", torch.tensor(default), dist_reduce_fx=torch.sum) if self.meta.is_mean_reduction: - self.cumulated_batch_size: torch.Tensor + self.cumulated_batch_size: Tensor self.add_state("cumulated_batch_size", torch.tensor(0), dist_reduce_fx=torch.sum) # this is defined here only because upstream is missing the type annotation self._forward_cache: Optional[Any] = None def update(self, value: _IN_METRIC, batch_size: int) -> None: # type: ignore[override] if self.is_tensor: - value = cast(torch.Tensor, value) + value = cast(Tensor, value) if not torch.is_floating_point(value): dtype = torch.get_default_dtype() warning_cache.warn( @@ -254,7 +255,7 @@ def update(self, value: _IN_METRIC, batch_size: int) -> None: # type: ignore[ov self.value = value self._forward_cache = value._forward_cache - def compute(self) -> torch.Tensor: + def compute(self) -> Tensor: if self.is_tensor: value = self.meta.sync(self.value) if self.meta.is_mean_reduction: @@ -331,9 +332,7 @@ def _reconstruct(cls, state: dict, sync_fn: Optional[Callable] = None) -> "_Resu return result_metric def to(self, *args: Any, **kwargs: Any) -> "_ResultMetric": - self.__dict__.update( - apply_to_collection(self.__dict__, (torch.Tensor, Metric), move_data_to_device, *args, **kwargs) - ) + self.__dict__.update(apply_to_collection(self.__dict__, (Tensor, Metric), move_data_to_device, *args, **kwargs)) return self @@ -455,7 +454,7 @@ def log( value = recursive_detach(value) # move metrics to cpu on TPU. - if isinstance(value, torch.Tensor) and value.device.type == "xla": + if isinstance(value, Tensor) and value.device.type == "xla": value = value.cpu() # storage key @@ -500,16 +499,16 @@ def register_key(self, key: str, meta: _Metadata, value: _METRIC_COLLECTION) -> """ def fn(v: _IN_METRIC) -> _ResultMetric: - metric = _ResultMetric(meta, isinstance(v, torch.Tensor)) + metric = _ResultMetric(meta, isinstance(v, Tensor)) return metric.to(self.device) - value = apply_to_collection(value, (torch.Tensor, Metric), fn) + value = apply_to_collection(value, (Tensor, Metric), fn) if isinstance(value, dict): value = _ResultMetricCollection(value) self[key] = value def update_metrics(self, key: str, value: _METRIC_COLLECTION, batch_size: int) -> None: - def fn(result_metric: _ResultMetric, v: torch.Tensor) -> None: + def fn(result_metric: _ResultMetric, v: Tensor) -> None: # performance: avoid calling `__call__` to avoid the checks in `torch.nn.Module._call_impl` result_metric.forward(v.to(self.device), batch_size) result_metric.has_reset = False @@ -517,7 +516,7 @@ def fn(result_metric: _ResultMetric, v: torch.Tensor) -> None: apply_to_collections(self[key], value, _ResultMetric, fn) @staticmethod - def _get_cache(result_metric: _ResultMetric, on_step: bool) -> Optional[torch.Tensor]: + def _get_cache(result_metric: _ResultMetric, on_step: bool) -> Optional[Tensor]: cache = None if on_step and result_metric.meta.on_step: cache = result_metric._forward_cache @@ -571,7 +570,7 @@ def any_tensor(_: Any) -> None: nonlocal has_tensor has_tensor = True - apply_to_collection(value, torch.Tensor, any_tensor) + apply_to_collection(value, Tensor, any_tensor) if not has_tensor: continue @@ -612,7 +611,7 @@ def fn(item: _ResultMetric) -> None: def to(self, *args: Any, **kwargs: Any) -> "_ResultCollection": """Move all data to the given device.""" - self.update(apply_to_collection(dict(self), (torch.Tensor, Metric), move_data_to_device, *args, **kwargs)) + self.update(apply_to_collection(dict(self), (Tensor, Metric), move_data_to_device, *args, **kwargs)) if "device" in kwargs: self.device = kwargs["device"] diff --git a/src/pytorch_lightning/trainer/trainer.py b/src/pytorch_lightning/trainer/trainer.py index 3df7063617069..4f7b1feac2642 100644 --- a/src/pytorch_lightning/trainer/trainer.py +++ b/src/pytorch_lightning/trainer/trainer.py @@ -31,6 +31,7 @@ import torch import torch.distributed as dist from packaging.version import Version +from torch import Tensor from torch.optim import Optimizer from torch.utils.data import DataLoader @@ -1192,7 +1193,7 @@ def _log_hyperparams(self) -> None: lm_val, dm_val = lightning_hparams[key], datamodule_hparams[key] if type(lm_val) != type(dm_val): inconsistent_keys.append(key) - elif isinstance(lm_val, torch.Tensor) and id(lm_val) != id(dm_val): + elif isinstance(lm_val, Tensor) and id(lm_val) != id(dm_val): inconsistent_keys.append(key) elif lm_val != dm_val: inconsistent_keys.append(key) @@ -1289,7 +1290,7 @@ def _run_evaluate(self) -> _EVALUATE_OUTPUT: for result in eval_loop_results: if isinstance(result, dict): for k, v in result.items(): - if isinstance(v, torch.Tensor): + if isinstance(v, Tensor): result[k] = v.cpu().item() return eval_loop_results diff --git a/src/pytorch_lightning/utilities/apply_func.py b/src/pytorch_lightning/utilities/apply_func.py index ff53789d3ea45..cfeb48c423332 100644 --- a/src/pytorch_lightning/utilities/apply_func.py +++ b/src/pytorch_lightning/utilities/apply_func.py @@ -24,6 +24,7 @@ import numpy as np import torch +from torch import Tensor from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.imports import _compare_version, _TORCHTEXT_LEGACY @@ -43,15 +44,15 @@ def to_dtype_tensor( value: Union[int, float, List[Union[int, float]]], dtype: torch.dtype, device: Union[str, torch.device] -) -> torch.Tensor: +) -> Tensor: return torch.tensor(value, dtype=dtype, device=device) -def from_numpy(value: np.ndarray, device: Union[str, torch.device]) -> torch.Tensor: +def from_numpy(value: np.ndarray, device: Union[str, torch.device]) -> Tensor: return torch.from_numpy(value).to(device) -CONVERSION_DTYPES: List[Tuple[Any, Callable[[Any, Any], torch.Tensor]]] = [ +CONVERSION_DTYPES: List[Tuple[Any, Callable[[Any, Any], Tensor]]] = [ # bool -> uint8 as bool -> torch.bool triggers RuntimeError: Unsupported data type for NCCL process group (bool, partial(to_dtype_tensor, dtype=torch.uint8)), (int, partial(to_dtype_tensor, dtype=torch.int)), @@ -342,7 +343,7 @@ def batch_to(data: Any) -> Any: kwargs = {} # Don't issue non-blocking transfers to CPU - if isinstance(data, torch.Tensor) and device not in _CPU_DEVICES: + if isinstance(data, Tensor) and device not in _CPU_DEVICES: kwargs["non_blocking"] = True data_output = data.to(device, **kwargs) if data_output is not None: @@ -358,8 +359,8 @@ def convert_to_tensors(data: Any, device: Union[str, torch.device]) -> Any: for src_dtype, conversion_func in CONVERSION_DTYPES: data = apply_to_collection(data, src_dtype, conversion_func, device=device) - def _move_to_device_and_make_contiguous(t: torch.Tensor, device: Union[str, torch.device]) -> torch.Tensor: + def _move_to_device_and_make_contiguous(t: Tensor, device: Union[str, torch.device]) -> Tensor: return t.to(device).contiguous() - data = apply_to_collection(data, torch.Tensor, _move_to_device_and_make_contiguous, device=device) + data = apply_to_collection(data, Tensor, _move_to_device_and_make_contiguous, device=device) return data diff --git a/src/pytorch_lightning/utilities/data.py b/src/pytorch_lightning/utilities/data.py index 86cdb741bd5e5..b788e6147dee9 100644 --- a/src/pytorch_lightning/utilities/data.py +++ b/src/pytorch_lightning/utilities/data.py @@ -21,6 +21,7 @@ from typing import Any, Callable, Dict, Generator, Iterable, Mapping, Optional, Set, Type, Union import torch +from torch import Tensor from torch.utils.data import BatchSampler, DataLoader, IterableDataset, RandomSampler, Sampler, SequentialSampler import pytorch_lightning as pl @@ -34,13 +35,13 @@ from pytorch_lightning.utilities.seed import pl_worker_init_function from pytorch_lightning.utilities.warnings import WarningCache -BType = Union[torch.Tensor, str, Mapping[Any, "BType"], Iterable["BType"]] +BType = Union[Tensor, str, Mapping[Any, "BType"], Iterable["BType"]] warning_cache = WarningCache() def _extract_batch_size(batch: BType) -> Generator[int, None, None]: - if isinstance(batch, torch.Tensor): + if isinstance(batch, Tensor): if batch.ndim == 0: yield 1 else: diff --git a/src/pytorch_lightning/utilities/distributed.py b/src/pytorch_lightning/utilities/distributed.py index cd839f7fd5465..c60e4cef694c0 100644 --- a/src/pytorch_lightning/utilities/distributed.py +++ b/src/pytorch_lightning/utilities/distributed.py @@ -17,6 +17,7 @@ from typing import Any, Callable, Dict, List, Optional, Tuple, Union import torch +from torch import Tensor from torch.nn.parallel.distributed import DistributedDataParallel import pytorch_lightning as pl @@ -45,7 +46,7 @@ class group: # type: ignore log = logging.getLogger(__name__) -def gather_all_tensors(result: torch.Tensor, group: Optional[Any] = None) -> List[torch.Tensor]: +def gather_all_tensors(result: Tensor, group: Optional[Any] = None) -> List[Tensor]: """Function to gather all tensors from several ddp processes onto a list that is broadcasted to all processes. Args: @@ -78,8 +79,8 @@ def distributed_available() -> bool: def sync_ddp_if_available( - result: torch.Tensor, group: Optional[Any] = None, reduce_op: Optional[Union[ReduceOp, str]] = None -) -> torch.Tensor: + result: Tensor, group: Optional[Any] = None, reduce_op: Optional[Union[ReduceOp, str]] = None +) -> Tensor: """Function to reduce a tensor across worker processes during distributed training. Args: @@ -96,9 +97,7 @@ def sync_ddp_if_available( return result -def sync_ddp( - result: torch.Tensor, group: Optional[Any] = None, reduce_op: Optional[Union[ReduceOp, str]] = None -) -> torch.Tensor: +def sync_ddp(result: Tensor, group: Optional[Any] = None, reduce_op: Optional[Union[ReduceOp, str]] = None) -> Tensor: """Function to reduce the tensors from several ddp processes to one main process. Args: @@ -146,9 +145,9 @@ class AllGatherGrad(torch.autograd.Function): @staticmethod def forward( ctx: Any, - tensor: torch.Tensor, + tensor: Tensor, group: Optional["torch.distributed.ProcessGroup"] = group.WORLD, - ) -> torch.Tensor: + ) -> Tensor: ctx.group = group gathered_tensor = [torch.zeros_like(tensor) for _ in range(torch.distributed.get_world_size())] @@ -159,7 +158,7 @@ def forward( return gathered_tensor @staticmethod - def backward(ctx: Any, *grad_output: torch.Tensor) -> Tuple[torch.Tensor, None]: + def backward(ctx: Any, *grad_output: Tensor) -> Tuple[Tensor, None]: grad_output = torch.cat(grad_output) torch.distributed.all_reduce(grad_output, op=torch.distributed.ReduceOp.SUM, async_op=False, group=ctx.group) @@ -168,8 +167,8 @@ def backward(ctx: Any, *grad_output: torch.Tensor) -> Tuple[torch.Tensor, None]: def all_gather_ddp_if_available( - tensor: torch.Tensor, group: Optional["torch.distributed.ProcessGroup"] = None, sync_grads: bool = False -) -> torch.Tensor: + tensor: Tensor, group: Optional["torch.distributed.ProcessGroup"] = None, sync_grads: bool = False +) -> Tensor: """Function to gather a tensor from several distributed processes. Args: diff --git a/src/pytorch_lightning/utilities/logger.py b/src/pytorch_lightning/utilities/logger.py index ef27761a2ec6e..07ecf4c3c0ca0 100644 --- a/src/pytorch_lightning/utilities/logger.py +++ b/src/pytorch_lightning/utilities/logger.py @@ -18,6 +18,7 @@ import numpy as np import torch +from torch import Tensor def _convert_params(params: Union[Dict[str, Any], Namespace]) -> Dict[str, Any]: @@ -126,7 +127,7 @@ def _sanitize_params(params: Dict[str, Any]) -> Dict[str, Any]: # convert relevant np scalars to python types first (instead of str) if isinstance(params[k], (np.bool_, np.integer, np.floating)): params[k] = params[k].item() - elif type(params[k]) not in [bool, int, float, str, torch.Tensor]: + elif type(params[k]) not in [bool, int, float, str, Tensor]: params[k] = str(params[k]) return params diff --git a/src/pytorch_lightning/utilities/memory.py b/src/pytorch_lightning/utilities/memory.py index f42f662d2fc65..286a571001b0f 100644 --- a/src/pytorch_lightning/utilities/memory.py +++ b/src/pytorch_lightning/utilities/memory.py @@ -21,6 +21,7 @@ from typing import Any, Dict import torch +from torch import Tensor from torch.nn import Module from pytorch_lightning.utilities.apply_func import apply_to_collection @@ -30,7 +31,7 @@ def recursive_detach(in_dict: Any, to_cpu: bool = False) -> Any: """Detach all tensors in `in_dict`. May operate recursively if some of the values in `in_dict` are dictionaries - which contain instances of `torch.Tensor`. Other types in `in_dict` are + which contain instances of `Tensor`. Other types in `in_dict` are not affected by this utility function. Args: @@ -41,13 +42,13 @@ def recursive_detach(in_dict: Any, to_cpu: bool = False) -> Any: out_dict: Dictionary with detached tensors """ - def detach_and_move(t: torch.Tensor, to_cpu: bool) -> torch.Tensor: + def detach_and_move(t: Tensor, to_cpu: bool) -> Tensor: t = t.detach() if to_cpu: t = t.cpu() return t - return apply_to_collection(in_dict, torch.Tensor, detach_and_move, to_cpu=to_cpu) + return apply_to_collection(in_dict, Tensor, detach_and_move, to_cpu=to_cpu) def is_oom_error(exception: BaseException) -> bool: diff --git a/src/pytorch_lightning/utilities/meta.py b/src/pytorch_lightning/utilities/meta.py index a5edcfb300188..c66253a87936e 100644 --- a/src/pytorch_lightning/utilities/meta.py +++ b/src/pytorch_lightning/utilities/meta.py @@ -42,7 +42,7 @@ def enable_python_mode(cls) -> Iterator[None]: if not hasattr(cls, "__torch_dispatch__"): raise ValueError("The class passed to enable_python_mode " "must have a __torch_dispatch__ classmethod") - if not isinstance(cls, type) or not issubclass(cls, (torch.Tensor,)): + if not isinstance(cls, type) or not issubclass(cls, (Tensor,)): raise ValueError("The argument passed to enable_python_mode " "must be the type of a Tensor subclass") torch._C._enter_python_mode(cls) try: diff --git a/src/pytorch_lightning/utilities/metrics.py b/src/pytorch_lightning/utilities/metrics.py index e46c23bc95d94..0a9f0dd5f027e 100644 --- a/src/pytorch_lightning/utilities/metrics.py +++ b/src/pytorch_lightning/utilities/metrics.py @@ -16,7 +16,7 @@ from typing import Any -import torch +from torch import Tensor from pytorch_lightning.utilities.apply_func import apply_to_collection from pytorch_lightning.utilities.exceptions import MisconfigurationException @@ -30,11 +30,11 @@ def metrics_to_scalars(metrics: Any) -> Any: If tensors inside ``metrics`` contains multiple elements, hence preventing conversion to a scalar. """ - def to_item(value: torch.Tensor) -> int | float | bool: + def to_item(value: Tensor) -> int | float | bool: if value.numel() != 1: raise MisconfigurationException( f"The metric `{value}` does not contain a single element, thus it cannot be converted to a scalar." ) return value.item() - return apply_to_collection(metrics, torch.Tensor, to_item) + return apply_to_collection(metrics, Tensor, to_item) diff --git a/src/pytorch_lightning/utilities/optimizer.py b/src/pytorch_lightning/utilities/optimizer.py index 75efa57fc0884..b4cc49627a52c 100644 --- a/src/pytorch_lightning/utilities/optimizer.py +++ b/src/pytorch_lightning/utilities/optimizer.py @@ -14,7 +14,7 @@ from typing import Iterable -import torch +from torch import Tensor from torch.optim import Optimizer from pytorch_lightning.utilities.apply_func import apply_to_collection, move_data_to_device @@ -30,4 +30,4 @@ def optimizers_to_device(optimizers: Iterable[Optimizer], device: _DEVICE) -> No def optimizer_to_device(optimizer: Optimizer, device: _DEVICE) -> None: """Moves the state of a single optimizer to the device.""" for p, v in optimizer.state.items(): - optimizer.state[p] = apply_to_collection(v, torch.Tensor, move_data_to_device, device) + optimizer.state[p] = apply_to_collection(v, Tensor, move_data_to_device, device) diff --git a/src/pytorch_lightning/utilities/types.py b/src/pytorch_lightning/utilities/types.py index c65ac4b39eccd..0b10b5eebc7b1 100644 --- a/src/pytorch_lightning/utilities/types.py +++ b/src/pytorch_lightning/utilities/types.py @@ -21,15 +21,16 @@ from typing import Any, Dict, Iterator, List, Mapping, Optional, Sequence, Type, Union import torch +from torch import Tensor from torch.optim import Optimizer from torch.utils.data import DataLoader from torchmetrics import Metric from typing_extensions import Protocol, runtime_checkable _NUMBER = Union[int, float] -_METRIC = Union[Metric, torch.Tensor, _NUMBER] +_METRIC = Union[Metric, Tensor, _NUMBER] _METRIC_COLLECTION = Union[_METRIC, Mapping[str, _METRIC]] -STEP_OUTPUT = Union[torch.Tensor, Dict[str, Any]] +STEP_OUTPUT = Union[Tensor, Dict[str, Any]] EPOCH_OUTPUT = List[STEP_OUTPUT] _EVALUATE_OUTPUT = List[Dict[str, float]] # 1 dict per DataLoader _PREDICT_OUTPUT = Union[List[Any], List[List[Any]]] @@ -94,7 +95,7 @@ def __init__( ) -> None: ... - def step(self, metrics: Union[float, int, torch.Tensor], epoch: Optional[int] = None) -> None: + def step(self, metrics: Union[float, int, Tensor], epoch: Optional[int] = None) -> None: ... From bc973d6cd3275653640f8fc54f30c7fa339851f0 Mon Sep 17 00:00:00 2001 From: Jirka Date: Fri, 10 Jun 2022 11:11:07 +0200 Subject: [PATCH 19/20] readthedocs --- .readthedocs.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 5e60740931932..cb05ea3116615 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -26,7 +26,7 @@ submodules: # Build documentation in the docs/ directory with Sphinx # reference: https://docs.readthedocs.io/en/stable/config-file/v2.html#sphinx sphinx: - configuration: docs/source/conf.py + configuration: docs/source-PL/conf.py fail_on_warning: true # Build documentation with MkDocs @@ -52,3 +52,5 @@ python: install: - requirements: requirements/docs.txt #- requirements: requirements.txt + - method: pip + path: . From f3f852cfd3fb251e1295b627066ec4c69e554af5 Mon Sep 17 00:00:00 2001 From: Jirka Date: Fri, 10 Jun 2022 14:30:30 +0200 Subject: [PATCH 20/20] update paths & codeowners --- .github/CODEOWNERS | 74 ++++++++++++++++++++--------------------- .github/CONTRIBUTING.md | 6 ++-- .gitignore | 5 ++- MANIFEST.in | 13 -------- Makefile | 19 +++++++---- setup.py | 6 ++-- test/README.md | 8 ++--- 7 files changed, 61 insertions(+), 70 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e3d913971c168..971029c640d6c 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -16,48 +16,48 @@ /docs/ @edenlightning @tchaton @borda @awaelchli @RobertLaurella /.github/*.md @edenlightning @williamfalcon @borda /.github/ISSUE_TEMPLATE/ @edenlightning @borda @tchaton -/docs/source/conf.py @borda @awaelchli @carmocca -/docs/source/index.rst @williamfalcon -/docs/source/levels @williamfalcon @RobertLaurella -/docs/source/expertise_levels @williamfalcon @RobertLaurella +/docs/source-PL/conf.py @borda @awaelchli @carmocca +/docs/source-PL/index.rst @williamfalcon +/docs/source-PL/levels @williamfalcon @RobertLaurella +/docs/source-PL/expertise_levels @williamfalcon @RobertLaurella # Packages -/pytorch_lightning/accelerators @williamfalcon @tchaton @SeanNaren @awaelchli @justusschock @kaushikb11 -/pytorch_lightning/callbacks @williamfalcon @tchaton @carmocca @borda @kaushikb11 -/pytorch_lightning/core @tchaton @SeanNaren @borda @carmocca @justusschock @kaushikb11 -/pytorch_lightning/distributed @williamfalcon @tchaton @awaelchli @kaushikb11 -/pytorch_lightning/lite @tchaton @awaelchli @carmocca -/pytorch_lightning/loggers @tchaton @awaelchli @borda -/pytorch_lightning/loggers/wandb.py @borisdayma -/pytorch_lightning/loggers/neptune.py @shnela @HubertJaworski @pkasprzyk @pitercl @Raalsky @aniezurawski @kamil-kaczmarek -/pytorch_lightning/loops @tchaton @awaelchli @justusschock @carmocca -/pytorch_lightning/overrides @tchaton @SeanNaren @borda -/pytorch_lightning/plugins @tchaton @SeanNaren @awaelchli @justusschock -/pytorch_lightning/profiler @williamfalcon @tchaton @borda @carmocca -/pytorch_lightning/profiler/pytorch.py @nbcsm @guotuofeng -/pytorch_lightning/strategies @tchaton @SeanNaren @awaelchli @justusschock @kaushikb11 -/pytorch_lightning/trainer @williamfalcon @borda @tchaton @SeanNaren @carmocca @awaelchli @justusschock @kaushikb11 -/pytorch_lightning/trainer/connectors @tchaton @SeanNaren @carmocca @borda -/pytorch_lightning/tuner @SkafteNicki @borda @awaelchli -/pytorch_lightning/utilities @borda @tchaton @SeanNaren @carmocca +/src/pytorch_lightning/accelerators @williamfalcon @tchaton @SeanNaren @awaelchli @justusschock @kaushikb11 +/src/pytorch_lightning/callbacks @williamfalcon @tchaton @carmocca @borda @kaushikb11 +/src/pytorch_lightning/core @tchaton @SeanNaren @borda @carmocca @justusschock @kaushikb11 +/src/pytorch_lightning/distributed @williamfalcon @tchaton @awaelchli @kaushikb11 +/src/pytorch_lightning/lite @tchaton @awaelchli @carmocca +/src/pytorch_lightning/loggers @tchaton @awaelchli @borda +/src/pytorch_lightning/loggers/wandb.py @borisdayma +/src/pytorch_lightning/loggers/neptune.py @shnela @HubertJaworski @pkasprzyk @pitercl @Raalsky @aniezurawski @kamil-kaczmarek +/src/pytorch_lightning/loops @tchaton @awaelchli @justusschock @carmocca +/src/pytorch_lightning/overrides @tchaton @SeanNaren @borda +/src/pytorch_lightning/plugins @tchaton @SeanNaren @awaelchli @justusschock +/src/pytorch_lightning/profiler @williamfalcon @tchaton @borda @carmocca +/src/pytorch_lightning/profiler/pytorch.py @nbcsm @guotuofeng +/src/pytorch_lightning/strategies @tchaton @SeanNaren @awaelchli @justusschock @kaushikb11 +/src/pytorch_lightning/trainer @williamfalcon @borda @tchaton @SeanNaren @carmocca @awaelchli @justusschock @kaushikb11 +/src/pytorch_lightning/trainer/connectors @tchaton @SeanNaren @carmocca @borda +/src/pytorch_lightning/tuner @SkafteNicki @borda @awaelchli +/src/pytorch_lightning/utilities @borda @tchaton @SeanNaren @carmocca # Specifics -/pytorch_lightning/trainer/connectors/logger_connector @tchaton @carmocca -/pytorch_lightning/trainer/progress.py @tchaton @awaelchli @carmocca +/src/pytorch_lightning/trainer/connectors/logger_connector @tchaton @carmocca +/src/pytorch_lightning/trainer/progress.py @tchaton @awaelchli @carmocca # API -/pytorch_lightning/callbacks/base.py @williamfalcon @awaelchli @ananthsub @carmocca -/pytorch_lightning/core/datamodule.py @williamFalcon @awaelchli @ananthsub @carmocca -/pytorch_lightning/trainer/trainer.py @williamfalcon @tchaton @awaelchli -/pytorch_lightning/core/hooks.py @williamfalcon @tchaton @awaelchli @ananthsub @carmocca -/pytorch_lightning/core/lightning.py @williamfalcon @tchaton @awaelchli +/src/pytorch_lightning/callbacks/base.py @williamfalcon @awaelchli @ananthsub @carmocca +/src/pytorch_lightning/core/datamodule.py @williamFalcon @awaelchli @ananthsub @carmocca +/src/pytorch_lightning/trainer/trainer.py @williamfalcon @tchaton @awaelchli +/src/pytorch_lightning/core/hooks.py @williamfalcon @tchaton @awaelchli @ananthsub @carmocca +/src/pytorch_lightning/core/lightning.py @williamfalcon @tchaton @awaelchli # Testing -/tests/helpers/boring_model.py @williamfalcon @tchaton @borda - -/.github/CODEOWNERS @williamfalcon -/.github/approve_config.yml @williamfalcon -/SECURITY.md @williamfalcon -/README.md @williamfalcon @edenlightning @borda -/setup.py @williamfalcon @borda @carmocca -/pytorch_lightning/__about__.py @williamfalcon @borda @carmocca +/test/unittests_pl/helpers/boring_model.py @williamfalcon @tchaton @borda + +/.github/CODEOWNERS @williamfalcon +/.github/approve_config.yml @williamfalcon +/SECURITY.md @williamfalcon +/README.md @williamfalcon @edenlightning @borda +/setup.py @williamfalcon @borda @carmocca +/src/pytorch_lightning/__about__.py @williamfalcon @borda @carmocca diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 06285ce7ac50d..cc8236e12e55d 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -134,7 +134,7 @@ To learn about development of docs, check out the docs [README.md](https://githu ### Testing -To learn about tests, check out the tests [README.md](https://github.com/PyTorchLightning/pytorch-lightning/blob/master/tests/README.md). +To learn about tests, check out the tests [README.md](https://github.com/PyTorchLightning/pytorch-lightning/blob/master/test/README.md). ### Pull Request @@ -165,7 +165,7 @@ We welcome any useful contribution! For your convenience here's a recommended wo 1. If any of the existing tests fail in your PR on our CI, refer to the following READMEs to identify what's failing and try to address it. - - [Test README](https://github.com/PyTorchLightning/pytorch-lightning/blob/master/tests/README.md) + - [Test README](https://github.com/PyTorchLightning/pytorch-lightning/blob/master/test/README.md) - [CI/CD README](https://github.com/PyTorchLightning/pytorch-lightning/blob/master/.github/workflows/README.md) 1. When you feel ready for integrating your work, mark your PR "Ready for review". @@ -235,7 +235,7 @@ Here are tutorials: Here is the process to create a new test - 0. Optional: Follow tutorials ! -- 1. Find a file in tests/ which match what you want to test. If none, create one. +- 1. Find a file in test/ which match what you want to test. If none, create one. - 2. Use this template to get started ! - 3. Use **BoringModel and derivates to test out your code**. diff --git a/.gitignore b/.gitignore index 773206075401b..f71704be9c57e 100644 --- a/.gitignore +++ b/.gitignore @@ -71,9 +71,8 @@ nosetests.xml coverage.xml *.cover .hypothesis/ -tests/tests_tt_dir/ -tests/save_dir -tests/tests/ +test/*/tests_tt_dir/ +test/*/save_dir # Translations *.mo diff --git a/MANIFEST.in b/MANIFEST.in index a68fc82474e70..923f0a0997201 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,16 +1,3 @@ -# Copyright The PyTorch Lightning team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. include pytorch_lightning/py.typed # marker file for PEP 561 include CHANGELOG.md recursive-include requirements *.txt diff --git a/Makefile b/Makefile index 0f5f62e6b6e49..4137e2cdb5cf3 100644 --- a/Makefile +++ b/Makefile @@ -14,18 +14,23 @@ clean: rm -rf .mypy_cache rm -rf .pytest_cache rm -rf ./docs/build - rm -rf ./docs/source/notebooks - rm -rf ./docs/source/generated - rm -rf ./docs/source/*/generated - rm -rf ./docs/source/api + rm -rf ./docs/source-PL/notebooks + rm -rf ./docs/source-PL/generated + rm -rf ./docs/source-PL/*/generated + rm -rf ./docs/source-PL/api + rm -rf build + rm -rf dist + rm -rf *.egg-info + rm -rf src/*.egg-info test: clean # Review the CONTRIBUTING documentation for other ways to test. - pip install -r requirements/devel.txt + pip install -e . -r requirements/devel.txt pip install -r requirements/strategies.txt # run tests with coverage - python -m coverage run --source pytorch_lightning -m pytest pytorch_lightning tests -v - python -m coverage report + cd src && python -m pytest pytorch_lightning + cd test && python -m coverage run --source pytorch_lightning -m pytest unittests_pl -v + cd test && python -m coverage report docs: clean pip install -e . --quiet -r requirements/docs.txt diff --git a/setup.py b/setup.py index ac5628f81f229..695626bb3843a 100755 --- a/setup.py +++ b/setup.py @@ -72,13 +72,13 @@ def _load_readme_description(path_dir: str, homepage: str, version: str) -> str: text = open(path_readme, encoding="utf-8").read() # drop images from readme - text = text.replace("![PT to PL](docs/source/_static/images/general/pl_quick_start_full_compressed.gif)", "") + text = text.replace("![PT to PL](docs/source-PL/_static/images/general/pl_quick_start_full_compressed.gif)", "") - # https://github.com/PyTorchLightning/pytorch-lightning/raw/master/docs/source/_static/images/lightning_module/pt_to_pl.png + # https://github.com/PyTorchLightning/pytorch-lightning/raw/master/docs/source-PL/_static/images/lightning_module/pt_to_pl.png github_source_url = os.path.join(homepage, "raw", version) # replace relative repository path to absolute link to the release # do not replace all "docs" as in the readme we reger some other sources with particular path to docs - text = text.replace("docs/source/_static/", f"{os.path.join(github_source_url, 'docs/source-PL/_static/')}") + text = text.replace("docs/source-PL/_static/", f"{os.path.join(github_source_url, 'docs/source-PL/_static/')}") # readthedocs badge text = text.replace("badge/?version=stable", f"badge/?version={version}") diff --git a/test/README.md b/test/README.md index 606bc799db94f..4cc2814f51435 100644 --- a/test/README.md +++ b/test/README.md @@ -1,6 +1,6 @@ # PyTorch-Lightning Tests -Most of the tests in PyTorch Lightning train a [BoringModel](https://github.com/PyTorchLightning/pytorch-lightning/blob/master/tests/helpers/boring_model.py) under various trainer conditions (ddp, ddp2+amp, etc...). Want to add a new test case and not sure how? [Talk to us!](https://www.pytorchlightning.ai/community) +Most of the tests in PyTorch Lightning train a [BoringModel](https://github.com/PyTorchLightning/pytorch-lightning/blob/master/test/unittests_pl/helpers/boring_model.py) under various trainer conditions (ddp, ddp2+amp, etc...). Want to add a new test case and not sure how? [Talk to us!](https://www.pytorchlightning.ai/community) ## Running tests @@ -47,7 +47,7 @@ python -m pytest src/pytorch_lightning test/unitests_pl -v You can also run a single test as follows: ```bash -python -m pytest -v tests/trainer/test_trainer_cli.py::test_default_args +python -m pytest -v test/unittests_pl/trainer/test_trainer_cli.py::test_default_args ``` ### Conditional Tests @@ -64,9 +64,9 @@ You can rely on our CI to make sure all these tests pass. There are certain standalone tests, which you can run using: ```bash -PL_RUN_STANDALONE_TESTS=1 python -m pytest -v tests/trainer/ +PL_RUN_STANDALONE_TESTS=1 python -m pytest -v test/unittests_pl/trainer/ # or -./tests/standalone_tests.sh tests/trainer +./test/standalone_tests.sh test/unittests_pl/trainer ``` ## Running Coverage