Skip to content

hypernetwork-research-group/hypertorch

HyperTorch

Repo Forks Stargazers Contributors Issues
Package License: MIT Python Documentation
Testing Daily CI Weekly CI codecov CodeFactor
Contact Discord

About the project

HyperTorch is a library for hypergraph learning and benchmarking. It provides a standardized workflow for loading hypergraph datasets, training models, evaluating them under comparable settings, and reporting results. The current release focuses on Hyperlink Prediction, with ready-to-run pipelines for established hypergraph baselines.

The library is built around extensibility: datasets are represented in HIF format and converted into typed tensor objects, models can be implemented as standard Lightning modules, and benchmarking is handled through reusable trainers, samplers, metrics, loggers, and result exporters (Markdown/LaTeX). HyperTorch includes preloaded datasets, mini-batch and full-hypergraph data loading, negative sampling utilities, structural feature enrichers, neural components, and built-in models such as HGNN, HNHN, HyperGCN, GCN, MLP/SLP, NHP, Node2Vec, VilLain, and more.

Use HyperTorch to:

  • Benchmark existing models across a shared collection of hypergraph datasets.
  • Develop custom PyTorch or PyTorch Lightning models and train and compare them against the built-in baselines.
  • Integrate new datasets through the HIF format and run the same training, evaluation, and reporting pipeline on them.

Table of contents

Main features

Feature What you can do Highlights Location
Dataset management Load, process, and validate hypergraph datasets HIF loader/processor, built-in datasets such as Algebra, Cora, Pubmed, DBLP, Amazon, and IMDB hypertorch.data
Splitting, sampling, and batching Prepare train/validation/test data and mini-batches Dataset splitters, node and hyperedge samplers, negative samplers, data loaders hypertorch.data
Feature enrichment Enrich node and hyperedge features before training Laplacian positional encodings, Node2Vec features, hyperedge weights and attributes hypertorch.data
Neural components (NN) Build models and pipelines Layers, aggregators, losses, and activation/normalization helpers hypertorch.nn
Models Access hypergraph models HGNN, HGNNP, HNHN, HyperGCN, GCN, MLP/SLP, NHP, Node2Vec, VilLain, CommonNeighbors hypertorch.models
Hyperlink prediction (HLP) pipelines Use ready-to-train hyperlink prediction modules HLP modules with encoders, configs, losses, and stage metrics for multiple models hypertorch.hyperlink_prediction
Node classification (NC) pipelines Use ready-to-train node classification modules NC modules with encoders, configs, losses, and stage metrics for multiple models hypertorch.node_classification
Training and benchmarking Train, compare, checkpoint, and report model runs Multi-model trainer, schedulers, TensorBoard support, CSV/Markdown/LaTeX result tables hypertorch.train

Getting started

Installation

HyperTorch can be installed from PyPI when you want to use it as a dependency, or from source when you want to contribute or run the latest repository version.

CI pipelines validate CPU installs on Python 3.10 through 3.14 for Linux x86_64, Linux ARM/aarch64, macOS arm64, and Windows x64. Install the matching PyTorch and PyG wheels for your platform (e.g., CUDA) before installing HyperTorch.

For more detailed instructions, see the installation guide.

Source installation

git clone https://github.com/hypernetwork-research-group/hypertorch.git
cd hypertorch

make setup

See the installation guide for platform notes and dependency ranges.

TensorBoard support

To include TensorBoard support, also run HyperTorch install command with the TensorBoard extra:

uv pip install "hypertorch[tensorboard]"

When installing from source, run the command:

make setup-tensorboard

Run examples

You can download the examples directory and run the example scripts to get started.

With Python:

python3 examples/hyperlink_prediction/nhp.py

Or with uv:

uv run examples/hyperlink_prediction/nhp.py

Contributing

See CONTRIBUTING.md for details on contributing to the project.

Documentation

You can find the extensive documentation here.

Alternatively, you can build the documentation locally with the following commands:

make docs

# With explicit commands
uv run zensical build --clean -f zensical.toml
uv run zensical serve -f zensical.toml -a 127.0.0.1:8000

and open the browser at http://localhost:8000 to access the documentation.

License

See LICENSE.

Discussion

Most development discussions take place on GitHub in this repo, via the GitHub issue tracker.

About

A library to train and benchmark Hypergraph Learning models.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

28 stars

Watchers

0 watching

Forks

Contributors

Languages