Created
December 23, 2025 15:35
-
-
Save davidmezzetti/23d8ddecd918c2b4f5c4d825860c1efc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from txtai import Embeddings | |
| from txtai.pipeline import HFOnnx | |
| # Export as quantized onnx model | |
| # Model Size = 1.1 MB! | |
| path = HFOnnx()( | |
| "neuml/biomedbert-hash-nano-embeddings", | |
| "pooling", "model.onnx", True | |
| ) | |
| # Load onnx model for similarity | |
| # No custom code anymore | |
| embeddings = Embeddings( | |
| path=path, | |
| tokenizer="neuml/biomedbert-hash-nano-embeddings" | |
| ) | |
| embeddings.similarity("cancer", ["tumor", "diabetes"]) | |
| # [(0, 0.8546434640884399), (1, -0.027852479368448257)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment