Metadata-Version: 2.4
Name: colbert-export
Version: 0.1.0
Summary: Export HuggingFace ColBERT models to ONNX format for Rust inference
Author-email: "Raphael Sourty, LightOn" <contact@lighton.ai>
License: Apache-2.0
Project-URL: Homepage, https://github.com/lightonai/next-plaid
Project-URL: Repository, https://github.com/lightonai/next-plaid
Project-URL: Documentation, https://github.com/lightonai/next-plaid/tree/main/onnx
Keywords: colbert,onnx,embeddings,transformers,information-retrieval
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: pylate>=1.3.3
Requires-Dist: torch>=2.0.0
Requires-Dist: transformers>=4.30.0
Requires-Dist: safetensors>=0.4.0
Requires-Dist: onnx>=1.14.0
Requires-Dist: onnxruntime>=1.16.0
Requires-Dist: numpy>=1.24.0
Requires-Dist: huggingface-hub>=0.20.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"

# ColBERT Export

A CLI tool to export HuggingFace ColBERT models to ONNX format for fast Rust inference.

## Installation

```bash
pip install "colbert-export @ git+https://github.com/lightonai/next-plaid.git#subdirectory=onnx/python"
```

## Usage

### Export a Model

```bash
# Export a ColBERT model to ONNX format
colbert-export lightonai/GTE-ModernColBERT-v1

# Export with INT8 quantization for 2x speedup
colbert-export lightonai/GTE-ModernColBERT-v1 --quantize

# Export to a custom directory
colbert-export lightonai/GTE-ModernColBERT-v1 -o ./my-models
```

### Quantize an Existing Model

```bash
colbert-quantize ./models/GTE-ModernColBERT-v1
```

## Output

The tool creates a directory with the following files:

```
models/<model-name>/
├── model.onnx                      # FP32 ONNX model
├── model_int8.onnx                 # INT8 quantized (if --quantize)
├── tokenizer.json                  # Tokenizer configuration
└── config_sentence_transformers.json  # Model metadata
```

## Supported Models

- `lightonai/GTE-ModernColBERT-v1` (128-dim, ModernBERT-based)
- Any PyLate-compatible ColBERT model from HuggingFace

## Python API

```python
from colbert_export import export_model, quantize_model

# Export a model
output_dir = export_model(
    model_name="lightonai/GTE-ModernColBERT-v1",
    output_dir="./models",
    quantize=True,
)

# Or quantize an existing model
quantize_model("./models/GTE-ModernColBERT-v1")
```

## License

Apache-2.0
