From 92f8c57ff570aed20fa46d03c437630a572d5c6f Mon Sep 17 00:00:00 2001 From: Jiri BOROVEC Date: Mon, 5 Aug 2019 09:51:47 +0200 Subject: [PATCH] cutout examples --- .../examples => examples}/__init__.py | 0 .../new_project_templates/__init__.py | 0 .../lightning_module_template.py | 0 .../multi_node_cluster_template.py | 0 .../single_cpu_template.py | 0 .../single_gpu_node_16bit_template.py | 0 .../single_gpu_node_ddp_template.py | 0 .../single_gpu_node_dp_template.py | 0 .../trainer_cpu_template.py | 2 +- pytorch_lightning/models/trainer.py | 2 +- .../{testing_models => testing}/__init__.py | 0 .../lm_test_module.py | 0 .../{utils => utilities}/__init__.py | 0 .../{utils => utilities}/arg_parse.py | 0 .../{utils => utilities}/debugging.py | 0 tests/debug.py | 7 +------ tests/test_models.py | 20 +++++++++---------- 17 files changed, 12 insertions(+), 19 deletions(-) rename {pytorch_lightning/examples => examples}/__init__.py (100%) rename {pytorch_lightning/examples => examples}/new_project_templates/__init__.py (100%) rename {pytorch_lightning/examples => examples}/new_project_templates/lightning_module_template.py (100%) rename {pytorch_lightning/examples => examples}/new_project_templates/multi_node_cluster_template.py (100%) rename {pytorch_lightning/examples => examples}/new_project_templates/single_cpu_template.py (100%) rename {pytorch_lightning/examples => examples}/new_project_templates/single_gpu_node_16bit_template.py (100%) rename {pytorch_lightning/examples => examples}/new_project_templates/single_gpu_node_ddp_template.py (100%) rename {pytorch_lightning/examples => examples}/new_project_templates/single_gpu_node_dp_template.py (100%) rename {pytorch_lightning/examples => examples}/new_project_templates/trainer_cpu_template.py (96%) rename pytorch_lightning/{testing_models => testing}/__init__.py (100%) rename pytorch_lightning/{testing_models => testing}/lm_test_module.py (100%) rename pytorch_lightning/{utils => utilities}/__init__.py (100%) rename pytorch_lightning/{utils => utilities}/arg_parse.py (100%) rename pytorch_lightning/{utils => utilities}/debugging.py (100%) diff --git a/pytorch_lightning/examples/__init__.py b/examples/__init__.py similarity index 100% rename from pytorch_lightning/examples/__init__.py rename to examples/__init__.py diff --git a/pytorch_lightning/examples/new_project_templates/__init__.py b/examples/new_project_templates/__init__.py similarity index 100% rename from pytorch_lightning/examples/new_project_templates/__init__.py rename to examples/new_project_templates/__init__.py diff --git a/pytorch_lightning/examples/new_project_templates/lightning_module_template.py b/examples/new_project_templates/lightning_module_template.py similarity index 100% rename from pytorch_lightning/examples/new_project_templates/lightning_module_template.py rename to examples/new_project_templates/lightning_module_template.py diff --git a/pytorch_lightning/examples/new_project_templates/multi_node_cluster_template.py b/examples/new_project_templates/multi_node_cluster_template.py similarity index 100% rename from pytorch_lightning/examples/new_project_templates/multi_node_cluster_template.py rename to examples/new_project_templates/multi_node_cluster_template.py diff --git a/pytorch_lightning/examples/new_project_templates/single_cpu_template.py b/examples/new_project_templates/single_cpu_template.py similarity index 100% rename from pytorch_lightning/examples/new_project_templates/single_cpu_template.py rename to examples/new_project_templates/single_cpu_template.py diff --git a/pytorch_lightning/examples/new_project_templates/single_gpu_node_16bit_template.py b/examples/new_project_templates/single_gpu_node_16bit_template.py similarity index 100% rename from pytorch_lightning/examples/new_project_templates/single_gpu_node_16bit_template.py rename to examples/new_project_templates/single_gpu_node_16bit_template.py diff --git a/pytorch_lightning/examples/new_project_templates/single_gpu_node_ddp_template.py b/examples/new_project_templates/single_gpu_node_ddp_template.py similarity index 100% rename from pytorch_lightning/examples/new_project_templates/single_gpu_node_ddp_template.py rename to examples/new_project_templates/single_gpu_node_ddp_template.py diff --git a/pytorch_lightning/examples/new_project_templates/single_gpu_node_dp_template.py b/examples/new_project_templates/single_gpu_node_dp_template.py similarity index 100% rename from pytorch_lightning/examples/new_project_templates/single_gpu_node_dp_template.py rename to examples/new_project_templates/single_gpu_node_dp_template.py diff --git a/pytorch_lightning/examples/new_project_templates/trainer_cpu_template.py b/examples/new_project_templates/trainer_cpu_template.py similarity index 96% rename from pytorch_lightning/examples/new_project_templates/trainer_cpu_template.py rename to examples/new_project_templates/trainer_cpu_template.py index c1b9496d68..97dbfba74a 100644 --- a/pytorch_lightning/examples/new_project_templates/trainer_cpu_template.py +++ b/examples/new_project_templates/trainer_cpu_template.py @@ -3,7 +3,7 @@ import sys from test_tube import HyperOptArgumentParser, Experiment from pytorch_lightning.models.trainer import Trainer -from pytorch_lightning.utils.arg_parse import add_default_args +from pytorch_lightning.utilities.arg_parse import add_default_args from pytorch_lightning.callbacks.pt_callbacks import EarlyStopping, ModelCheckpoint from lightning_module_template import LightningTemplateModel diff --git a/pytorch_lightning/models/trainer.py b/pytorch_lightning/models/trainer.py index e60a0d95cc..098526a85a 100644 --- a/pytorch_lightning/models/trainer.py +++ b/pytorch_lightning/models/trainer.py @@ -18,7 +18,7 @@ import tqdm from pytorch_lightning.root_module.memory import get_gpu_memory_map from pytorch_lightning.root_module.model_saving import TrainerIO from pytorch_lightning.pt_overrides.override_data_parallel import LightningDistributedDataParallel, LightningDataParallel -from pytorch_lightning.utils.debugging import MisconfigurationException +from pytorch_lightning.utilities.debugging import MisconfigurationException try: from apex import amp diff --git a/pytorch_lightning/testing_models/__init__.py b/pytorch_lightning/testing/__init__.py similarity index 100% rename from pytorch_lightning/testing_models/__init__.py rename to pytorch_lightning/testing/__init__.py diff --git a/pytorch_lightning/testing_models/lm_test_module.py b/pytorch_lightning/testing/lm_test_module.py similarity index 100% rename from pytorch_lightning/testing_models/lm_test_module.py rename to pytorch_lightning/testing/lm_test_module.py diff --git a/pytorch_lightning/utils/__init__.py b/pytorch_lightning/utilities/__init__.py similarity index 100% rename from pytorch_lightning/utils/__init__.py rename to pytorch_lightning/utilities/__init__.py diff --git a/pytorch_lightning/utils/arg_parse.py b/pytorch_lightning/utilities/arg_parse.py similarity index 100% rename from pytorch_lightning/utils/arg_parse.py rename to pytorch_lightning/utilities/arg_parse.py diff --git a/pytorch_lightning/utils/debugging.py b/pytorch_lightning/utilities/debugging.py similarity index 100% rename from pytorch_lightning/utils/debugging.py rename to pytorch_lightning/utilities/debugging.py diff --git a/tests/debug.py b/tests/debug.py index c4c3ffd19f..09e9186b9c 100644 --- a/tests/debug.py +++ b/tests/debug.py @@ -1,15 +1,10 @@ -import pytest from pytorch_lightning import Trainer -from pytorch_lightning.examples.new_project_templates.lightning_module_template import LightningTemplateModel +from examples import LightningTemplateModel from argparse import Namespace from test_tube import Experiment from pytorch_lightning.callbacks import ModelCheckpoint -import numpy as np -import warnings -import torch import os import shutil -import pdb import pytorch_lightning as ptl import torch diff --git a/tests/test_models.py b/tests/test_models.py index 9d40c0da93..73ba2e43c1 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -1,20 +1,20 @@ +import os +import shutil +import warnings + import pytest +import numpy as np +import torch from pytorch_lightning import Trainer -from pytorch_lightning.examples.new_project_templates.lightning_module_template import LightningTemplateModel -from pytorch_lightning.testing_models.lm_test_module import LightningTestModel +from examples import LightningTemplateModel +from pytorch_lightning.testing.lm_test_module import LightningTestModel from argparse import Namespace from test_tube import Experiment, SlurmCluster from pytorch_lightning.callbacks import ModelCheckpoint, EarlyStopping -from pytorch_lightning.utils.debugging import MisconfigurationException +from pytorch_lightning.utilities.debugging import MisconfigurationException from pytorch_lightning.root_module import memory from pytorch_lightning.models.trainer import reduce_distributed_output from pytorch_lightning.root_module import model_saving -import numpy as np -import warnings -import torch -import os -import shutil -import pdb SEED = 2334 torch.manual_seed(SEED) @@ -232,8 +232,6 @@ def test_model_saving_loading(): clear_save_dir() - - def test_model_freeze_unfreeze(): hparams = get_hparams() model = LightningTestModel(hparams)