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
License-File: LICENSE
Requires-Dist: numpy (>=1.21.5)
Requires-Dist: pyyaml (>=6.0)
Requires-Dist: torch (>=1.10.0)
Provides-Extra: dev
Requires-Dist: autopep8 ; extra == 'dev'
Requires-Dist: build ; extra == 'dev'
Requires-Dist: flake8 ; extra == 'dev'
Requires-Dist: isort ; extra == 'dev'
Requires-Dist: mypy (>=0.902) ; extra == 'dev'
Requires-Dist: pre-commit ; extra == 'dev'
Requires-Dist: pyupgrade ; extra == 'dev'
Requires-Dist: tox ; extra == 'dev'
Requires-Dist: twine ; extra == 'dev'
Requires-Dist: types-all ; extra == 'dev'
Provides-Extra: testing
Requires-Dist: covdefaults ; extra == 'testing'
Requires-Dist: coverage ; extra == 'testing'
Requires-Dist: pytest (>=4.0.0) ; extra == 'testing'

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


