Metadata-Version: 2.1
Name: yaml_models
Version: 0.1.0
Summary: Generate torch models from yaml config files.
Home-page: https://github.com/tomrtk/yaml-models
Author: Tom-R. T. Kvalvaag
License: MIT
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Provides-Extra: dev
Provides-Extra: testing
License-File: LICENSE

# 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:

```yaml
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

```consol
pip install yaml-models
```

```pycon
>>> 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()
  )
)
```


