MCPcopy Create free account
hub / github.com/PaddlePaddle/Research / decode

Method decode

NLP/UNIMO/src/model/tokenization.py:222–232  ·  view source on GitHub ↗

bpe decoding

(self, tokens)

Source from the content-addressed store, hash-verified

220 return bpe_tokens
221
222 def decode(self, tokens):
223 """bpe decoding"""
224 decoded_tokens = []
225 for token in tokens:
226 if self.int_token.match(str(token)):
227 decoded_tokens.append(self.decoder[int(token)])
228 else:
229 decoded_tokens.append(str(token))
230 text = ''.join(decoded_tokens)
231 text = bytearray([self.byte_decoder[c] for c in text]).decode('utf-8', errors=self.errors)
232 return text
233
234 def decode_token(self, token):
235 """decode one token"""

Callers 15

get_page_statusMethod · 0.45
logFunction · 0.45
_find_cuda_homeFunction · 0.45
_get_nvcc_infoFunction · 0.45
_get_gpu_infoFunction · 0.45
get_sys_envFunction · 0.45
pickle_dumps_to_strMethod · 0.45
convert_to_unicodeFunction · 0.45
pickle_dumps_to_strMethod · 0.45
convert_to_unicodeFunction · 0.45
printable_textFunction · 0.45
__call__Method · 0.45

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected