mirror of
https://github.com/openai/CLIP.git
synced 2026-11-05 01:37:26 +00:00
[GH-ISSUE #8] BPE tokenizer failed with punctuations in the sentence #8
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
openai/CLIP#8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @weiyx16 on GitHub (Jan 8, 2021).
Original GitHub issue: https://github.com/openai/CLIP/issues/8
When tokenizing a sentence with a punctuation at the end, the bpe tokenizer will fail to split the EOS token out. It will lead to the result that the
model.encode_text()function can't pick the correct token hidden states out from output of the last layer, for the picking method isargmax(id, dim=-1). I recommend to add a blank space before<|endoftext|>when creating a sentence.To reproduce the bug:
The tokens are:
And the token ids are:
@jongwook commented on GitHub (Jan 8, 2021):
Hi, Thanks for catching this - the example code was using the tokenizer incorrectly. Just pushed a fix that should resolve this problem; please feel free to reopen this issue if you encounter a similar problem again.
SimpleTokenizerfor SAM3 text tokenizer convenience #518