• Stefy Lanza (nextime / spora )'s avatar
    embeddings: chunk against the model's REAL window, and report it everywhere (v0.3.74) · bd855536
    Stefy Lanza (nextime / spora ) authored
    Two gaps in 0.3.72/73, both of which left chunking looking enabled while doing
    nothing useful.
    
    THE THRESHOLD WAS A NUMBER SOMEONE TYPED.
    
        max_len = int(_emb_cfg.get('n_ctx') or _raw.get('n_ctx') or 8192)
    
    Set n_ctx above what the model accepts and the windows are built too big; the
    tokenizer then truncates each window at its real limit anyway and chunking
    silently stops protecting anything -- the same invisible loss this code exists
    to remove, reached through a config typo instead of a missing feature. The
    window is now min(configured, tokenizer.model_max_length), with one trap
    handled: HuggingFace sets model_max_length to a sentinel near 1e30 when the
    checkpoint declares none, and believing that means never chunking at all, so a
    value that large is read as "unknown" and the caller's number stands. Same clamp
    on the sentence-transformers path, taking the smaller of max_seq_length and the
    tokenizer's own limit.
    
    THE MULTI-VECTOR PATH COLLECTED THE COUNTS AND DROPPED THEM. It builds its own
    response, so the dense path's report did not cover it -- chunking was invisible
    on exactly the path that needs it most, which is the bug this feature was
    written to fix. It now reports
    
        "chunked": {"windows": [...], "pool": ..., "token_limit": N}
    
    and logs the limit with the merges applied. `token_limit` is deliberate: it is
    what makes a WRONG n_ctx visible rather than merely ineffective.
    
    46 tests. Suite at the 25 pre-existing failures.
    Co-Authored-By: 's avatarClaude Opus 5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01HXRMe9ZPUQCCCtBai9uqt3
    bd855536
Name
Last commit
Last update
codai Loading commit data...
docs Loading commit data...
packaging Loading commit data...
samples Loading commit data...
tests Loading commit data...
third_party Loading commit data...
tools Loading commit data...
.dockerignore Loading commit data...
.gitignore Loading commit data...
AI.PROMPT Loading commit data...
CODERAI_API_DOCUMENTATION.md Loading commit data...
CoderAI.gif Loading commit data...
DISTRIBUTION.md Loading commit data...
LICENSE.md Loading commit data...
MULTIMODAL_CAPABILITIES.md Loading commit data...
MULTIMODAL_UI_EXAMPLES.md Loading commit data...
README.md Loading commit data...
REQUEST-geoclip-embeddings.md Loading commit data...
REQUEST-vpr-embeddings.md Loading commit data...
amdgpu-coredump-05000.bin Loading commit data...
build-oci.sh Loading commit data...
build.ps1 Loading commit data...
build.sh Loading commit data...
coderai Loading commit data...
coderai-broker-implementation-reference.md Loading commit data...
coderai-integration.md Loading commit data...
commands Loading commit data...
osxbuild.sh Loading commit data...
package-oci.sh Loading commit data...
package-tarball.sh Loading commit data...
requirements-crisperwhisper.txt Loading commit data...
requirements-h3.txt Loading commit data...
requirements-longcat-train.txt Loading commit data...
requirements-longcat.txt Loading commit data...
requirements-melotts.txt Loading commit data...
requirements-nemo.txt Loading commit data...
requirements-nvidia.txt Loading commit data...
requirements-ocr-paddle.txt Loading commit data...
requirements-ocr.txt Loading commit data...
requirements-pyannote.txt Loading commit data...
requirements-surya.txt Loading commit data...
requirements-vllm.txt Loading commit data...
requirements-vulkan.txt Loading commit data...
requirements.txt Loading commit data...
run-oci.sh Loading commit data...
smoke-test-oci.sh Loading commit data...
todo.md Loading commit data...