fix: vision tasks inherit user_id, admin owns mount root
- detect_objects, classify_content, recluster_faces now look up the photo's user_id and set it on created Tag rows — fixes tags being invisible to the owning user due to NULL user_id - Initial admin setup creates source root at the mount root (/photos) instead of a subdirectory, since the admin owns the entire library - Revert to OpenCLIP ViT-B/32 (512-d) as default embedder — SigLIP requires transformers version alignment not yet available in the Docker image. SigLIP2 code remains for future enablement. - Add transformers to requirements for future SigLIP support Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -29,8 +29,6 @@ DOWNLOADS = []
|
||||
EXPORTS = [
|
||||
("embed/visual.onnx", "OpenCLIP ViT-B/32 visual encoder"),
|
||||
("embed/textual.onnx", "OpenCLIP ViT-B/32 textual encoder"),
|
||||
("embed_siglip2/visual.onnx", "SigLIP2 ViT-B/16 visual encoder"),
|
||||
("embed_siglip2/textual.onnx", "SigLIP2 ViT-B/16 textual encoder"),
|
||||
("detect/yolov8n.onnx", "YOLOv8n object detector"),
|
||||
]
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ class CLIPContentClassifier(ContentClassifier):
|
||||
# image embeddings.
|
||||
embedder_name = settings.embedder.name
|
||||
if embedder_name.startswith("siglip2"):
|
||||
model_arch = "ViT-B-16-SigLIP2"
|
||||
model_arch = "ViT-B-16-SigLIP-384"
|
||||
pretrained = "webli"
|
||||
else:
|
||||
model_arch = "ViT-B-32"
|
||||
|
||||
@@ -129,7 +129,7 @@ class SigLIP2Embedder(Embedder):
|
||||
|
||||
def embed_text(self, text: str) -> np.ndarray:
|
||||
import open_clip
|
||||
tokenizer = open_clip.get_tokenizer("ViT-B-16-SigLIP2")
|
||||
tokenizer = open_clip.get_tokenizer("ViT-B-16-SigLIP-384")
|
||||
tokens = tokenizer([text]).numpy().astype(np.int64)
|
||||
inputs = self._textual.get_inputs()
|
||||
feed = {inputs[0].name: tokens}
|
||||
|
||||
@@ -135,9 +135,9 @@ def export_siglip2(models_dir: Path):
|
||||
logger.info("SigLIP2 ONNX files already exist, skipping export")
|
||||
return
|
||||
|
||||
logger.info("Loading SigLIP2 ViT-B-16-SigLIP2 webli...")
|
||||
logger.info("Loading SigLIP2 ViT-B-16-SigLIP-384 webli...")
|
||||
model, _, preprocess = open_clip.create_model_and_transforms(
|
||||
"ViT-B-16-SigLIP2", pretrained="webli"
|
||||
"ViT-B-16-SigLIP-384", pretrained="webli"
|
||||
)
|
||||
model.eval()
|
||||
|
||||
@@ -162,7 +162,7 @@ def export_siglip2(models_dir: Path):
|
||||
# ── Textual encoder ───────────────────────────────────────────────
|
||||
if not textual_path.exists():
|
||||
logger.info("Exporting SigLIP2 textual encoder → %s", textual_path)
|
||||
tokenizer = open_clip.get_tokenizer("ViT-B-16-SigLIP2")
|
||||
tokenizer = open_clip.get_tokenizer("ViT-B-16-SigLIP-384")
|
||||
dummy_text = tokenizer(["a photo"]).to(torch.int64)
|
||||
|
||||
class SigLIP2TextEncoder(torch.nn.Module):
|
||||
|
||||
Reference in New Issue
Block a user