MCPcopy
hub / github.com/deepspeedai/DeepSpeedExamples / append

Method append

Megatron-LM/data_utils/tokenization.py:102–113  ·  view source on GitHub ↗
(self, other)

Source from the content-addressed store, hash-verified

100 self.tokenization = self.tokenization[:idx] + other.tokenization + self.tokenization[idx:]
101
102 def append(self, other):
103 if isinstance(other, (CommandToken, TypeToken)):
104 self.tokenization.append(other.Id)
105 self.text += other.token
106 self.original_text += other.token
107 elif isinstance(other, Tokenization):
108 self.tokenization.extend(other.tokenization)
109 self.text += other.text
110 self.original_text += other.original_text
111 else:
112 self.tokenization.append(other)
113 return self
114
115 def extend(self, other):
116 if isinstance(other, (CommandToken, TypeToken)):

Callers 15

get_train_datasetFunction · 0.80
load_tf_weights_in_bertFunction · 0.80
forwardMethod · 0.80
from_pretrainedMethod · 0.80
get_lrMethod · 0.80
stepMethod · 0.80
get_lrMethod · 0.80
tokenizeMethod · 0.80
convert_tokens_to_idsMethod · 0.80
convert_ids_to_tokensMethod · 0.80
_run_strip_accentsMethod · 0.80
_run_split_on_puncMethod · 0.80

Calls 1

extendMethod · 0.80

Tested by

no test coverage detected