Migrate embedding pipeline and model download to bread-onnx

OrtEmbedder's tokenize -> tensor build -> mean-pool -> L2-normalize
pipeline was near-byte-identical to breadmill's own OrtEmbedder (same
truncation, same actual_seq.min(mask.len()) padding guard, same 1e-10
epsilon) — now both share bread_onnx::embedding::EmbeddingSession (path
dependency for now, see the TODO in breadarrd/Cargo.toml). This crate
stays CPU-only (Provider::Cpu), matching its existing documented rationale.

ensure_model's reqwest-based download function is replaced with
bread_onnx::download::ensure_file (sync/ureq, matching breadmill's own
downloader and this workspace's bakery convention) dispatched via
spawn_blocking from this async context.

Builds and tests clean across the whole breadarr workspace: 205 passed, 1
pre-existing network-dependent test ignored, 0 failed.
This commit is contained in:
Breadway 2026-07-17 09:37:55 +08:00
parent d35d9a1703
commit 8a2936b8fd
4 changed files with 342 additions and 145 deletions

View file

@ -19,6 +19,8 @@ regex.workspace = true
serde_json.workspace = true
ort.workspace = true
tokenizers.workspace = true
# TODO(owner): switch to tag-pinned git dependency once bread-onnx is merged and tagged, matching the bread-theme pattern
bread-onnx = { path = "../../bread-ecosystem-fix-worktree/bread-onnx" }
scraper.workspace = true
chrono.workspace = true
fastrand.workspace = true