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

Class ProcessorTokenizer

data_utils/lazy_loader.py:104–119  ·  view source on GitHub ↗

callable class that runs a preprocessing, as well as tokenization step, on input text.

Source from the content-addressed store, hash-verified

102
103
104class ProcessorTokenizer:
105 """
106 callable class that runs a preprocessing, as well as tokenization step,
107 on input text.
108 """
109
110 def __init__(self, tokenizer, process_fn=None):
111 self.tokenizer = tokenizer
112 self.process_fn = process_fn
113
114 def __call__(self, string):
115 if self.tokenizer is not None:
116 string = self.tokenizer(string, process_fn=self.process_fn)
117 elif self.process_fn is not None:
118 string = self.process_fn(string)
119 return string
120
121
122class LazyLoader(object):

Callers 1

SetTokenizerMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected