Code
Hub
Workspaces
Connect
Indexed graphs
Engine
MCP
copy
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
EncodeAsIds
Method · 0.45
__init__
Method · 0.45
__getitem__
Method · 0.45
Calls
1
tokenize
Method · 0.95
Tested by
no test coverage detected