Skip to content

fix(templates): merge handlers.py into utils.py #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion templates/gan/handlers.py

This file was deleted.

3 changes: 1 addition & 2 deletions templates/gan/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import torch
from config import get_default_parser
from datasets import get_datasets
from handlers import get_handlers, get_logger
from ignite.contrib.handlers import (
ClearMLLogger,
MLflowLogger,
Expand All @@ -28,7 +27,7 @@
from torch import nn, optim
from torch.utils.data import Dataset
from trainers import create_trainers, train_function
from utils import hash_checkpoint, log_metrics, resume_from, setup_logging
from utils import hash_checkpoint, log_metrics, resume_from, setup_logging, get_handlers, get_logger


class TestDataset(unittest.TestCase):
Expand Down
2 changes: 2 additions & 0 deletions templates/gan/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
from torch.optim.optimizer import Optimizer

from models import Generator, Discriminator
{% include "_handlers.py" %}


# we can use `idist.auto_model` to handle distributed configurations
# for your model : https://pytorch.org/ignite/distributed.html#ignite.distributed.auto.auto_model
Expand Down
1 change: 0 additions & 1 deletion templates/image_classification/handlers.py

This file was deleted.

3 changes: 1 addition & 2 deletions templates/image_classification/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import torch
from config import get_default_parser
from datasets import get_datasets
from handlers import get_handlers, get_logger
from ignite.contrib.handlers import (
ClearMLLogger,
MLflowLogger,
Expand All @@ -36,7 +35,7 @@
train_events_to_attr,
train_function,
)
from utils import hash_checkpoint, initialize, log_metrics, resume_from, setup_logging
from utils import hash_checkpoint, initialize, log_metrics, resume_from, setup_logging, get_handlers, get_logger


class TestDataset(unittest.TestCase):
Expand Down
2 changes: 2 additions & 0 deletions templates/image_classification/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
from torch.optim import Optimizer, SGD

from models import get_model
{% include "_handlers.py" %}



def initialize(config: Optional[Any]) -> Tuple[Module, Optimizer, Module, Union[_LRScheduler, ParamScheduler]]:
Expand Down
1 change: 0 additions & 1 deletion templates/single/handlers.py

This file was deleted.

3 changes: 1 addition & 2 deletions templates/single/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,14 @@
from torch import nn, optim

from config import get_default_parser
from handlers import get_handlers, get_logger
from trainers import (
TrainEvents,
create_trainers,
evaluate_function,
train_events_to_attr,
train_function,
)
from utils import hash_checkpoint, log_metrics, resume_from, setup_logging
from utils import hash_checkpoint, log_metrics, resume_from, setup_logging, get_handlers, get_logger


class TestHandlers(unittest.TestCase):
Expand Down
1 change: 1 addition & 0 deletions templates/single/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from torch.nn import Module
from torch.optim.lr_scheduler import _LRScheduler
from torch.optim.optimizer import Optimizer
{% include "_handlers.py" %}


# we can use `idist.auto_model` to handle distributed configurations
Expand Down