Skip to content

feat(pipeline+bindings): Support encoding pairs of sequences - #2237

Draft
SBrandeis wants to merge 1 commit into
feat/pipeline-python-apifrom
feat/pipeline-encoding-output
Draft

feat(pipeline+bindings): Support encoding pairs of sequences#2237
SBrandeis wants to merge 1 commit into
feat/pipeline-python-apifrom
feat/pipeline-encoding-output

Conversation

@SBrandeis

Copy link
Copy Markdown
Contributor

No description provided.

@SBrandeis
SBrandeis changed the base branch from main to feat/pipeline-python-api July 23, 2026 20:50

@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.

As much as I hate it, it is indeed used quite a lot

Comment on lines +642 to +644
TemplatePart::Specials { ids, type_id } if add_special_tokens => output.extend_from_slice(ids),
TemplatePart::Sequence { sequence_idx: SequenceIdx::First, type_id } => self.encode_single::<STAGE>(first, add_special_tokens, pre_tokens, scratch, output)?,
TemplatePart::Sequence { sequence_idx: SequenceIdx::Second, type_id } => self.encode_single::<STAGE>(second, add_special_tokens, pre_tokens, scratch, output)?,

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.

actually given the way we do close to 0 allocations now, this might be fine!
Packing the two sequences in a single str might not do it any good

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