Skip to main content

Hypernetworks for PyTorch

This package contains utilities that make it easy to work with hypernetworks in PyTorch.

Installation

You can either install the latest package version via

python3 -m pip install hypnettorch

or, you directly install the current sources

python3 -m pip install git+https://github.com/chrhenning/hypnettorch

Installation for developers

If you actively develop the package, it is easiest to install it in development mode, such that all changes that are done to source files are directly visible when you use the package.

Clone the repository to a location of your choice

git clone https://github.com/chrhenning/hypnettorch.git

and move inside the cloned repo

cd ./hypnettorch

Now, you can simply install the package in editable mode, which will ensure that you can easily update the package sources (cf. development mode)

pip3 install --editable . --user

Since the package was installed in editable mode, you can always update the sources simply by pulling the most recent code

git pull

You can uninstall the package at any point by running python3 setup.py develop -u.

Usage

The basic functionalities of the package are quite intuitive and easy to use, e.g.,

import torch
from hypnettorch.mnets import MLP
from hypnettorch.hnets import HMLP
mnet = MLP(n_in=8, n_out=1, no_weights=True) # Create MLP with 8 inputs and 1 output.
hnet = HMLP(mnet.param_shapes) # Create hypernetwork for the above MLP.
weights = hnet.forward(cond_id=0) # Generate the weights of network `mnet`.
inputs = torch.rand(32, 8) # Random inputs.
mnet.forward(inputs, weights=weights) # Compute predictions using the generated weights.

There are several tutorials. Check out the getting started tutorial when working with hypnettorch for the first time.

Documentation

The documentation can be found here.

Note for developers

The documentation can be build using

python3 setup.py build_sphinx

and opened via the file index.html.

Citation

When using this package in your research project, please consider citing one of our papers for which this package has been developed.

@inproceedings{oshg2019hypercl,
title={Continual learning with hypernetworks},
author={Johannes von Oswald and Christian Henning and Jo{\~a}o Sacramento and Benjamin F. Grewe},
booktitle={International Conference on Learning Representations},
year={2020},
url={https://arxiv.org/abs/1906.00695}
}
@inproceedings{ehret2020recurrenthypercl,
  title={Continual Learning in Recurrent Neural Networks},
  author={Benjamin Ehret and Christian Henning and Maria R. Cervera and Alexander Meulemans and Johannes von Oswald and Benjamin F. Grewe},
  booktitle={International Conference on Learning Representations},
  year={2021},
  url={https://arxiv.org/abs/2006.12109}
}
@inproceedings{posterior:replay:2021:henning:cervera,
title={Posterior Meta-Replay for Continual Learning}, 
      author={Christian Henning and Maria R. Cervera and Francesco D'Angelo and Johannes von Oswald and Regina Traber and Benjamin Ehret and Seijin Kobayashi and Benjamin F. Grewe and João Sacramento},
booktitle={Conference on Neural Information Processing Systems},
year={2021},
url={https://arxiv.org/abs/2103.01133}
}

Metadata

Release files for hypnettorch 0.0.4

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

Source distribution (sdist)

Source distribution for hypnettorch 0.0.4
File Size Uploaded Provenance Actions
hypnettorch-0.0.4.tar.gz 367.0 kB Without provenance Details for hypnettorch-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hypnettorch 0.0.4
File Interpreter ABI Platform Actions
hypnettorch-0.0.4-py3-none-any.whl Python 3 none any Details for hypnettorch-0.0.4-py3-none-any.whl

Total release size: 823.9 kB

Release files / hypnettorch-0.0.4.tar.gz

Download URL hypnettorch-0.0.4.tar.gz
Size 367.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ff46ab52d9ec6e62851b6ac21fccd3277151eda8d69d0b35497d14ef27d368a6
BLAKE2b-256 checksum
How to use checksums
c2b6e5490071c57ddef92a5e063119b5d48eafa588a003f39d17257cc4a7e4e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.12

Release files / hypnettorch-0.0.4-py3-none-any.whl

Download URL hypnettorch-0.0.4-py3-none-any.whl
Size 456.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
93c04577b63c01262a31e63aafbb3ce681ed0b41e0d860795b4e6d9529f5018c
BLAKE2b-256 checksum
How to use checksums
468144ba94976e0bd723420b2b0422951e46938170e7b5be54c4317500250811
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.12

Security for hypnettorch 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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