Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Heron Logo

Heron

Tests Code Coverage Code Quality PyPI Version Python Version Documentation License


Heron is a high-level self-supervised learning (SSL) library built on JAX, Flax, and Optax. It provides high-level abstractions to simplify the process of training and experimenting with SSL algorithms, allowing you to focus on the model and data, not the boilerplate.

Heron aims to be modular and extensible, with clear separation between models, loss functions, data augmentations, and training strategies.

Core Features

  • High-Level Trainer API: A simple Trainer class that abstracts away the complexities of JAX's functional paradigm, including jit, pmap, and state management.
  • Modular Design: Easily mix and match backbones, heads, loss functions, and augmentation pipelines.
  • SSL Strategies: Pre-packaged implementations of popular SSL algorithms.
  • Performance: Built on JAX and Flax to leverage hardware acceleration on GPUs and TPUs.

Feature Roadmap

-   [x] Establish core abstractions (`Trainer`, `Backbone`, `ProjectionHead`).
-   [x] Implement **SimCLR** as the first end-to-end strategy.
-   [ ] Implement a robust data augmentation pipeline for contrastive learning.
-   [ ] Initial PyPI release.
-   [ ] Implement **BYOL** and **SimSiam** (non-contrastive methods).
-   [ ] Add logic for momentum encoders (teacher-student models).
-   [ ] Refine `TrainState` management and checkpointing.
-   [ ] Implement **DINO** and **MoCo v3**.
-   [ ] Add Vision Transformer (ViT) backbones.
-   [ ] Implement teacher-student centering and sharpening.
-   [ ] Masked Image Modeling strategies (e.g., **MAE**).
-   [ ] Integration with Hugging Face models and datasets.
-   [ ] Comprehensive documentation and tutorials.

Installation

pip install heron-ssl

Quick Start

Here is a conceptual example of how to use the Trainer API.

import heron_ssl as ssl
import tensorflow_datasets as tfds
import optax

# 1. Load a dataset
dataset = tfds.load('cifar10', split='train')

# 2. Define the model and SSL strategy
strategy = ssl.strategies.SimCLR(
    backbone=ssl.models.ResNet50(),
    projector=ssl.models.ProjectionHead(hidden_dims=[2048], output_dim=128),
)

# 3. Configure and run the trainer
trainer = ssl.Trainer(
    strategy=strategy,
    optimizer=optax.adam(1e-3),
)

# 4. Start training
trained_backbone_params = trainer.fit(dataset)

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for details on how to get started.

License

Heron is licensed under the MIT License (LICENSE).

Acknowledgements

Metadata

Release files for heron-ssl 0.1.0a1

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

Source distribution (sdist)

Source distribution for heron-ssl 0.1.0a1
File Size Uploaded
heron_ssl-0.1.0a1.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for heron-ssl 0.1.0a1
File Interpreter ABI Platform
heron_ssl-0.1.0a1-py3-none-any.whl Python 3 none any Details

Total release size: 13.2 kB

Release files / heron_ssl-0.1.0a1.tar.gz

Download URL heron_ssl-0.1.0a1.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a13e40fcee3adac4deb3c6ea9d0a165651139ce7aaf17dc0fb0dd659337534bb
BLAKE2b-256 checksum
How to use checksums
3376e720e70cc26bd1c91d47480ac1579ec090488476e5052f3d323123724861
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.19

Release files / heron_ssl-0.1.0a1-py3-none-any.whl

Download URL heron_ssl-0.1.0a1-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b540864bbcdabdae8a49db8528b2463f925061c7159ec935a816a73bbed122ae
BLAKE2b-256 checksum
How to use checksums
f535427bcf1f467a1fff8679c504b633d1c97516044c85ee31399bf578cfb037
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.19

Release history Release notifications | RSS feed

This release

0.1.0a1 This release

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