Skip to content

feat: support first prepend scheme for metaspace - #2372

Merged
SBrandeis merged 8 commits into
feat/train_encode_splitfrom
feat/metaspace-prepend-first
Sep 11, 2026
Merged

feat: support first prepend scheme for metaspace#2372
SBrandeis merged 8 commits into
feat/train_encode_splitfrom
feat/metaspace-prepend-first

Conversation

@SBrandeis

@SBrandeis SBrandeis commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

TL;DR

  • Support prepend: "first" in Metaspace
  • Support split: false in Metaspace

Updated Oracle tests

@SBrandeis
SBrandeis marked this pull request as ready for review August 31, 2026 10:45

@ArthurZucker ArthurZucker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure we have no other way to accommodate?
Passing a cursor is prehemptive as normalizer will need them anyways to compute offsets, so would be more general / make more sense WDYT?

Comment thread tokenizers/tk-encode/src/normalizers/bert.rs Outdated
Comment thread tokenizers/tk-encode/src/normalizers/utils.rs Outdated
SBrandeis and others added 6 commits September 11, 2026 09:14
is_special_token only looked up self.vocab (the raw-form matcher), so an
added token with special: true and normalized: true (e.g. mpnet's <unk>,
distinct from the model's own [UNK]) was never recognised as special.
decode(ids, skip_special_tokens=true) then failed to drop it.

Found while investigating an oracle.rs divergence surfaced by rebasing
feat/metaspace-prepend-first: sentence-transformers/all-mpnet-base-v2
decoding "<unk>x" with skip=true diverged from the released crate.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ence-start flag

Normalizer::normalize takes the byte offset of its input within the sequence.
Metaspace with prepend: "first" acts when it is 0; the parallel encoder hands
over chunk.range.start; every other normalizer ignores it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@SBrandeis
SBrandeis force-pushed the feat/metaspace-prepend-first branch from 6a3d07c to 1435813 Compare September 11, 2026 07:16
@SBrandeis
SBrandeis merged commit 47cf4d0 into feat/train_encode_split Sep 11, 2026
15 checks passed
@SBrandeis
SBrandeis deleted the feat/metaspace-prepend-first branch September 11, 2026 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants