MCPcopy Index your code
hub / github.com/THUDM/GLM / IdToToken

Method IdToToken

data_utils/tokenization.py:407–415  ·  view source on GitHub ↗

convert Id to token accounting for command and type tokens

(self, Id, type_token=False)

Source from the content-addressed store, hash-verified

405 return tokenization
406
407 def IdToToken(self, Id, type_token=False):
408 """convert Id to token accounting for command and type tokens"""
409 if isinstance(Id, (TypeToken, CommandToken)):
410 return Id.token
411 if type_token:
412 return self.type_id_map[Id].token
413 if Id < self.num_command_tokens:
414 return self.command_id_map[Id].token
415 return self.text_tokenizer.IdToToken(Id - self.num_command_tokens)
416
417 def TokenToId(self, token, type_token=False):
418 """convert token to Id accounting for command and type tokens"""

Callers 8

contains_sentence_endMethod · 0.45
debug_finetune_dataFunction · 0.45
print_masked_textFunction · 0.45
get_verbalization_idsFunction · 0.45
print_masked_textFunction · 0.45
contains_sentence_endMethod · 0.45
contains_sentence_endMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected