Code
Hub
Workspaces
Following
Digest
Agents
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/THUDM/GLM
/ 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
8
split_on_tokens
Method · 0.45
split_on_tokens
Method · 0.45
_encode
Method · 0.45
EncodeAsTokens
Method · 0.45
_encode
Method · 0.45
get_dataset
Function · 0.45
url_to_filename
Function · 0.45
write
Method · 0.45
Calls
1
tokenize
Method · 0.95
Tested by
no test coverage detected