• Stefy Lanza (nextime / spora )'s avatar
    embeddings: a file-based feature check that a pod could never pass (v0.3.84) · 810cb14b
    Stefy Lanza (nextime / spora ) authored
    `_is_bge_m3` keys off `sparse_linear.pt` -- the definitive signal for a
    multi-vector embedder, since plain dense models do not ship one. It asked
    `_resolve_repo_file`, which answers from the local disk and NEVER the
    network. Right for "give me the path", wrong for "does this exist", and
    the difference is invisible until the model has never been downloaded.
    
    On a rented pod it has never been downloaded. The pod is disposable and
    its cache starts empty, so the check ran before anything could satisfy
    it: on every pod, every time, bge-m3 loaded through the DENSE
    sentence-transformers path. The request for sparse was then refused with
    a 400 telling the caller to serve the model on the coderai-embeddings
    image -- which is the image it was already running on. Measured end to
    end on a real A40: 379 seconds, then that.
    
    `_repo_has_file` keeps the local answer first and, only when the file is
    not on disk, asks the Hub for the repo's file LIST: metadata, no
    download, cached once per process. Offline installs short-circuit on
    HF_HUB_OFFLINE, a local directory is taken as the whole answer (asking
    the Hub about a filesystem path would look up a stranger's model of the
    same name), and any failure answers False exactly as before -- a metadata
    lookup must never be able to fail a load.
    
    Needs a coderai-embeddings rebuild: this code runs on the pod.
    Co-Authored-By: 's avatarClaude Opus 5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01HXRMe9ZPUQCCCtBai9uqt3
    810cb14b
embeddings.py 105 KB