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

Method tokenize_worker

data_utils/corpora.py:190–199  ·  view source on GitHub ↗
(self, input, output, info, tokenizer, tokenize)

Source from the content-addressed store, hash-verified

188 is_json = True
189
190 def tokenize_worker(self, input, output, info, tokenizer, tokenize):
191 for row in iter(input.get, 'STOP'):
192 if row:
193 if self.is_json:
194 row = row.rstrip()
195 row = json.loads(row)
196 prompts, texts = self.process_line(row, tokenizer, tokenize)
197 for prompt, text in zip(prompts, texts):
198 output.put((prompt, text))
199 output.put("COMPLETE")
200
201 @staticmethod
202 def write_result(data, writers):

Callers

nothing calls this directly

Calls 1

process_lineMethod · 0.45

Tested by

no test coverage detected