MCPcopy Create free account
hub / github.com/THUDM/GLM / EncodeAsTokens

Method EncodeAsTokens

data_utils/tokenization.py:399–405  ·  view source on GitHub ↗

encode text as tokens using text tokenizer

(self, text, process_fn=None)

Source from the content-addressed store, hash-verified

397 raise NotImplementedError
398
399 def EncodeAsTokens(self, text, process_fn=None):
400 """
401 encode text as tokens using text tokenizer
402 """
403 tokenization = self.text_tokenizer.EncodeAsTokens(text, process_fn=process_fn)
404 tokenization.set_command_tokens(self._command_tokens)
405 return tokenization
406
407 def IdToToken(self, Id, type_token=False):
408 """convert Id to token accounting for command and type tokens"""

Callers 1

EncodeAsTokensMethod · 0.45

Calls 1

set_command_tokensMethod · 0.80

Tested by

no test coverage detected