neural-processes

Pytorch implementation of Neural Processes for functions and images :fireworks:

https://github.com/emiliendupont/neural-processes

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.5%) to scientific vocabulary

Keywords

deep-learning neural-processes pytorch
Last synced: 6 months ago · JSON representation ·

Repository

Pytorch implementation of Neural Processes for functions and images :fireworks:

Basic Info
  • Host: GitHub
  • Owner: EmilienDupont
  • License: mit
  • Language: Jupyter Notebook
  • Default Branch: master
  • Homepage:
  • Size: 16.2 MB
Statistics
  • Stars: 229
  • Watchers: 7
  • Forks: 48
  • Open Issues: 1
  • Releases: 0
Topics
deep-learning neural-processes pytorch
Created almost 7 years ago · Last pushed about 4 years ago
Metadata Files
Readme License Citation

README.md

Neural Processes

Pytorch implementation of Neural Processes. This repo follows the best practices defined in Empirical Evaluation of Neural Process Objectives.

Examples

| Function Regression | Image inpainting | |:---------------------:|:------------------:| | | |

Usage

Simple example of training a neural process on functions or images.

```python import torch from neural_process import NeuralProcess, NeuralProcessImg from training import NeuralProcessTrainer

Define neural process for functions...

neuralprocess = NeuralProcess(xdim=1, ydim=1, rdim=10, zdim=10, h_dim=10)

...or for images

neuralprocess = NeuralProcessImg(imgsize=(3, 32, 32), rdim=128, zdim=128, hdim=128)

Define optimizer and trainer

optimizer = torch.optim.Adam(neuralprocess.parameters(), lr=3e-4) nptrainer = NeuralProcessTrainer(device, neuralprocess, optimizer, numcontextrange=(3, 20), numextratargetrange=(5, 10))

Train on your data

nptrainer.train(dataloader, epochs=30) ```

1D functions

For a detailed tutorial on training and using neural processes on 1d functions, see the notebook example-1d.ipynb.

Images

To train an image model, use python main_experiment.py config.json. This will log information about training and save model weights.

For a detailed tutorial on how to load a trained model and how to use neural processes for inpainting, see the notebook example-img. Trained models for MNIST and CelebA are also provided in the trained_models folder.

Note, to train on CelebA you will have to download the data from here.

Acknowledgements

Several people at OxCSML helped me understand various aspects of neural processes, especially Kaspar Martens, Jin Xu, Jef Ton and Hyunjik Kim.

Useful resources: * Kaspar's blog post * Official TensorFlow implementation

License

MIT

Owner

  • Name: Emilien Dupont
  • Login: EmilienDupont
  • Kind: user
  • Location: Stanford University

Machine Learning is coolbeans 🌴

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, feel free to cite it as below."
authors:
- family-names: "Dupont"
  given-names: "Emilien"
title: "Neural process pytorch implementation"
version: 1.0.0
date-released: 2019-04-30
url: "https://github.com/EmilienDupont/neural-processes"

GitHub Events

Total
  • Watch event: 10
  • Fork event: 1
Last Year
  • Watch event: 10
  • Fork event: 1

Dependencies

requirements.txt pypi
  • imageio *
  • matplotlib *
  • numpy *
  • torch *
  • torchvision *