MCPcopy Create free account
hub / github.com/CERT-Lab/lora-sb / train_tokenize_function

Function train_tokenize_function

utils/data_utils.py:209–213  ·  view source on GitHub ↗
(examples, tokenizer, query, response)

Source from the content-addressed store, hash-verified

207 return dict(input_ids=input_ids, labels=labels)
208
209def train_tokenize_function(examples, tokenizer, query, response):
210 sources = [PROMPT.format_map(dict(instruction=instruction)) for instruction in examples[query]]
211 targets = [f"{output}{tokenizer.eos_token}" for output in examples[response]]
212 data_dict = preprocess(sources, targets, tokenizer)
213 return data_dict
214
215def load_and_preprocess_it(tokenizer, args):
216

Callers

nothing calls this directly

Calls 1

preprocessFunction · 0.85

Tested by

no test coverage detected