rosikand / torchplate

🍽 A minimal and simple experiment module for machine learning research workflows in PyTorch.
https://rosikand.github.io/torchplate/
MIT License
3 stars 0 forks source link

Add support and helpers for working with YAML and YACS configuration files #6

Open rosikand opened 2 years ago

rosikand commented 2 years ago

Note: I think it makes more sense to define configs programmatically via Python classes.

"""
File: configs.py
------------------
This file holds experiment configuration classes. 
You can define as many hyperparameters as you need
and then programatically use them in experiments. 
The idea is to define one base class which sets
the default hyperparameters and then create child
classes of this class for each new experiment,
overriding the changed parameters for that experiment. 
"""

import models

class BaseConfig:
    model = models.CifarMLP()  # unlike raw yaml, you can specify modules programatically 
    epochs = 10
    num_layers = 9
    lr = 0.001

class TestNewLR(BaseConfig):
    """Testing larger learning rate"""
    lr = 0.1
    decay = 0.111

config = TestNewLR()

# in a different file, do 'from configs import *' or 'import configs'