MCPcopy Index your code
hub / github.com/Vision-CAIR/VisualGPT / encode

Method encode

data/encoder.py:100–105  ·  view source on GitHub ↗
(self, text)

Source from the content-addressed store, hash-verified

98 return word
99
100 def encode(self, text):
101 bpe_tokens = []
102 for token in re.findall(self.pat, text):
103 token = ''.join(self.byte_encoder[b] for b in token.encode('utf-8'))
104 bpe_tokens.extend(self.encoder[bpe_token] for bpe_token in self.bpe(token).split(' '))
105 return bpe_tokens
106
107 def decode(self, tokens):
108 text = ''.join([self.decoder[token] for token in tokens])

Callers 8

_tokenizeMethod · 0.45
url_to_filenameFunction · 0.45
tokenizeMethod · 0.45
_batch_encode_plusMethod · 0.45
numericalizeMethod · 0.45
tokenizeMethod · 0.45
compute_scoreMethod · 0.45
_statMethod · 0.45

Calls 2

bpeMethod · 0.95
extendMethod · 0.45

Tested by

no test coverage detected