feat(ml): default to SigLIP 2 (new installs) + model dropdown, no free-text (#1203)
CI / lint (push) Successful in 2s
CI / frontend-build (push) Successful in 21s
CI / backend-lint-and-test (push) Successful in 27s
CI / integration (push) Successful in 3m25s

- Migration 0069: new installs default to SigLIP 2 (so400m, 512px, 1152-d drop-in)
  — UPDATE applies ONLY where no image is embedded yet (fresh install), so an
  existing library is NOT silently invalidated; it switches deliberately via the
  dropdown → Re-embed → Retrain. Column server_defaults moved to SigLIP 2.
- GET /api/ml/embedder-models: server-authoritative supported list (SigLIP 2 512
  recommended / 384 faster / SigLIP 1 384 original) so the UI never free-types.
- GpuAgentCard: the two name/version text fields → a single model dropdown;
  Save sets name+version from the picked option (the current model is always
  selectable even if off-list).
- embedder.py DEFAULT_MODEL_NAME unchanged (stays the baked local-dir SigLIP 1)
  to avoid a local-dir/weights mismatch; SigLIP 2 loads by HF name, cached on the
  ml-worker's persistent HF_HOME.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ttrj5P7upUTueSfoJcxEqa
This commit is contained in:
2026-06-30 16:29:27 -04:00
parent 80f8eb4756
commit 359bc5a283
6 changed files with 133 additions and 31 deletions
+17 -8
View File
@@ -34,25 +34,34 @@ async def test_get_and_patch_settings(client):
@pytest.mark.asyncio
async def test_embedder_model_settable_and_empty_rejected(client):
# #1190: the embedder model name + version are operator-settable (a swap),
# and neither may be blanked.
async def test_embedder_model_default_settable_and_empty_rejected(client):
# #1203: fresh installs default to SigLIP 2 (migration 0069, no embeddings).
# The model is operator-settable (a swap) and neither field may be blanked.
body = await (await client.get("/api/ml/settings")).get_json()
assert body["embedder_model_name"] == "google/siglip-so400m-patch14-384"
assert body["embedder_model_name"] == "google/siglip2-so400m-patch16-512"
ok = await client.patch("/api/ml/settings", json={
"embedder_model_name": "google/siglip2-so400m-patch16-512",
"embedder_model_version": "siglip2-so400m-patch16-512",
"embedder_model_name": "google/siglip-so400m-patch14-384",
"embedder_model_version": "siglip-so400m-patch14-384",
})
assert ok.status_code == 200
out = await ok.get_json()
assert out["embedder_model_name"] == "google/siglip2-so400m-patch16-512"
assert out["embedder_model_version"] == "siglip2-so400m-patch16-512"
assert out["embedder_model_name"] == "google/siglip-so400m-patch14-384"
bad = await client.patch("/api/ml/settings", json={"embedder_model_name": " "})
assert bad.status_code == 400
@pytest.mark.asyncio
async def test_embedder_models_list(client):
# #1203: the dropdown reads the supported-model list from the server.
body = await (await client.get("/api/ml/embedder-models")).get_json()
assert any(
m["name"] == "google/siglip2-so400m-patch16-512" for m in body["models"]
)
assert all({"name", "version", "label"} <= set(m) for m in body["models"])
@pytest.mark.asyncio
async def test_video_settings_default_and_patch(client):
"""#747: video frame-sampling knobs are exposed + patchable."""