MCPcopy Create free account
hub / github.com/JinjieNi/MegaDLMs / split

Method split

tools/preprocess_data.py:77–85  ·  view source on GitHub ↗
(self, json_line)

Source from the content-addressed store, hash-verified

75 Encoder.splitter = IdentitySplitter()
76
77 def split(self, json_line):
78 data = json.loads(json_line)
79 output = {}
80 for key in self.args.json_keys:
81 text = data[key]
82 max_len = 1000000
83 tokens_list = [Encoder.splitter.tokenize(text[i:i+max_len]) for i in range(0, len(text), max_len)]
84 output[key] = [tokens for partial in tokens_list for tokens in partial]
85 return json.dumps(output), len(json_line)
86
87 def encode(self, json_line):
88 data = json.loads(json_line)

Callers 15

setup.pyFile · 0.80
get_datadirs_and_weightsFunction · 0.80
generate_samplesFunction · 0.80
rearrange_qkvFunction · 0.80
convert_wqkvFunction · 0.80
convert_wqkv_biasFunction · 0.80
convert_ffnFunction · 0.80
permute_qkvFunction · 0.80
permute_qkv_biasFunction · 0.80

Calls 1

tokenizeMethod · 0.45

Tested by 12

test_parallel_embeddingFunction · 0.64
test_row_parallel_linearFunction · 0.64
import_class_by_pathFunction · 0.64
get_objectMethod · 0.64
test_bin_readerFunction · 0.64
do_test_preprocess_dataFunction · 0.64