A flexible API for instantiating pytorch neural networks composed of sequential linear layers (torch.nn.Linear). Additionally, makes use of other elements within the torch.nn module.
Test implementation 1: Sequential linear neural network
import flexinet
nn = flexinet.models.NN()
# example
nn = flexinet.models.compose_nn_sequential(in_dim=50,
out_dim=50,
activation_function=Tanh(),
hidden_layer_nodes={1: [500, 500], 2: [500, 500]},
dropout=True,
dropout_probability=0.1,
)
Test implementation 2: vanilla linear VAE
Installation
To install the latest distribution from PYPI:
pip install flexinet
Alternatively, one can install the development version:
git clone https://github.com/mvinyard/flexinet.git; cd flexinet;
pip install -e .
Example
import flexinet as fn
import torch
X = torch.load("X_data.pt")
X_data = fn.pp.random_split(X)
X_data.keys()
dict_keys(['test', 'valid', 'train'])
model = fn.models.LinearVAE(X_data,
latent_dim=20,
hidden_layers=5,
power=2,
dropout=0.1,
activation_function_dict={'LeakyReLU': LeakyReLU(negative_slope=0.01)},
optimizer=torch.optim.Adam
reconstruction_loss_function=torch.nn.BCELoss(),
reparameterization_loss_function=torch.nn.KLDivLoss(),
device="cuda:0",
)
model.train(epochs=10_000, print_frequency=50, lr=1e-4)
model.plot_loss()
Contact
If you have suggestions, questions, or comments, please reach out to Michael Vinyard via email
Metadata
Release files for flexinet 0.0.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 | |
|---|---|---|---|
| flexinet-0.0.4.tar.gz | 11.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flexinet-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.2 kB
Release files / flexinet-0.0.4.tar.gz
| Download URL | flexinet-0.0.4.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4f8ca588f45b4d5b6b2cea5fe65b81e79263dd24993f2ad48e319a00751992ae
|
|
BLAKE2b-256 checksum How to use checksums |
8f7f782f251c77110574dcfb1e7c667c34ed364d899c5e1b57adc81c87b05c96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|
Release files / flexinet-0.0.4-py3-none-any.whl
| Download URL | flexinet-0.0.4-py3-none-any.whl |
|---|---|
| Size | 17.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dc3bcae959a328ec241eb214749481a881d71a94684c0f24a58e0ce62a88b894
|
|
BLAKE2b-256 checksum How to use checksums |
8ba3c6a8f4f6c93bf70045c2a04e7368bf542f612a15b034eb4bb22e526a73af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|