Model Configuration Loader
Loads and instantiates python classes from a configuration file.
Free software: MIT license
Documentation: https://cfloader.readthedocs.io.
Features
Auto class instantiation from json configuration
Read configuration from archives
Load dependencies between classes
Load configuration parameter as class or as object
Installation
pip install cfloader
Usage
Create a configuration file with parameters:
{
"model": {
"model_name": "SomeClass",
"param_1": 20
},
"epochs": 10
}
Now you can load the configuration parameters, either as primitive dicts or as a class:
import cfloader
class SomeClass:
def __init__(self, param_1):
self.param_1 = param_1
loader = cfloader.open("config.json")
num_epochs = loader.load("epochs") # = int(10)
model_param_1 = loader.load("model.param_1") # = int(20)
model_configuration = loader.load("model") # = {"model_name": "SomeClass", "param_1": 20}
model_class = loader.load("model", as_class=True) # = <SomeClass object (param_1 = 20)>
For a more extensive example, see examples/pytorch/example_pytorch.py.
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.1.0 (2020-10-06)
First release on PyPI.
Release files for cfloader 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cfloader-0.1.4.tar.gz | 13.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cfloader-0.1.4-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 20.6 kB
Release files / cfloader-0.1.4.tar.gz
| Download URL | cfloader-0.1.4.tar.gz |
|---|---|
| Size | 13.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a9500a64f3321fe9506306ac4558dbc3cb36f48866b1a881e2236f70571372f6
|
|
BLAKE2b-256 checksum How to use checksums |
02484bf8e8019bbeacce3eed0ac94de15d808b734477b7e2ca8bb3f8acf920cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.7.1
|
Release files / cfloader-0.1.4-py2.py3-none-any.whl
| Download URL | cfloader-0.1.4-py2.py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
30fce02382b43e7895b9efbc1717c677d44368504dd247b01e6e491dc23a6d31
|
|
BLAKE2b-256 checksum How to use checksums |
a5c5bcb02646efce78f2d154faa61182d614d08e22785cc1fc13c2c0d3986f65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.7.1
|