Skip to main content

OpenRetina

Ruff mypy pytorch lightning hydra DOI

huggingface

Open-source repository containing neural network models of the retina. The models in this repository are inspired by and contain adapted code of sinzlab/neuralpredictors. Accompanying preprint: openretina: Collaborative Retina Modelling Across Datasets and Species.

Installation

openretina supports installation via pip.

# (Recommended) using a package manager like uv
uv pip install openretina

# Or directly via pip if you prefer
pip install openretina

If you want to train your own models, run Jupyter notebooks, contribute to the project, or modify the source code of openretina, we recommend to install from source. Consider using uv, a fast and flexible project and package manager. If you are not familiar with uv, check out their simple quickstart guide.

git clone git@github.com:open-retina/open-retina.git
cd open-retina

# Sync with uv
uv sync --extra dev

# Alternatively, install in editable mode via pip. 
pip install -e .[dev]

Test openretina by downloading a model and running a forward pass:

import torch
from openretina.models import *

model = load_core_readout_from_remote("hoefling_2024_low_res", "cpu")
responses = model.forward(torch.rand(model.stimulus_shape(time_steps=50)))

Contributing

Before raising a PR please run:

# Fix formatting of python files
make fix-formatting

# Run type checks and unit tests
make test-all

Design decisions and structure

With this repository we provide already pre-trained retina models that can be used for inference and intepretability out of the box, and dataloaders together with model architectures to train new models. For training new models, we rely on pytorch lightning in combination with hydra to manage the configurations for training and dataloading.

The openretina package is structured as follows:

  • modules: pytorch modules that define layers and losses
  • models: pytorch lightning models that define models that can be trained and evaluated (i.e. models from specific papers)
  • data_io: dataloaders to manage access of data to be used for training
  • insilico: Methods perform insilico experiments with above models
    • stimulus_optimization: optimize inputs for neurons of above models according to interpretable objectives (e.g. most exciting inputs)
    • future options: gradient analysis, data analysis
  • utils: Utility functions that are used across above submodules

Related papers and data sources

The paper Most discriminative stimuli for functional cell type clustering explains the discriminatory stimulus objective we showcase in notebooks/most_discriminative_stimulus.

Metadata

Release files for openretina 1.1.1

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

Source distribution (sdist)

Source distribution for openretina 1.1.1
File Size Uploaded
openretina-1.1.1.tar.gz 197.3 kB Details

Built distribution (wheel)

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

Total release size: 423.3 kB

Release files / openretina-1.1.1.tar.gz

Download URL openretina-1.1.1.tar.gz
Size 197.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6f719eba27e1313caab1d471f76d69607e5a14e9cf7dbc5cf00f24c0037e240a
BLAKE2b-256 checksum
How to use checksums
66b961591cd2d2349c0767056ff84d292f5053ac28051194807687b5ffd58fbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 10, 2026.

Transparency log

Release files / openretina-1.1.1-py3-none-any.whl

Download URL openretina-1.1.1-py3-none-any.whl
Size 226.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01e1e5e750174558d8573ee3c75bff179e3e214bb8d78bc98bc31c1baae603ab
BLAKE2b-256 checksum
How to use checksums
5617408470ae69b351a9df8693f00968925485b060f0380ed20c06d27158f123
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.3.1

2 release files

0.1.0

2 release files

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