• 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
..
admin Loading commit data...
api Loading commit data...
backends Loading commit data...
broker Loading commit data...
cluster Loading commit data...
compose Loading commit data...
frontproxy Loading commit data...
models Loading commit data...
ocr Loading commit data...
openai Loading commit data...
pydantic Loading commit data...
queue Loading commit data...
tasks Loading commit data...
util Loading commit data...
__init__.py Loading commit data...
cli.py Loading commit data...
config.py Loading commit data...
main.py Loading commit data...
platform_paths.py Loading commit data...
system_app.py Loading commit data...