MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / decode_sentencepiece

Function decode_sentencepiece

src/framework/tokenizers/sentencepiece.cpp:127–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127std::string decode_sentencepiece(
128 const std::vector<SentencePiecePiece> & pieces,
129 const std::vector<int32_t> & token_ids) {
130 const auto processor = lookup_processor_for_pieces(pieces);
131 std::vector<int> ids;
132 ids.reserve(token_ids.size());
133 for (const int32_t id : token_ids) {
134 ids.push_back(static_cast<int>(id));
135 }
136 std::string output;
137 require_status(processor->Decode(ids, &output), "failed to decode with SentencePiece");
138 return output;
139}
140
141SentencePieceTokenizer::SentencePieceTokenizer(std::vector<SentencePiecePiece> pieces)
142 : pieces_(std::move(pieces)) {}

Callers

nothing calls this directly

Calls 4

require_statusFunction · 0.85
sizeMethod · 0.45
DecodeMethod · 0.45

Tested by

no test coverage detected