Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/THUDM/GLM
/ encode
Method
encode
data_utils/tokenization_gpt2.py:269–270 ·
view source on GitHub ↗
(self, text)
Source
from the content-addressed store, hash-verified
267
return
tokens
268
269
def
encode(self, text):
270
return
self.convert_tokens_to_ids(self.tokenize(text))
271
272
def
decode(self, tokens):
273
text =
''
.join([self.decoder[token]
for
token in tokens])
Callers
1
tokenize
Method · 0.45
Calls
2
convert_tokens_to_ids
Method · 0.95
tokenize
Method · 0.95
Tested by
no test coverage detected