MCPcopy Index your code
hub / github.com/zai-org/CogView / encode

Method encode

data_utils/sp_tokenizer.py:82–83  ·  view source on GitHub ↗
(self, text)

Source from the content-addressed store, hash-verified

80 return word
81
82 def encode(self, text):
83 return [self.encoder.get(token, 1) for token in self.tokenize(text)]
84
85 def decode(self, tokens):
86 text = ''.join([self.decoder[token] for token in tokens])

Callers 3

EncodeAsIdsMethod · 0.45
__init__Method · 0.45
__getitem__Method · 0.45

Calls 1

tokenizeMethod · 0.95

Tested by

no test coverage detected