-
Notifications
You must be signed in to change notification settings - Fork 2
Installation
Brodie edited this page Dec 22, 2025
·
2 revisions
- Python 3.9 or higher
- NumPy (installed automatically)
pip install holovecgit clone https://github.com/Twistient/HoloVec.git
cd HoloVec
pip install -e .HoloVec supports three computational backends. NumPy is always available; PyTorch and JAX are optional.
pip install holovec[torch]
# or
pip install torchEnables CUDA (NVIDIA) and MPS (Apple Silicon) GPU acceleration.
pip install holovec[jax]
# or
pip install jax jaxlibEnables JIT compilation for 10-100x speedup on repeated operations.
pip install holovec[all]For contributing or running tests:
git clone https://github.com/Twistient/HoloVec.git
cd HoloVec
pip install -e .[dev]This includes:
- pytest for testing
- black for code formatting
- ruff for linting
- mypy for type checking
- hypothesis for property-based testing
from holovec import VSA
# Check available backends
print(VSA.backend_info())
# Create a model and test basic operation
model = VSA.create('FHRR', dim=1024)
a, b = model.random(), model.random()
c = model.bind(a, b)
print(f"Binding works: {model.similarity(model.unbind(c, b), a) > 0.99}")Expected output:
{'numpy': True, 'torch': True/False, 'jax': True/False}
Binding works: True
HoloVec automatically selects NumPy as the default backend. To use a specific backend:
# NumPy (default, always available)
model = VSA.create('FHRR', dim=2048)
# PyTorch with CPU
model = VSA.create('FHRR', dim=2048, backend='torch')
# PyTorch with CUDA GPU
model = VSA.create('FHRR', dim=2048, backend='torch', device='cuda')
# PyTorch with Apple Silicon GPU
model = VSA.create('FHRR', dim=2048, backend='torch', device='mps')
# JAX with JIT compilation
model = VSA.create('FHRR', dim=2048, backend='jax')Ensure PyTorch is installed:
python -c "import torch; print(torch.__version__)"Ensure JAX and jaxlib are installed:
python -c "import jax; print(jax.__version__)"Check CUDA installation:
import torch
print(torch.cuda.is_available())
print(torch.cuda.get_device_name(0) if torch.cuda.is_available() else "No CUDA")MPS support requires macOS 12.3+ and PyTorch 1.12+:
import torch
print(torch.backends.mps.is_available())Note
Some complex number operations may have limited MPS support. FHRR works correctly; fall back to CPU if issues arise.