Skip to main content

Generate per-session LoRA adapters for inference tasks

Project description

Tessera Hypernetwork

Generate per-session LoRA adapters for inference tasks. This is the Python hypernetwork service component of Tessera, which works alongside the Rust core to provide LoRA adapter generation via hypernetwork synthesis.

Features

  • Doc-to-LoRA with SHINE: Generate adapters from document content using SHINE (ICML 2026) for long-context internalization
  • Text-to-LoRA: Generate adapters from natural language descriptions
  • Metadata-to-LoRA: Generate adapters from structured user metadata
  • OpenAI-compatible API: Easy integration with existing tooling
  • FastAPI: Modern async Python web framework

Installation

pip install tessera-hypernetwork

Usage

CLI Commands

The tessera CLI provides commands for generating LoRA adapters and running the hypernetwork server:

# Generate LoRA adapter from metadata
tessera generate --from-metadata '{"task": "classification", "domain": "medical"}' \
  --base-model meta-llama/Llama-3-8B \
  --rank 16 \
  --save ./adapter.safetensors

# Generate LoRA adapter from text description
tessera generate --from-text "Senior litigation associate specializing in IP law" \
  --base-model meta-llama/Llama-3-8B \
  --rank 16 \
  --save ./adapter.safetensors

# Generate LoRA adapter from document
tessera generate --from-doc ./document.txt \
  --base-model meta-llama/Llama-3-8B \
  --rank 16 \
  --save ./adapter.safetensors

# Start the hypernetwork server
tessera serve --port 8080 --host 0.0.0.0

# Start server with Qdrant vector database
tessera serve --port 8080 --qdrant-url http://localhost:6333

# Check server health
tessera health --url http://localhost:8000

# List available base models
tessera list

# LoRAX adapter management
tessera lorax import --path ./adapter.safetensors --name my-adapter --base-model meta-llama/Llama-3-8B --server-url http://localhost:8000
tessera lorax list --server-url http://localhost:8000
tessera lorax unload --name my-adapter --server-url http://localhost:8000

Server Mode

You can also run the server directly:

python -m tessera_hypernetwork.server

API

The hypernetwork service provides a FastAPI server with the following endpoints:

  • POST /v1/generate - Generate a LoRA adapter for a given prompt
  • GET /health - Health check endpoint

Development

Install development dependencies:

pip install tessera-hypernetwork[dev]

Run tests:

pytest

Integration with Tessera

This hypernetwork service is designed to work with the Tessera Rust core. The Rust core handles semantic caching, vector similarity search, and adapter composition, while this Python service handles the actual LoRA adapter generation via hypernetwork synthesis.

Full Tessera CLI Lifecycle

The Tessera hypernetwork service provides a comprehensive CLI for LoRA adapter generation and serving:

# Generate LoRA adapter from metadata (JSON string or file)
tessera generate --from-metadata '{"task": "classification", "domain": "medical"}' \
  --base-model meta-llama/Llama-3-8B \
  --rank 16 \
  --save ./adapter.safetensors

# Generate LoRA adapter from natural language description
tessera generate --from-text "Senior litigation associate specializing in IP law" \
  --base-model meta-llama/Llama-3-8B \
  --rank 16 \
  --save ./adapter.safetensors

# Generate LoRA adapter from document content
tessera generate --from-doc ./document.txt \
  --base-model meta-llama/Llama-3-8B \
  --rank 16 \
  --save ./adapter.safetensors

# Start the hypernetwork server
tessera serve --port 8080 --host 0.0.0.0

# Start server with Qdrant vector database integration
tessera serve --port 8080 --qdrant-url http://localhost:6333

# Check server health status
tessera health --url http://localhost:8000

# List available base models and their dimensions
tessera list

# LoRAX adapter management
tessera lorax import --path ./adapter.safetensors --name my-adapter --base-model meta-llama/Llama-3-8B --server-url http://localhost:8000
tessera lorax list --server-url http://localhost:8000
tessera lorax unload --name my-adapter --server-url http://localhost:8000

For the complete Tessera system, see: https://github.com/theoddden/Tessera

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tessera_hypernetwork-0.2.10.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tessera_hypernetwork-0.2.10-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file tessera_hypernetwork-0.2.10.tar.gz.

File metadata

  • Download URL: tessera_hypernetwork-0.2.10.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for tessera_hypernetwork-0.2.10.tar.gz
Algorithm Hash digest
SHA256 2fed95305545fa8d4e6603298cb25c68cd70e832a167202aadff331e403509a4
MD5 1c74d5ac4e2b4408693754c598f70f08
BLAKE2b-256 cc034b5f06021ecf8cc9f95222a79342fdabbd211515b296de4e0924a233207a

See more details on using hashes here.

File details

Details for the file tessera_hypernetwork-0.2.10-py3-none-any.whl.

File metadata

File hashes

Hashes for tessera_hypernetwork-0.2.10-py3-none-any.whl
Algorithm Hash digest
SHA256 be0a36522fec2b0ae40a49c864bf40624c6f3440344b7784ac370de3f3f74dfe
MD5 ca31b59fcda39fc3e5b82bcd7246d066
BLAKE2b-256 a24994178ffff3e2a66815eed70371c8867416bf9fe0812e23af1a0bb8b896a7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page