Skip to main content

Export HuggingFace ColBERT models to ONNX format for Rust inference

Project description

ColBERT Export

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

Installation

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

Usage

Export a Model

# 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

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

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

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

colbert_export-0.1.0.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

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

colbert_export-0.1.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file colbert_export-0.1.0.tar.gz.

File metadata

  • Download URL: colbert_export-0.1.0.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for colbert_export-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cc8d0ab549a29c293930f6c29b9d1b6eec351c30db6d1cbcc6c82aa9038e4529
MD5 576b4400d7570cb97aac85e442272959
BLAKE2b-256 e93bb3c188eceec1153fd7fd2ad7e58483ff2c3d4cb0a3da3801cdbfa322939a

See more details on using hashes here.

File details

Details for the file colbert_export-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: colbert_export-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for colbert_export-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 123c6639697ce023a04bb80863c5ec4d8834650dab9db40a764cd0583c30e33c
MD5 901256de3115241f0bb074c651eb811d
BLAKE2b-256 d5cbddbe4c44ffb6a101f5860a42bd656da9ecd9a4284283e9951070d5cd2842

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