Skip to main content

Load ONNX embedding models into Oracle AI Database with one command

Project description

onnx2oracle

Load ONNX embedding models into Oracle AI Database with one command.

CI Docs PyPI License: MIT

pip install onnx2oracle
onnx2oracle docker up
onnx2oracle load all-MiniLM-L6-v2 --target local
onnx2oracle verify --target local

Embeddings run entirely in-database via Oracle's VECTOR_EMBEDDING — no external API calls, no network round-trips, no serving layer.

How it works

onnx2oracle downloads a sentence-transformer model from HuggingFace, wraps its tokenizer as ONNX ops, merges it with the transformer body, and appends pooling + L2 normalization. The resulting single-graph ONNX is uploaded to Oracle via DBMS_VECTOR.LOAD_ONNX_MODEL, after which you can query it with:

SELECT VECTOR_EMBEDDING(ALL_MINILM_L6_V2 USING 'hello world' AS DATA) FROM dual;

Presets

Preset Dims Size Pooling
all-MiniLM-L6-v2 384 90 MB mean
all-MiniLM-L12-v2 384 130 MB mean
all-mpnet-base-v2 768 420 MB mean
multilingual-e5-small 384 470 MB mean
bge-small-en-v1.5 384 130 MB cls
nomic-embed-text-v1 768 540 MB mean

Any sentence-transformer-style HuggingFace model also works via --from-huggingface.

Common tasks

# List all presets
onnx2oracle presets

# Load into a cloud ADB
onnx2oracle load all-mpnet-base-v2 --dsn 'app/pass@adb.region.oraclecloud.com:1522/xxx_high'

# Load a non-preset model
onnx2oracle load --from-huggingface BAAI/bge-base-en-v1.5 \
  --pooling cls --normalize --dims 768 --name BGE_BASE_EN_V1_5

# End-to-end verification
onnx2oracle verify --target local

Requirements

  • Python 3.10+
  • Docker (for the local Oracle 26ai Free path) or any Oracle 23ai/26ai instance
  • ~2 GB free RAM during model augmentation
  • ~1 GB DB storage per preset

Documentation

Full guide at jasperan.github.io/onnx2oracle.

Development

git clone https://github.com/jasperan/onnx2oracle
cd onnx2oracle
conda create -n onnx2oracle python=3.12 -y
conda activate onnx2oracle
pip install -e ".[dev]"
pytest tests/ -v -m "not slow and not integration"

License

MIT.

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

onnx2oracle-0.1.0.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

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

onnx2oracle-0.1.0-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for onnx2oracle-0.1.0.tar.gz
Algorithm Hash digest
SHA256 68372dc44ee46a800d71041620cd080f26f16dcb1e6b23a2caadb8035de7632d
MD5 2f474da5cb037e3b5bcb31238c228d78
BLAKE2b-256 caf7bfcd05d8cd22951d05fa11fc761eb38f0a7736b9722a78c0612f80fcf63c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for onnx2oracle-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9662ebaaf8a21e165ab91075de44feccbedece9f95578e82f2f70df46983ad1b
MD5 4c95168d45e197e04cc1260b59aa9412
BLAKE2b-256 9b206e635e4ed4ac67d2905d0ad2d02e1032e335f067d9c29693c307460056c2

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