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

Method extend

data_utils/tokenization.py:126–141  ·  view source on GitHub ↗
(self, other)

Source from the content-addressed store, hash-verified

124 return self
125
126 def extend(self, other):
127 if isinstance(other, (CommandToken, TypeToken)):
128 self.tokenization.append(other.Id)
129 self.text += other.token
130 self.original_text += other.token
131 elif isinstance(other, list) and isinstance(other[0], (CommandToken, TypeToken)):
132 self.tokenization.extend([o.Id for o in other])
133 self.text += [o.token for o in other]
134 self.original_text += [o.token for o in other]
135 elif isinstance(other, Tokenization):
136 self.tokenization.extend(other.tokenization)
137 self.text += other.text
138 self.original_text += other.original_text
139 else:
140 self.tokenization.extend(other)
141 return self
142
143
144"""define some default command tokens for the tokenizer to use"""

Callers 15

build_uni_input_from_idsFunction · 0.80
build_input_from_idsFunction · 0.80
build_decoder_inputFunction · 0.80
classify_evaluateFunction · 0.80
bpeMethod · 0.80
tokenizeMethod · 0.80
appendMethod · 0.80
split_on_tokensMethod · 0.80
__init__Method · 0.80
__init__Method · 0.80
split_on_tokensMethod · 0.80

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected