c6f38b0dac
Lift recall on small/local concepts (glasses, cum, stomach-bulge, xray, lactation) that the whole-image SigLIP vector washes out: the GPU agent now embeds figure crops with SigLIP too, stored as kind='concept' regions, and the suggestion rail scores each image as a BAG (whole-image + every concept crop), taking each head's MAX over the bag. The whole-image vector is always in the bag, so this can never score lower than before. Model-agnostic by construction: the server ANNOUNCES the embedding model (HF name + version) in the lease, so the agent loads whatever the heads were trained in and stays in lock-step — a model swap is a server setting + a re-embed migration, never an agent change. - agent: model-agnostic CropEmbedder (torch/transformers get_image_features, fp16 on CUDA, inference-locked); worker branches on job.task — 'ccip' emits figure(CCIP)+concept(SigLIP) in one pass, 'siglip' emits concept-only so the back-catalogue backfill never churns figure/CCIP regions; torch cu124 + transformers in the image. - server: lease announces embed_model_name/embed_version; score_image is max-over-bag (version-filtered region embeddings); enqueue_gpu_backfill 'siglip' gates on a missing concept region (drains the back-catalogue, retries failures, no double-enqueue); daily siglip-backfill beat; UI button; /api/ccip/overview reports images_with_concept_siglip. - v1 scope: suggestion rail only — auto-apply stays whole-image (conservative; heads' thresholds were calibrated on whole-image). Bulk-apply bag = follow-up. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ttrj5P7upUTueSfoJcxEqa
34 lines
1.6 KiB
Python
34 lines
1.6 KiB
Python
"""Agent config, all from env (the control container is configured at run)."""
|
|
import os
|
|
from dataclasses import dataclass
|
|
|
|
|
|
@dataclass
|
|
class Config:
|
|
fc_url: str # base URL of the FabledCurator web service
|
|
token: str # the bearer token from Settings → Tagging → GPU agent
|
|
agent_id: str # identifies this agent's leases
|
|
batch_size: int # jobs a worker leases per round
|
|
concurrency: int # INITIAL parallel workers (tunable live from the UI)
|
|
ccip_model: str # imgutils CCIP model name ("" → imgutils default)
|
|
detector_level: str # imgutils person-detector level: n|s|m|x
|
|
poll_idle_seconds: float # wait between empty leases
|
|
embed_dtype: str # torch dtype for the crop embedder: float16|float32
|
|
embed_model_override: str # force a SigLIP-family model ("" → use the one
|
|
# the server announces in the lease)
|
|
|
|
@classmethod
|
|
def from_env(cls) -> "Config":
|
|
return cls(
|
|
fc_url=os.environ.get("FC_URL", "http://localhost:8000").rstrip("/"),
|
|
token=os.environ.get("FC_TOKEN", ""),
|
|
agent_id=os.environ.get("AGENT_ID", "desktop-agent"),
|
|
batch_size=int(os.environ.get("BATCH_SIZE", "4")),
|
|
concurrency=int(os.environ.get("CONCURRENCY", "1")),
|
|
ccip_model=os.environ.get("CCIP_MODEL", ""),
|
|
detector_level=os.environ.get("DETECTOR_LEVEL", "m"),
|
|
poll_idle_seconds=float(os.environ.get("POLL_IDLE_SECONDS", "10")),
|
|
embed_dtype=os.environ.get("SIGLIP_DTYPE", "float16"),
|
|
embed_model_override=os.environ.get("EMBED_MODEL_NAME", ""),
|
|
)
|