Skip to content

Commit

Permalink
skip special
Browse files Browse the repository at this point in the history
  • Loading branch information
wenbingl committed Mar 7, 2025
1 parent 085efbd commit 04e452e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions operators/tokenizer/bpe_streaming.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,11 @@ class BpeStreamingDecoder : public KernelBpeDecoder {
}

OrtxStatus SpmId2Token(extTokenId_t id, std::string& token, bool& f_special_last) const {
bool f_special = all_special_ids_.count(id) ? true : false;
bool f_special = false;
if (added_tokens_.count(id)) {
token = added_tokens_.at(id);
f_special = all_special_ids_.count(id) ? true : false;
// special token was skipped
token = f_special ? "" : added_tokens_.at(id);
} else {
std::string piece = id < arr_vocab_.size() ? arr_vocab_[id] : "";
if (piece.empty()) {
Expand Down

0 comments on commit 04e452e

Please sign in to comment.