MCPcopy Create free account
hub / github.com/OpenBitSys/BitDistiller / get_code_dataset

Function get_code_dataset

data/generation/data_utils.py:191–204  ·  view source on GitHub ↗
(max_sample, tokenizer)

Source from the content-addressed store, hash-verified

189 return extract_random_dataset(sources, targets, max_sample)
190
191def get_code_dataset(max_sample, tokenizer):
192 code_dataset = load_dataset("nickrosh/Evol-Instruct-Code-80k-v1", split='train')
193 # code_dataset = load_dataset('json', data_files="/root/model/datasets/code/EvolInstruct-Code-80k.json", split='train')
194
195 prompt_input, prompt_no_input = CODE_PROMPT_DICT["prompt_input"], CODE_PROMPT_DICT["prompt_no_input"]
196
197 sources = [
198 prompt_input.format_map(example) if example.get("input", "") != "" else prompt_no_input.format_map(example)
199 for example in code_dataset
200 ]
201
202 targets = [f"{example['output']}{tokenizer.eos_token}" for example in code_dataset]
203
204 return extract_random_dataset(sources, targets, max_sample)
205
206def get_math_dataset(max_sample, tokenizer):
207 math_dataset = load_dataset("meta-math/MetaMathQA-40K", split='train')

Callers 1

get_gen_datasetFunction · 0.85

Calls 1

extract_random_datasetFunction · 0.85

Tested by

no test coverage detected