hyper-models docs

hyper-models · Guides

Integrations

Use hyper-models from HyperView, and Hyper3-CLIP as a Haystack embedder with Lorentz retrieval.

HyperView

HyperView recognises hyper-models names and routes them to the hyper-models provider:

space = dataset.compute_embeddings(model="hyper3-clip-v1")
dataset.compute_visualization(space_key=space, layout="poincare")

HyperView itself needs no PyTorch. Install hyper-models[ml] only when you pick a PyTorch-backed model. See Embeddings and layouts.

Haystack

pip install "hyper-models[ml,haystack]>=0.4.0"
from hyper_models.integrations.haystack import (
    Hyper3DocumentImageEmbedder,
    Hyper3TextEmbedder,
)

Both components return native 513-coordinate Lorentz embeddings and pin the released model revision by default. Authenticate with hf auth login, HF_TOKEN or HF_API_TOKEN first.

Store image embeddings unchanged. To rank by the Lorentz inner product with a dot-product document store, negate the first coordinate of the query only:

from haystack.components.converters import OutputAdapter

lorentz_query = OutputAdapter(
    template="{{ [-embedding[0]] + embedding[1:] }}",
    output_type=list[float],
)

This computes -q0*x0 + qs·xs, so higher scores are nearer. Pass scale_score=False to the retriever to keep raw scores, and do not normalise the vectors. The complete example indexes images and runs text queries.

When loading a saved pipeline you trust, allow the module explicitly:

Pipeline.loads(yaml_text, allowed_modules=["hyper_models.integrations.haystack"])
Edit this page on GitHub