Skip to content
This repository was archived by the owner on Aug 20, 2022. It is now read-only.

tomrtk/yaml-models

Repository files navigation

Tests pre-commit.ci status

yaml-models

Python package generating torch models from a yaml configuration file. Each type item in model list need to specify at minimum the default values needed by the torch.nn module. Arguments not specified will use the default values.

Example config:

model:
-   type: Linear
    in_features: 2
    out_features: 10
-   type: ReLU
-   type: Linear
    in_features: 10
    out_features: 1
-   type: Sigmoid

torch.nn.Linear needs the default arguments in_features and out_features.

Usage

pip install yaml-models
>>> from yaml_models.model import Model
>>> model = Model(config_path="./example_config/model.yaml")
>>> print(model)
Model(
  (layers): ModuleList(
    (0): Linear(in_features=2, out_features=10, bias=True)
    (1): ReLU()
    (2): Linear(in_features=10, out_features=1, bias=True)
    (3): Sigmoid()
  )
)

About

generate torch models from yaml config files

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages