[object Object]

← back to Dw Photo Capture

auto-data-snapshot: 2026-08-13T15:04:38 (4 data files) — visual-search/train/.gitignore visual-search/train/HANDOFF.md visual-search/train/__pycache__/finetune.cpython-312.pyc visual-search/train/__pycache__/finetune_aug.cpython-312.pyc

cbb714444987d541efbd8cbe7357e66ecf77ec9c · 2026-08-13 15:04:43 -0700 · auto-commit-fleet

Files touched

Diff

commit cbb714444987d541efbd8cbe7357e66ecf77ec9c
Author: auto-commit-fleet <steve@designerwallcoverings.com>
Date:   Thu Aug 13 15:04:43 2026 -0700

    auto-data-snapshot: 2026-08-13T15:04:38 (4 data files) — visual-search/train/.gitignore visual-search/train/HANDOFF.md visual-search/train/__pycache__/finetune.cpython-312.pyc visual-search/train/__pycache__/finetune_aug.cpython-312.pyc
---
 visual-search/train/.gitignore                     |   8 ---
 visual-search/train/HANDOFF.md                     |  63 ---------------------
 .../train/__pycache__/finetune.cpython-312.pyc     | Bin 9541 -> 0 bytes
 .../train/__pycache__/finetune_aug.cpython-312.pyc | Bin 10194 -> 0 bytes
 4 files changed, 71 deletions(-)

diff --git a/visual-search/train/.gitignore b/visual-search/train/.gitignore
deleted file mode 100644
index 5e96ddc..0000000
--- a/visual-search/train/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-venv/
-cache/
-ckpt/
-logs/
-manifest.tsv
-deploy_manifest.tsv
-deploy_embeddings.copy
-deploy_done.txt
diff --git a/visual-search/train/HANDOFF.md b/visual-search/train/HANDOFF.md
deleted file mode 100644
index ab7e6ad..0000000
--- a/visual-search/train/HANDOFF.md
+++ /dev/null
@@ -1,63 +0,0 @@
-# Handoff — wire the fine-tuned DW CLIP weights into visual search
-
-The overnight run fine-tunes `open_clip ViT-B-32` (laion2b) on the DW catalog and saves the
-weights to `visual-search/train/ckpt/dw_clip_ft.pt` (per-epoch: `dw_clip_ft_ep<N>.pt`).
-Same architecture + pretrained tag as the live search service, so the fine-tuned weights are a
-**drop-in replacement** — no code rewrite, just load the checkpoint over the base model.
-
-## 0. Confirm the run finished
-```sh
-cd ~/Projects/dw-photo-capture/visual-search/train
-tail -20 logs/overnight.log          # look for "OVERNIGHT RUN COMPLETE" or "DONE — final weights"
-ls -la ckpt/                          # dw_clip_ft.pt should exist (+ dw_clip_ft_ep*.pt)
-```
-If it stopped early (`max_hours`), `dw_clip_ft.pt` is still saved from the last step — usable.
-
-## 1. Sanity-check the fine-tuned model BEFORE shipping it
-The fine-tune can help OR (if LR was too high / too few images) drift. Verify it retrieves DW
-patterns at least as well as base CLIP. Quick check on this Mac:
-```sh
-./venv/bin/python - <<'PY'
-import torch, open_clip
-m,_,pp = open_clip.create_model_and_transforms("ViT-B-32", pretrained="laion2b_s34b_b79k")
-sd = torch.load("ckpt/dw_clip_ft.pt", map_location="cpu")
-print("missing/unexpected:", m.load_state_dict(sd, strict=False))   # should be [] / []
-print("loaded OK — logit_scale:", float(m.logit_scale))
-PY
-```
-`strict=False` must report no missing/unexpected keys. If it errors, the checkpoint arch drifted —
-stop and inspect (don't ship).
-
-## 2. Two ways to deploy (pick one)
-
-### A. Re-embed the catalog with the fine-tuned model (BEST — full benefit)
-The retrieval quality gain only shows if BOTH the query image AND the catalog are embedded by the
-SAME model. So re-embed with the fine-tuned weights:
-1. Copy `ckpt/dw_clip_ft.pt` to Kamatera `/root/public-projects/dwphoto/visual-search/dw_clip_ft.pt`.
-2. In `embed_catalog.py` AND `search_service.py`, after `create_model_and_transforms(...)`, add:
-   ```python
-   import torch, os
-   _ft = os.path.join(os.path.dirname(__file__), "dw_clip_ft.pt")
-   if os.path.exists(_ft): model.load_state_dict(torch.load(_ft, map_location="cpu"), strict=False)
-   ```
-3. Truncate + re-embed: this is a full re-embed (~255k images, ~4h on Kamatera CPU). Either
-   `TRUNCATE image_embeddings` then let `embed-daemon.sh` refill, or embed into a new table and
-   swap. **Gated** — it rewrites the whole visual index; do it deliberately, off-peak.
-4. `pm2 restart dwphoto-vsearch` + `curl :9914/reload`.
-
-### B. Query-side only (fast, partial benefit)
-Load the fine-tuned weights in `search_service.py` ONLY (step 2's snippet). The query image gets the
-DW-specialized embedding but the catalog is still base-CLIP → mismatched spaces, retrieval may be
-WORSE, not better. **Not recommended** unless you also do A. Mixing embedding models is the classic
-foot-gun here — same-model-both-sides is the rule.
-
-## 3. Rollback
-Keep the base model one line away: comment out the `load_state_dict` line and restart. The base
-embeddings in `image_embeddings` are unaffected unless you did A's re-embed — so before A, snapshot:
-`pg_dump ... -t image_embeddings > image_embeddings.bak.sql`.
-
-## TL;DR
-- Weights: `visual-search/train/ckpt/dw_clip_ft.pt` (drop-in ViT-B-32).
-- Right way: load them in BOTH `embed_catalog.py` + `search_service.py`, re-embed the catalog, restart vsearch.
-- Never mix: query and catalog must be embedded by the same model or retrieval degrades.
-- Gate the full re-embed (rewrites the index); snapshot `image_embeddings` first.
diff --git a/visual-search/train/__pycache__/finetune.cpython-312.pyc b/visual-search/train/__pycache__/finetune.cpython-312.pyc
deleted file mode 100644
index 0052d80..0000000
Binary files a/visual-search/train/__pycache__/finetune.cpython-312.pyc and /dev/null differ
diff --git a/visual-search/train/__pycache__/finetune_aug.cpython-312.pyc b/visual-search/train/__pycache__/finetune_aug.cpython-312.pyc
deleted file mode 100644
index dcebc76..0000000
Binary files a/visual-search/train/__pycache__/finetune_aug.cpython-312.pyc and /dev/null differ

← fe6cef3 auto-data-snapshot: 2026-08-13T04:16:27 (1 data files) — dat  ·  back to Dw Photo Capture  ·  auto-data-snapshot: 2026-08-14T03:45:50 (1 data files) — dat 36acc48 →