From ac75396300d15f8f81f52dd18a8aadf42be2f512 Mon Sep 17 00:00:00 2001 From: John lee Date: Fri, 22 Mar 2024 16:41:47 +0000 Subject: [PATCH] Update references to handlers (#3214) * remove contrib from handlers imports * autopep8 fix --------- Co-authored-by: leej3 Co-authored-by: vfdev --- assets/tldr/teaser.ipynb | 2 +- assets/tldr/teaser.py | 2 +- examples/cifar10/main.py | 5 ++--- examples/cifar100_amp_benchmark/benchmark_fp32.py | 4 ++-- examples/cifar100_amp_benchmark/benchmark_nvidia_apex.py | 4 ++-- .../cifar100_amp_benchmark/benchmark_torch_cuda_amp.py | 4 ++-- examples/cifar10_qat/main.py | 5 ++--- examples/gan/dcgan.py | 4 ++-- examples/mnist/mnist_with_clearml_logger.py | 7 ++++--- examples/mnist/mnist_with_neptune_logger.py | 7 ++++--- examples/mnist/mnist_with_tensorboard_logger.py | 7 ++++--- examples/mnist/mnist_with_tqdm_logger.py | 3 ++- examples/mnist/mnist_with_visdom_logger.py | 7 ++++--- examples/mnist/mnist_with_wandb_logger.py | 3 ++- examples/notebooks/Cifar10_Ax_hyperparam_tuning.ipynb | 6 +++--- examples/notebooks/CycleGAN_with_nvidia_apex.ipynb | 8 ++++---- examples/notebooks/CycleGAN_with_torch_cuda_amp.ipynb | 8 ++++---- examples/notebooks/EfficientNet_Cifar100_finetuning.ipynb | 6 +++--- examples/notebooks/FastaiLRFinder_MNIST.ipynb | 2 +- examples/notebooks/HandlersTimeProfiler_MNIST.ipynb | 2 +- examples/notebooks/MNIST_on_TPU.ipynb | 2 +- examples/notebooks/TextCNN.ipynb | 2 +- examples/references/classification/imagenet/utils.py | 2 +- examples/references/segmentation/pascal_voc2012/utils.py | 2 +- examples/siamese_network/siamese_network.py | 3 ++- examples/super_resolution/main.py | 5 ++--- examples/transformers/main.py | 3 +-- examples/transformers/utils.py | 2 +- tests/ignite/contrib/engines/test_common.py | 3 ++- 29 files changed, 62 insertions(+), 58 deletions(-) diff --git a/assets/tldr/teaser.ipynb b/assets/tldr/teaser.ipynb index a4ac1bfed6d..28aabe21569 100644 --- a/assets/tldr/teaser.ipynb +++ b/assets/tldr/teaser.ipynb @@ -71,7 +71,7 @@ "\n", "import ignite.distributed as idist\n", "from ignite.contrib.engines import common\n", - "from ignite.contrib.handlers import ProgressBar\n", + "from ignite.handlers import ProgressBar\n", "from ignite.engine import Engine, Events, create_supervised_evaluator\n", "from ignite.metrics import Accuracy\n", "\n", diff --git a/assets/tldr/teaser.py b/assets/tldr/teaser.py index 671f22c81af..e86e521a7f1 100644 --- a/assets/tldr/teaser.py +++ b/assets/tldr/teaser.py @@ -10,7 +10,7 @@ import ignite.distributed as idist from ignite.contrib.engines import common -from ignite.contrib.handlers import ProgressBar +from ignite.handlers import ProgressBar from ignite.engine import Engine, Events, create_supervised_evaluator from ignite.metrics import Accuracy diff --git a/examples/cifar10/main.py b/examples/cifar10/main.py index 5696f37aa7c..b64b81c1d03 100644 --- a/examples/cifar10/main.py +++ b/examples/cifar10/main.py @@ -12,9 +12,8 @@ import ignite import ignite.distributed as idist from ignite.contrib.engines import common -from ignite.contrib.handlers import PiecewiseLinear from ignite.engine import Engine, Events -from ignite.handlers import Checkpoint, DiskSaver, global_step_from_engine +from ignite.handlers import Checkpoint, DiskSaver, global_step_from_engine, PiecewiseLinear from ignite.metrics import Accuracy, Loss from ignite.utils import manual_seed, setup_logger @@ -370,7 +369,7 @@ def evaluate_step(engine: Engine, batch): def get_save_handler(config): if config["with_clearml"]: - from ignite.contrib.handlers.clearml_logger import ClearMLSaver + from ignite.handlers.clearml_logger import ClearMLSaver return ClearMLSaver(dirname=config["output_path"]) diff --git a/examples/cifar100_amp_benchmark/benchmark_fp32.py b/examples/cifar100_amp_benchmark/benchmark_fp32.py index 8958d594db9..4030c387517 100644 --- a/examples/cifar100_amp_benchmark/benchmark_fp32.py +++ b/examples/cifar100_amp_benchmark/benchmark_fp32.py @@ -5,9 +5,9 @@ from torchvision.models import wide_resnet50_2 from utils import get_train_eval_loaders -from ignite.contrib.handlers import ProgressBar from ignite.engine import convert_tensor, create_supervised_evaluator, Engine, Events -from ignite.handlers import Timer + +from ignite.handlers import ProgressBar, Timer from ignite.metrics import Accuracy, Loss diff --git a/examples/cifar100_amp_benchmark/benchmark_nvidia_apex.py b/examples/cifar100_amp_benchmark/benchmark_nvidia_apex.py index 10953e62306..256ccb1c5e3 100644 --- a/examples/cifar100_amp_benchmark/benchmark_nvidia_apex.py +++ b/examples/cifar100_amp_benchmark/benchmark_nvidia_apex.py @@ -6,9 +6,9 @@ from torchvision.models import wide_resnet50_2 from utils import get_train_eval_loaders -from ignite.contrib.handlers import ProgressBar from ignite.engine import convert_tensor, create_supervised_evaluator, Engine, Events -from ignite.handlers import Timer + +from ignite.handlers import ProgressBar, Timer from ignite.metrics import Accuracy, Loss diff --git a/examples/cifar100_amp_benchmark/benchmark_torch_cuda_amp.py b/examples/cifar100_amp_benchmark/benchmark_torch_cuda_amp.py index dfe82255283..992f305bf24 100644 --- a/examples/cifar100_amp_benchmark/benchmark_torch_cuda_amp.py +++ b/examples/cifar100_amp_benchmark/benchmark_torch_cuda_amp.py @@ -6,9 +6,9 @@ from torchvision.models import wide_resnet50_2 from utils import get_train_eval_loaders -from ignite.contrib.handlers import ProgressBar from ignite.engine import convert_tensor, create_supervised_evaluator, Engine, Events -from ignite.handlers import Timer + +from ignite.handlers import ProgressBar, Timer from ignite.metrics import Accuracy, Loss diff --git a/examples/cifar10_qat/main.py b/examples/cifar10_qat/main.py index f7056796952..f965ce1e6e4 100644 --- a/examples/cifar10_qat/main.py +++ b/examples/cifar10_qat/main.py @@ -11,9 +11,8 @@ import ignite import ignite.distributed as idist from ignite.contrib.engines import common -from ignite.contrib.handlers import PiecewiseLinear from ignite.engine import create_supervised_evaluator, Engine, Events -from ignite.handlers import Checkpoint, DiskSaver, global_step_from_engine +from ignite.handlers import Checkpoint, DiskSaver, global_step_from_engine, PiecewiseLinear from ignite.metrics import Accuracy, Loss from ignite.utils import manual_seed, setup_logger @@ -330,7 +329,7 @@ def train_step(engine, batch): def get_save_handler(config): if config["with_clearml"]: - from ignite.contrib.handlers.clearml_logger import ClearMLSaver + from ignite.handlers.clearml_logger import ClearMLSaver return ClearMLSaver(dirname=config["output_path"]) diff --git a/examples/gan/dcgan.py b/examples/gan/dcgan.py index 4547fba3f71..1d093402d36 100644 --- a/examples/gan/dcgan.py +++ b/examples/gan/dcgan.py @@ -9,9 +9,9 @@ import torch.optim as optim import torch.utils.data as data -from ignite.contrib.handlers import ProgressBar from ignite.engine import Engine, Events -from ignite.handlers import ModelCheckpoint, Timer + +from ignite.handlers import ModelCheckpoint, ProgressBar, Timer from ignite.metrics import RunningAverage try: diff --git a/examples/mnist/mnist_with_clearml_logger.py b/examples/mnist/mnist_with_clearml_logger.py index dd955361c6f..2073df7cafa 100644 --- a/examples/mnist/mnist_with_clearml_logger.py +++ b/examples/mnist/mnist_with_clearml_logger.py @@ -22,7 +22,10 @@ from torchvision.datasets import MNIST from torchvision.transforms import Compose, Normalize, ToTensor -from ignite.contrib.handlers.clearml_logger import ( +from ignite.engine import create_supervised_evaluator, create_supervised_trainer, Events +from ignite.handlers import Checkpoint + +from ignite.handlers.clearml_logger import ( ClearMLLogger, ClearMLSaver, global_step_from_engine, @@ -31,8 +34,6 @@ WeightsHistHandler, WeightsScalarHandler, ) -from ignite.engine import create_supervised_evaluator, create_supervised_trainer, Events -from ignite.handlers import Checkpoint from ignite.metrics import Accuracy, Loss from ignite.utils import setup_logger diff --git a/examples/mnist/mnist_with_neptune_logger.py b/examples/mnist/mnist_with_neptune_logger.py index 645d101cea0..2f2340b87b1 100644 --- a/examples/mnist/mnist_with_neptune_logger.py +++ b/examples/mnist/mnist_with_neptune_logger.py @@ -28,15 +28,16 @@ from torchvision.datasets import MNIST from torchvision.transforms import Compose, Normalize, ToTensor -from ignite.contrib.handlers.neptune_logger import ( +from ignite.engine import create_supervised_evaluator, create_supervised_trainer, Events +from ignite.handlers import Checkpoint + +from ignite.handlers.neptune_logger import ( global_step_from_engine, GradsScalarHandler, NeptuneLogger, NeptuneSaver, WeightsScalarHandler, ) -from ignite.engine import create_supervised_evaluator, create_supervised_trainer, Events -from ignite.handlers import Checkpoint from ignite.metrics import Accuracy, Loss from ignite.utils import setup_logger diff --git a/examples/mnist/mnist_with_tensorboard_logger.py b/examples/mnist/mnist_with_tensorboard_logger.py index 303cd281941..eaea1a532c9 100644 --- a/examples/mnist/mnist_with_tensorboard_logger.py +++ b/examples/mnist/mnist_with_tensorboard_logger.py @@ -29,7 +29,10 @@ from torchvision.datasets import MNIST from torchvision.transforms import Compose, Normalize, ToTensor -from ignite.contrib.handlers.tensorboard_logger import ( +from ignite.engine import create_supervised_evaluator, create_supervised_trainer, Events +from ignite.handlers import ModelCheckpoint + +from ignite.handlers.tensorboard_logger import ( global_step_from_engine, GradsHistHandler, GradsScalarHandler, @@ -37,8 +40,6 @@ WeightsHistHandler, WeightsScalarHandler, ) -from ignite.engine import create_supervised_evaluator, create_supervised_trainer, Events -from ignite.handlers import ModelCheckpoint from ignite.metrics import Accuracy, Loss from ignite.utils import setup_logger diff --git a/examples/mnist/mnist_with_tqdm_logger.py b/examples/mnist/mnist_with_tqdm_logger.py index 07592b6a29b..980d7029f9f 100644 --- a/examples/mnist/mnist_with_tqdm_logger.py +++ b/examples/mnist/mnist_with_tqdm_logger.py @@ -8,8 +8,9 @@ from torchvision.datasets import MNIST from torchvision.transforms import Compose, Normalize, ToTensor -from ignite.contrib.handlers import ProgressBar from ignite.engine import create_supervised_evaluator, create_supervised_trainer, Events + +from ignite.handlers import ProgressBar from ignite.metrics import Accuracy, Loss, RunningAverage diff --git a/examples/mnist/mnist_with_visdom_logger.py b/examples/mnist/mnist_with_visdom_logger.py index 84a90a4ec98..322c757c1f7 100644 --- a/examples/mnist/mnist_with_visdom_logger.py +++ b/examples/mnist/mnist_with_visdom_logger.py @@ -28,14 +28,15 @@ from torchvision.datasets import MNIST from torchvision.transforms import Compose, Normalize, ToTensor -from ignite.contrib.handlers.visdom_logger import ( +from ignite.engine import create_supervised_evaluator, create_supervised_trainer, Events +from ignite.handlers import ModelCheckpoint + +from ignite.handlers.visdom_logger import ( global_step_from_engine, GradsScalarHandler, VisdomLogger, WeightsScalarHandler, ) -from ignite.engine import create_supervised_evaluator, create_supervised_trainer, Events -from ignite.handlers import ModelCheckpoint from ignite.metrics import Accuracy, Loss from ignite.utils import setup_logger diff --git a/examples/mnist/mnist_with_wandb_logger.py b/examples/mnist/mnist_with_wandb_logger.py index d99e4382002..7fc236295e0 100644 --- a/examples/mnist/mnist_with_wandb_logger.py +++ b/examples/mnist/mnist_with_wandb_logger.py @@ -26,9 +26,10 @@ from torchvision.datasets import MNIST from torchvision.transforms import Compose, Normalize, ToTensor -from ignite.contrib.handlers.wandb_logger import global_step_from_engine, WandBLogger from ignite.engine import create_supervised_evaluator, create_supervised_trainer, Events from ignite.handlers import ModelCheckpoint + +from ignite.handlers.wandb_logger import global_step_from_engine, WandBLogger from ignite.metrics import Accuracy, Loss from ignite.utils import setup_logger diff --git a/examples/notebooks/Cifar10_Ax_hyperparam_tuning.ipynb b/examples/notebooks/Cifar10_Ax_hyperparam_tuning.ipynb index d65ddb7d878..31af93823b3 100644 --- a/examples/notebooks/Cifar10_Ax_hyperparam_tuning.ipynb +++ b/examples/notebooks/Cifar10_Ax_hyperparam_tuning.ipynb @@ -492,7 +492,7 @@ "id": "YexZcC92faqi" }, "source": [ - "from ignite.contrib.handlers import PiecewiseLinear, ParamGroupScheduler" + "from ignite.handlers import PiecewiseLinear, ParamGroupScheduler" ], "execution_count": null, "outputs": [] @@ -621,8 +621,8 @@ "source": [ "from ignite.engine import create_supervised_trainer, create_supervised_evaluator, Events, convert_tensor\n", "from ignite.metrics import Accuracy\n", - "from ignite.contrib.handlers import TensorboardLogger, ProgressBar\n", - "from ignite.contrib.handlers.tensorboard_logger import OutputHandler, OptimizerParamsHandler, GradsHistHandler, \\\n", + "from ignite.handlers import TensorboardLogger, ProgressBar\n", + "from ignite.handlers.tensorboard_logger import OutputHandler, OptimizerParamsHandler, GradsHistHandler, \\\n", " global_step_from_engine" ], "execution_count": null, diff --git a/examples/notebooks/CycleGAN_with_nvidia_apex.ipynb b/examples/notebooks/CycleGAN_with_nvidia_apex.ipynb index 595d42c5409..3e91899e72f 100644 --- a/examples/notebooks/CycleGAN_with_nvidia_apex.ipynb +++ b/examples/notebooks/CycleGAN_with_nvidia_apex.ipynb @@ -1105,8 +1105,8 @@ "from ignite.engine import Engine, Events\n", "from ignite.metrics import RunningAverage\n", "\n", - "from ignite.contrib.handlers import TensorboardLogger, WandBLogger\n", - "from ignite.contrib.handlers.tensorboard_logger import OutputHandler, OptimizerParamsHandler" + "from ignite.handlers import TensorboardLogger, WandBLogger\n", + "from ignite.handlers.tensorboard_logger import OutputHandler, OptimizerParamsHandler" ], "execution_count": null, "outputs": [] @@ -1324,7 +1324,7 @@ "id": "iUm5u9RdzlII" }, "source": [ - "from ignite.contrib.handlers import PiecewiseLinear, ParamGroupScheduler\n", + "from ignite.handlers import PiecewiseLinear, ParamGroupScheduler\n", "\n", "lr = 0.0002\n", "\n", @@ -1405,7 +1405,7 @@ "id": "HmY0vbZ3zlIQ" }, "source": [ - "from ignite.contrib.handlers import ProgressBar\n", + "from ignite.handlers import ProgressBar\n", "\n", "# Iteration-wise progress bar\n", "ProgressBar(bar_format=\"\").attach(trainer)\n", diff --git a/examples/notebooks/CycleGAN_with_torch_cuda_amp.ipynb b/examples/notebooks/CycleGAN_with_torch_cuda_amp.ipynb index 9dca64f5d4f..614c8528b8d 100644 --- a/examples/notebooks/CycleGAN_with_torch_cuda_amp.ipynb +++ b/examples/notebooks/CycleGAN_with_torch_cuda_amp.ipynb @@ -1068,8 +1068,8 @@ "from ignite.engine import Engine, Events\n", "from ignite.metrics import RunningAverage\n", "\n", - "from ignite.contrib.handlers import TensorboardLogger, WandBLogger\n", - "from ignite.contrib.handlers.tensorboard_logger import OutputHandler, OptimizerParamsHandler" + "from ignite.handlers import TensorboardLogger, WandBLogger\n", + "from ignite.handlers.tensorboard_logger import OutputHandler, OptimizerParamsHandler" ], "execution_count": null, "outputs": [] @@ -1286,7 +1286,7 @@ "id": "SSIcXzReFRcc" }, "source": [ - "from ignite.contrib.handlers import PiecewiseLinear, ParamGroupScheduler\n", + "from ignite.handlers import PiecewiseLinear, ParamGroupScheduler\n", "\n", "lr = 0.0002\n", "\n", @@ -1367,7 +1367,7 @@ "id": "RtQKr6yxFRck" }, "source": [ - "from ignite.contrib.handlers import ProgressBar\n", + "from ignite.handlers import ProgressBar\n", "\n", "# Iteration-wise progress bar\n", "ProgressBar(bar_format=\"\").attach(trainer)\n", diff --git a/examples/notebooks/EfficientNet_Cifar100_finetuning.ipynb b/examples/notebooks/EfficientNet_Cifar100_finetuning.ipynb index 0e47eccbcc3..5c6e09d9ca8 100644 --- a/examples/notebooks/EfficientNet_Cifar100_finetuning.ipynb +++ b/examples/notebooks/EfficientNet_Cifar100_finetuning.ipynb @@ -1159,8 +1159,8 @@ "from ignite.engine import Engine, Events, create_supervised_evaluator\n", "from ignite.metrics import RunningAverage, Accuracy, Precision, Recall, Loss, TopKCategoricalAccuracy\n", "\n", - "from ignite.contrib.handlers import TensorboardLogger\n", - "from ignite.contrib.handlers.tensorboard_logger import OutputHandler, OptimizerParamsHandler" + "from ignite.handlers import TensorboardLogger\n", + "from ignite.handlers.tensorboard_logger import OutputHandler, OptimizerParamsHandler" ], "execution_count": null, "outputs": [] @@ -1236,7 +1236,7 @@ "id": "Bp_hy7Y0sXqE" }, "source": [ - "from ignite.contrib.handlers import ProgressBar\n", + "from ignite.handlers import ProgressBar\n", "\n", "# Iteration-wise progress bar\n", "# ProgressBar(bar_format=\"\").attach(trainer, metric_names=['batchloss',])\n", diff --git a/examples/notebooks/FastaiLRFinder_MNIST.ipynb b/examples/notebooks/FastaiLRFinder_MNIST.ipynb index 7ed98df95d7..8b705a11fd4 100644 --- a/examples/notebooks/FastaiLRFinder_MNIST.ipynb +++ b/examples/notebooks/FastaiLRFinder_MNIST.ipynb @@ -79,7 +79,7 @@ "source": [ "from ignite.engine import create_supervised_trainer, create_supervised_evaluator\n", "from ignite.metrics import Loss, Accuracy\n", - "from ignite.contrib.handlers import ProgressBar\n", + "from ignite.handlers import ProgressBar\n", "from ignite.handlers import FastaiLRFinder" ] }, diff --git a/examples/notebooks/HandlersTimeProfiler_MNIST.ipynb b/examples/notebooks/HandlersTimeProfiler_MNIST.ipynb index 46019f300d6..4b3ca9eecab 100644 --- a/examples/notebooks/HandlersTimeProfiler_MNIST.ipynb +++ b/examples/notebooks/HandlersTimeProfiler_MNIST.ipynb @@ -104,7 +104,7 @@ "source": [ "from ignite.engine import Events, create_supervised_trainer, create_supervised_evaluator\n", "from ignite.metrics import Loss, Accuracy\n", - "from ignite.contrib.handlers import ProgressBar, HandlersTimeProfiler" + "from ignite.handlers import ProgressBar, HandlersTimeProfiler" ], "execution_count": null, "outputs": [] diff --git a/examples/notebooks/MNIST_on_TPU.ipynb b/examples/notebooks/MNIST_on_TPU.ipynb index 4e3ff33bb0a..19a1be78494 100644 --- a/examples/notebooks/MNIST_on_TPU.ipynb +++ b/examples/notebooks/MNIST_on_TPU.ipynb @@ -159,7 +159,7 @@ "# Import PyTorch-Ignite\n", "from ignite.engine import Events, create_supervised_trainer, create_supervised_evaluator\n", "from ignite.metrics import Accuracy, Loss, RunningAverage\n", - "from ignite.contrib.handlers import ProgressBar" + "from ignite.handlers import ProgressBar" ], "execution_count": null, "outputs": [] diff --git a/examples/notebooks/TextCNN.ipynb b/examples/notebooks/TextCNN.ipynb index 82fef682f7d..05b0d662b43 100644 --- a/examples/notebooks/TextCNN.ipynb +++ b/examples/notebooks/TextCNN.ipynb @@ -156,7 +156,7 @@ "from ignite.engine import Engine, Events\n", "from ignite.metrics import Accuracy, Loss, RunningAverage\n", "from ignite.handlers import ModelCheckpoint, EarlyStopping\n", - "from ignite.contrib.handlers import ProgressBar\n", + "from ignite.handlers import ProgressBar\n", "from ignite.utils import manual_seed\n", "\n", "SEED = 1234\n", diff --git a/examples/references/classification/imagenet/utils.py b/examples/references/classification/imagenet/utils.py index 45be888d0de..be6d04293f8 100644 --- a/examples/references/classification/imagenet/utils.py +++ b/examples/references/classification/imagenet/utils.py @@ -51,7 +51,7 @@ def log_metrics(logger, epoch, elapsed, tag, metrics): def get_save_handler(output_path, with_clearml): if with_clearml: - from ignite.contrib.handlers.clearml_logger import ClearMLSaver + from ignite.handlers.clearml_logger import ClearMLSaver return ClearMLSaver(dirname=output_path) diff --git a/examples/references/segmentation/pascal_voc2012/utils.py b/examples/references/segmentation/pascal_voc2012/utils.py index 45be888d0de..be6d04293f8 100644 --- a/examples/references/segmentation/pascal_voc2012/utils.py +++ b/examples/references/segmentation/pascal_voc2012/utils.py @@ -51,7 +51,7 @@ def log_metrics(logger, epoch, elapsed, tag, metrics): def get_save_handler(output_path, with_clearml): if with_clearml: - from ignite.contrib.handlers.clearml_logger import ClearMLSaver + from ignite.handlers.clearml_logger import ClearMLSaver return ClearMLSaver(dirname=output_path) diff --git a/examples/siamese_network/siamese_network.py b/examples/siamese_network/siamese_network.py index bf4be27629a..cb228c868bc 100644 --- a/examples/siamese_network/siamese_network.py +++ b/examples/siamese_network/siamese_network.py @@ -9,8 +9,9 @@ from torch.utils.data import DataLoader, Dataset from torchvision import datasets -from ignite.contrib.handlers import ProgressBar from ignite.engine import Engine, Events + +from ignite.handlers import ProgressBar from ignite.handlers.param_scheduler import LRScheduler from ignite.metrics import Accuracy, RunningAverage from ignite.utils import manual_seed diff --git a/examples/super_resolution/main.py b/examples/super_resolution/main.py index 08199a22e74..7ff66778005 100644 --- a/examples/super_resolution/main.py +++ b/examples/super_resolution/main.py @@ -8,10 +8,9 @@ from torch.utils.data import DataLoader from torchvision.transforms.functional import center_crop, resize, to_tensor -from ignite.contrib.handlers import ProgressBar - from ignite.engine import Engine, Events -from ignite.handlers import BasicTimeProfiler + +from ignite.handlers import BasicTimeProfiler, ProgressBar from ignite.metrics import PSNR # Training settings diff --git a/examples/transformers/main.py b/examples/transformers/main.py index c879812b98d..cd1a84d2195 100644 --- a/examples/transformers/main.py +++ b/examples/transformers/main.py @@ -12,9 +12,8 @@ import ignite import ignite.distributed as idist from ignite.contrib.engines import common -from ignite.contrib.handlers import PiecewiseLinear from ignite.engine import Engine, Events -from ignite.handlers import Checkpoint, global_step_from_engine +from ignite.handlers import Checkpoint, global_step_from_engine, PiecewiseLinear from ignite.metrics import Accuracy, Loss from ignite.utils import manual_seed, setup_logger diff --git a/examples/transformers/utils.py b/examples/transformers/utils.py index 8f49066335b..af2bf5e8319 100644 --- a/examples/transformers/utils.py +++ b/examples/transformers/utils.py @@ -34,7 +34,7 @@ def thresholded_output_transform(output): def get_save_handler(config): if config["with_clearml"]: - from ignite.contrib.handlers.clearml_logger import ClearMLSaver + from ignite.handlers.clearml_logger import ClearMLSaver return ClearMLSaver(dirname=config["output_dir"]) diff --git a/tests/ignite/contrib/engines/test_common.py b/tests/ignite/contrib/engines/test_common.py index 97389523004..d0100be9e8d 100644 --- a/tests/ignite/contrib/engines/test_common.py +++ b/tests/ignite/contrib/engines/test_common.py @@ -7,8 +7,9 @@ import torch.nn as nn from torch.utils.data.distributed import DistributedSampler -import ignite.contrib.handlers as handlers import ignite.distributed as idist + +import ignite.handlers as handlers from ignite.contrib.engines.common import ( _setup_logging, add_early_stopping_by_val_score,