Skip to content

Commit

Permalink
mlconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
narumiruna committed Oct 20, 2023
1 parent 6a9d11d commit 448b060
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 113 deletions.
30 changes: 14 additions & 16 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ python = "^3.9"
torch = "^2.1.0"
torchvision = "^0.16.0"
torchmetrics = "^0.10.1"
omegaconf = "^2.2.3"
mlflow = "^2.6.0"
tqdm = "^4.64.1"
loguru = "^0.6.0"
mlconfig = "^0.2.0"

[tool.poetry.group.dev.dependencies]
black = "^23.7.0"
codecov = "^2.1.13"
coverage = "^7.3.2"
flake8 = "^6.0.0"
isort = "^5.12.0"
pytest = "^7.3.1"
Expand Down
7 changes: 3 additions & 4 deletions template/cli.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import click

from .utils import instantiate
from .utils import load_config
from mlconfig import instantiate
from mlconfig import load


@click.command()
@click.option("-c", "--config-file", type=click.STRING, default="configs/mnist.yaml")
@click.option("-r", "--resume", type=click.STRING, default=None)
def main(config_file, resume):
config = load_config(config_file)
config = load(config_file)

job = instantiate(config.job)
job.run(config, resume)
3 changes: 1 addition & 2 deletions template/datasets/mnist.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from mlconfig import register
from torch.utils import data
from torchvision import datasets
from torchvision import transforms

from ..utils import register


@register
class MNISTDataLoader(data.DataLoader):
Expand Down
4 changes: 2 additions & 2 deletions template/jobs/mnist.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import mlflow
import torch
from mlconfig import instantiate
from mlconfig import register
from omegaconf import OmegaConf

from ..utils import instantiate
from ..utils import manual_seed
from ..utils import register
from .job import Job


Expand Down
3 changes: 1 addition & 2 deletions template/models/lenet.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from mlconfig import register
from torch import nn

from ..utils import register


class ConvBNReLU(nn.Sequential):
def __init__(self, in_channels, out_channels, kernel_size):
Expand Down
3 changes: 1 addition & 2 deletions template/optim.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from mlconfig import register
from torch import optim

from .utils import register

register(optim.Adam)

register(optim.lr_scheduler.StepLR)
2 changes: 1 addition & 1 deletion template/trainers/mnist.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import mlflow
import torch
import torch.nn.functional as F
from mlconfig import register
from torchmetrics import Accuracy
from torchmetrics import MeanMetric
from tqdm import tqdm
from tqdm import trange

from ..utils import register
from .trainer import Trainer


Expand Down
3 changes: 0 additions & 3 deletions template/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from .conf import instantiate
from .conf import load_config
from .conf import register
from .utils import load_json
from .utils import load_yaml
from .utils import manual_seed
Expand Down
79 changes: 0 additions & 79 deletions template/utils/conf.py

This file was deleted.

0 comments on commit 448b060

Please sign in to comment.