Skip to main content

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

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 folder, including

Metadata

Release files for nnlite 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nnlite 0.0.3
File Size Uploaded
nnlite-0.0.3.tar.gz 2.0 MB Details

Release files / nnlite-0.0.3.tar.gz

Download URL nnlite-0.0.3.tar.gz
Size 2.0 MB
Tags Source
SHA-256 checksum
How to use checksums
244b62f8af79c280c0526934ae018706de46ad00fcf3fee87bb28a320ababe85
BLAKE2b-256 checksum
How to use checksums
698b31538e5acbcacb2d1b872c1b61dff71960cc9d2a8fdacf3e714cc5634a22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.0.3 This release

1 release file

0.0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page