DylanCouzon commited on
Commit
1aa6041
·
verified ·
1 Parent(s): f547998

zero v1 — M7 lookup table, run p35w-2m-s2500

Browse files
Files changed (2) hide show
  1. README.md +3 -2
  2. zero_encoder.py +4 -0
README.md CHANGED
@@ -137,7 +137,8 @@ Precisely what that changes, by caller:
137
  |---|---|---|
138
  | `zero_encoder.py` (the reference path) | 512, no padding | unchanged — **byte-identical output**; it calls `no_padding()` and reads truncation from `config.json` |
139
  | `tokenizers` directly | every `encode` padded to 512 | ragged unless you enable padding yourself |
140
- | `transformers` / Sentence Transformers | `model_max_length` 32768, so `truncation=True` with no explicit length truncated at 32768 | 512 — but truncation and padding still happen only when the *call* asks for them |
 
141
  | fastembed's tokenizer loader | truncation 8000, fixed-512 padding kept | truncation 512, dynamic padding |
142
 
143
  The reference path is unaffected either way, so no published number changes; only what a
@@ -220,7 +221,7 @@ Amazon ESCI is Apache-2.0. The teacher, `NovaSearch/stella_en_400M_v5`, is MIT.
220
  | | |
221
  |---|---|
222
  | first published | 2026-09-03 — the frozen M7 bundle, with stella's tokenizer files copied verbatim |
223
- | this revision | 2026-09-03 — `tokenizer_config.json` `model_max_length`/`max_length` → 512, `tokenizer.json` `padding` → `null`, and one broken snippet in this card fixed |
224
 
225
  `model.npz` is byte-identical across both (sha `a7007b1a…`) and the reference encoder's output is
226
  unchanged, so **no published number differs between revisions**. Pass `revision=` to
 
137
  |---|---|---|
138
  | `zero_encoder.py` (the reference path) | 512, no padding | unchanged — **byte-identical output**; it calls `no_padding()` and reads truncation from `config.json` |
139
  | `tokenizers` directly | every `encode` padded to 512 | ragged unless you enable padding yourself |
140
+ | `transformers` | `model_max_length` 32768, so `truncation=True` with no explicit length truncated at 32768 | 512 — but truncation and padding still happen only when the *call* asks for them |
141
+ | Sentence Transformers | requests truncation itself and may impose its own `max_seq_length` | unchanged in that respect; only the underlying default moves to 512 |
142
  | fastembed's tokenizer loader | truncation 8000, fixed-512 padding kept | truncation 512, dynamic padding |
143
 
144
  The reference path is unaffected either way, so no published number changes; only what a
 
221
  | | |
222
  |---|---|
223
  | first published | 2026-09-03 — the frozen M7 bundle, with stella's tokenizer files copied verbatim |
224
+ | this revision | 2026-09-03, commit `f5479985` — `tokenizer_config.json` `model_max_length`/`max_length` 32768/8000 → 512, `tokenizer.json` `padding` `Fixed(512)` → `null`, and one broken snippet in this card fixed |
225
 
226
  `model.npz` is byte-identical across both (sha `a7007b1a…`) and the reference encoder's output is
227
  unchanged, so **no published number differs between revisions**. Pass `revision=` to
zero_encoder.py CHANGED
@@ -47,6 +47,10 @@ class ZeroQueryEncoder:
47
  self.variant = variant
48
 
49
  self.tokenizer = Tokenizer.from_file(str(d / "tokenizer.json"))
 
 
 
 
50
  self.tokenizer.enable_truncation(max_length=self.max_length)
51
  # stella's tokenizer.json ships with padding-to-512 enabled. Padding would put ~500
52
  # [PAD] rows into every bag; the frozen path (transformers, padding off) never sees one.
 
47
  self.variant = variant
48
 
49
  self.tokenizer = Tokenizer.from_file(str(d / "tokenizer.json"))
50
+ n = self.tokenizer.get_vocab_size(with_added_tokens=True)
51
+ if n != self.rows.shape[0]:
52
+ raise ValueError(f"tokenizer has {n} tokens but the table has {self.rows.shape[0]} "
53
+ "rows; a token id outside the table would index off the end")
54
  self.tokenizer.enable_truncation(max_length=self.max_length)
55
  # stella's tokenizer.json ships with padding-to-512 enabled. Padding would put ~500
56
  # [PAD] rows into every bag; the frozen path (transformers, padding off) never sees one.