Downloads · 30 days
9
10% of all-time downloads
medbrevia/medembed-small-v0.1-onnx-int8
medembed-small-v0.1-onnx-int8 is a feature extraction model from medbrevia. Use it when you need embeddings to search or compare text. It is set up for onnxruntime. The card lists the license as apache-2.0.
This repository contains a compact ONNX Runtime export of abhinand/MedEmbed-small-v0.1 for local semantic search in Smart Search for Anki — Medical.
Downloads · 30 days
9
10% of all-time downloads
All-time downloads
87
Public
Repo size
34.1 MB
Likes
0
Public
Click a slice to open those files.
.onnx34.1 MB · 97%
From the Hugging Face model README
This repository contains a compact ONNX Runtime export of
abhinand/MedEmbed-small-v0.1
for local semantic search in
Smart Search for Anki — Medical.
It is an independently produced derivative, not an official export from the upstream author. The source revision, every source and output checksum, the complete conversion recipe, and a numerical parity sanity check are included in this repository.
| File | Size | SHA-256 |
|---|---|---|
onnx/model_int8.onnx | 34,057,273 bytes | accb5b9e914356d01190c9f208ac822b345b24daeee4aa0fb345dfcc89a871d5 |
The model accepts input_ids, attention_mask, and token_type_ids with
dynamic batch and sequence dimensions. It returns one
sentence_embedding tensor with 384 dimensions. The maximum configured
sequence length is 512 tokens.
The graph already applies the upstream Sentence Transformers pipeline:
last_hidden_state[:, 0, :]);The FP32 ONNX intermediate is reproducible but intentionally omitted to reduce the download by approximately 127 MB.
abhinand/MedEmbed-small-v0.140a5850d046cfdb56154e332b4d7099b63e8d50eBAAI/bge-small-en-v1.5See PROVENANCE.json for source file hashes, transform
parameters, tool versions, and validation results. See NOTICE.md
and the included license files for attribution and modification notices.
Use CPython 3.11 on macOS arm64 to reproduce the verified release environment:
python3.11 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements-model-export.txt
python export_medembed_onnx.py --output-dir build
The script downloads only the pinned upstream revision, verifies every required source file, checks the upstream pooling and normalization configuration, exports the FP32 graph, performs the documented INT8 quantization, runs ONNX validation and numerical parity checks, and refuses to complete unless both output files match their expected byte sizes and SHA-256 digests.
The exact verified INT8 digest is:
accb5b9e914356d01190c9f208ac822b345b24daeee4aa0fb345dfcc89a871d5
Bit-for-bit reproduction was confirmed in the pinned environment recorded in
PROVENANCE.json. Other operating systems, Python patch versions, or package
builds may produce a numerically equivalent graph with different serialized
bytes; such an output is not the release artifact unless its digest matches.
Twelve short, synthetic medical and general-language sentences were embedded
through the same Rust tokenizers plus ONNX Runtime path used by the add-on.
The resulting vectors were compared with:
| Export | Minimum cosine vs upstream | Mean cosine vs upstream | Maximum absolute element error |
|---|---|---|---|
| FP32 ONNX | 0.999999881 | 1.000000000 | 0.000000209 |
| INT8 ONNX | 0.995368898 | 0.997062981 | 0.015785374 |
Both exports returned finite 12 × 384 arrays. After the same final
normalization used by Smart Search, the maximum INT8 unit-norm error was
5.96e-8. This is an export-integrity sanity check on a small synthetic set.
It is not a clinical evaluation, a retrieval benchmark, or evidence that
quantization preserves every ranking on every collection.
import numpy as np
import onnxruntime as ort
from tokenizers import Tokenizer
tokenizer = Tokenizer.from_file("tokenizer.json")
tokenizer.enable_truncation(max_length=512)
tokenizer.enable_padding()
encodings = tokenizer.encode_batch(["What causes elevated creatinine?"])
feeds = {
"input_ids": np.asarray([item.ids for item in encodings], dtype=np.int64),
"attention_mask": np.asarray(
[item.attention_mask for item in encodings], dtype=np.int64
),
"token_type_ids": np.asarray(
[item.type_ids for item in encodings], dtype=np.int64
),
}
session = ort.InferenceSession(
"onnx/model_int8.onnx",
providers=["CPUExecutionProvider"],
)
embedding = session.run(["sentence_embedding"], feeds)[0]
This export is intended for local English-language semantic retrieval, such as finding related material within a user's own study notes. It produces text embeddings; it does not answer clinical questions or provide medical facts.
The model files contain no Anki collection data. In Smart Search, embedding inference runs locally. Downloading these public files may expose ordinary network metadata, such as an IP address and user agent, to the hosting provider; card text and search queries are not included in model download requests.
Prepared for the open-source Smart Search for Anki — Medical add-on. This repository is not affiliated with or endorsed by Anki or its authors.