Skip to main content

Flexible torch neural network architecture API

Project description

flexinet-logo

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.

Current test implementation: vanilla linear VAE

FlexiLinearAVE

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",
                           )
from_nb.linear_VAE
model.train(epochs=10_000, print_frequency=50, lr=1e-4)
from_nb.train_in_progress
model.plot_loss()

loss-plot

Contact

If you have suggestions, questions, or comments, please reach out to Michael Vinyard via email

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flexinet-0.0.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

flexinet-0.0.0-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file flexinet-0.0.0.tar.gz.

File metadata

  • Download URL: flexinet-0.0.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for flexinet-0.0.0.tar.gz
Algorithm Hash digest
SHA256 6f8f7184414ad2d7d0a6947bed2c3532038ae73fac5f72a6849aaba4a3a773d1
MD5 c386a016b5d055ed26a9bd663cc16bfe
BLAKE2b-256 c1d86392f077ada91e25c33bb0e58eb8f705c4184335e9d67a2986fe4f729de4

See more details on using hashes here.

File details

Details for the file flexinet-0.0.0-py3-none-any.whl.

File metadata

  • Download URL: flexinet-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for flexinet-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0e6acfc9fad13e927671770c7252dfc17d6926defe5264b13b46866086e4cd70
MD5 f3d4b68374edcfeb265a19b7530643ab
BLAKE2b-256 6bc592338f6d332af217b22665e4fb848da5dba87552ff182bf41742f84560b2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page