{"id":24446421,"url":"https://github.com/mvinyard/flexinet","last_synced_at":"2026-04-11T20:03:14.127Z","repository":{"id":57679735,"uuid":"492388651","full_name":"mvinyard/flexinet","owner":"mvinyard","description":"flexinet: flexible torch neural network composition","archived":false,"fork":false,"pushed_at":"2022-08-21T03:34:03.000Z","size":67,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T03:07:06.699Z","etag":null,"topics":["dimension-reduction","neural-networks","pytorch","torch","vae"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/flexinet/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mvinyard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-15T04:41:22.000Z","updated_at":"2022-05-15T23:57:07.000Z","dependencies_parsed_at":"2022-09-04T06:20:53.985Z","dependency_job_id":null,"html_url":"https://github.com/mvinyard/flexinet","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvinyard%2Fflexinet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvinyard%2Fflexinet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvinyard%2Fflexinet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvinyard%2Fflexinet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mvinyard","download_url":"https://codeload.github.com/mvinyard/flexinet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243505898,"owners_count":20301619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dimension-reduction","neural-networks","pytorch","torch","vae"],"created_at":"2025-01-21T00:00:46.296Z","updated_at":"2025-12-28T20:27:38.597Z","avatar_url":"https://github.com/mvinyard.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ![flexinet-logo](/docs/img/flexinet.logo.v3.svg)\n\nA flexible API for instantiating pytorch neural networks composed of sequential linear layers ([`torch.nn.Linear`](https://pytorch.org/docs/stable/generated/torch.nn.Linear.html#torch.nn.Linear)). Additionally, makes use of other elements within the [`torch.nn`](https://pytorch.org/docs/stable/nn.html) module.\n\n## Test implementation 1: Sequential linear neural network\n\n```python\nimport flexinet\n\nnn = flexinet.models.NN()\n```\n\n```python\n# example\nnn = flexinet.models.compose_nn_sequential(in_dim=50,\n                                           out_dim=50,\n                                           activation_function=Tanh(),\n                                           hidden_layer_nodes={1: [500, 500], 2: [500, 500]},\n                                           dropout=True,\n                                           dropout_probability=0.1,\n                                           )\n```\n\n## Test implementation 2: vanilla linear VAE\n\n\u003cimg width=\"400\" alt=\"FlexiLinearAVE\" src=\"/docs/img/flexinet.LinearVAE.svg\"\u003e\n\n## Installation\n\nTo install the latest distribution from [PYPI](https://pypi.org/project/flexinet/):\n\n```BASH\npip install flexinet\n```\n\nAlternatively, one can install the development version:\n\n```BASH\ngit clone https://github.com/mvinyard/flexinet.git; cd flexinet;\n\npip install -e .\n```\n\n### Example\n\n```python\nimport flexinet as fn\nimport torch\n\nX = torch.load(\"X_data.pt\")\nX_data = fn.pp.random_split(X)\nX_data.keys()\n```\n\u003e`dict_keys(['test', 'valid', 'train'])`\n\n```python\nmodel = fn.models.LinearVAE(X_data,\n                            latent_dim=20, \n                            hidden_layers=5, \n                            power=2,\n                            dropout=0.1,\n                            activation_function_dict={'LeakyReLU': LeakyReLU(negative_slope=0.01)},\n                            optimizer=torch.optim.Adam\n                            reconstruction_loss_function=torch.nn.BCELoss(),\n                            reparameterization_loss_function=torch.nn.KLDivLoss(),\n                            device=\"cuda:0\",\n                           )\n```\n\u003cimg width=\"541\" alt=\"from_nb.linear_VAE\" src=\"https://user-images.githubusercontent.com/47393421/168488664-e7918416-8ae8-4369-a6ef-b73449c42b5f.png\"\u003e\n\n```python\nmodel.train(epochs=10_000, print_frequency=50, lr=1e-4)\n```\n\n\u003cimg width=\"541\" alt=\"from_nb.train_in_progress\" src=\"https://user-images.githubusercontent.com/47393421/168489358-620815b0-b129-43af-8eb4-0009c46d3295.png\"\u003e\n\n```python\nmodel.plot_loss()\n```\n![loss-plot](https://user-images.githubusercontent.com/47393421/168498723-4b183481-b651-45ba-abf9-72df57a7ee97.png)\n\n## Contact\n\nIf you have suggestions, questions, or comments, please reach out to Michael Vinyard via [email](mailto:mvinyard@broadinstitute.org)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmvinyard%2Fflexinet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmvinyard%2Fflexinet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmvinyard%2Fflexinet/lists"}