# nnlite
A light toolbox with utilities and wrappers for Neural Network Models
## Install
```
# for published version
pip install -U nnlite
# or developing version
pip install -U git+https://github.com/huangyh09/nnlite
```
## Quick Usage
```python
import nnlite
from functools import partial
torch.manual_seed(0)
dev = 'cuda:0' if torch.cuda.is_available() else 'cpu'
## VAE model (one hidden layer, dim=64), loss, and optimizer
model = nnlite.models.VAE_base(1838, 32, hidden_dims=[64], device=dev)
criterion = partial(nnlite.models.Loss_VAE_Gaussian, beta=1e-3)
optimizer = torch.optim.Adam(model.parameters(), lr=1e-3, weight_decay=0.95)
## NNWrapper for model training
my_wrapper = nnlite.NNWrapper(model, criterion, optimizer, device=dev)
my_wrapper.fit(train_loader, epoch=3000, validation_loader=None, verbose=False)
my_wrapper.predict(test_loader)
plt.plot(my_wrapper.train_losses)
```
## Examples
See the [examples](./examples) folder, including
* CNN-1D: [CamoTSS-CNN-demo.ipynb](./examples/CamoTSS-CNN-demo.ipynb)
* VAE for 3K PBMC: [PBMC3K_VAE.ipynb](./examples/PBMC3K_VAE.ipynb)
* and more.
Raw data
{
"_id": null,
"home_page": "https://github.com/huangyh09/nnlite",
"name": "nnlite",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "Neural Network Models, Machine Learning",
"author": "['nnlite team']",
"author_email": "yuanhua@hku.hk",
"download_url": "https://files.pythonhosted.org/packages/69/8b/31538e5acbcacb2d1b872c1b61dff71960cc9d2a8fdacf3e714cc5634a22/nnlite-0.0.3.tar.gz",
"platform": null,
"description": "# nnlite\nA light toolbox with utilities and wrappers for Neural Network Models\n\n\n## Install\n\n```\n# for published version\npip install -U nnlite\n\n# or developing version\npip install -U git+https://github.com/huangyh09/nnlite\n```\n\n## Quick Usage\n\n```python\nimport nnlite\nfrom functools import partial\n\ntorch.manual_seed(0)\ndev = 'cuda:0' if torch.cuda.is_available() else 'cpu'\n\n## VAE model (one hidden layer, dim=64), loss, and optimizer\nmodel = nnlite.models.VAE_base(1838, 32, hidden_dims=[64], device=dev)\ncriterion = partial(nnlite.models.Loss_VAE_Gaussian, beta=1e-3)\noptimizer = torch.optim.Adam(model.parameters(), lr=1e-3, weight_decay=0.95)\n\n## NNWrapper for model training\nmy_wrapper = nnlite.NNWrapper(model, criterion, optimizer, device=dev)\nmy_wrapper.fit(train_loader, epoch=3000, validation_loader=None, verbose=False)\nmy_wrapper.predict(test_loader)\n\nplt.plot(my_wrapper.train_losses)\n```\n\n\n## Examples\nSee the [examples](./examples) folder, including\n* CNN-1D: [CamoTSS-CNN-demo.ipynb](./examples/CamoTSS-CNN-demo.ipynb)\n* VAE for 3K PBMC: [PBMC3K_VAE.ipynb](./examples/PBMC3K_VAE.ipynb)\n* and more.\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Some utilities and wrappers for Neural Network Models",
"version": "0.0.3",
"project_urls": {
"Homepage": "https://github.com/huangyh09/nnlite"
},
"split_keywords": [
"neural network models",
" machine learning"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "698b31538e5acbcacb2d1b872c1b61dff71960cc9d2a8fdacf3e714cc5634a22",
"md5": "05fdeed94b77a0f99fdc3a2952ffe774",
"sha256": "244b62f8af79c280c0526934ae018706de46ad00fcf3fee87bb28a320ababe85"
},
"downloads": -1,
"filename": "nnlite-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "05fdeed94b77a0f99fdc3a2952ffe774",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 2010896,
"upload_time": "2024-12-15T15:14:22",
"upload_time_iso_8601": "2024-12-15T15:14:22.737976Z",
"url": "https://files.pythonhosted.org/packages/69/8b/31538e5acbcacb2d1b872c1b61dff71960cc9d2a8fdacf3e714cc5634a22/nnlite-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-15 15:14:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "huangyh09",
"github_project": "nnlite",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "nnlite"
}