MCPcopy Index your code
hub / github.com/zai-org/CodeGeeX2 / postprocess_generation

Function postprocess_generation

evaluation/evaluation.py:29–40  ·  view source on GitHub ↗
(sample, generation_mode="completion")

Source from the content-addressed store, hash-verified

27
28
29def postprocess_generation(sample, generation_mode="completion"):
30 code = sample["generation"]
31 if generation_mode == "instruction":
32 if "```" in code:
33 pattern = r'```(.*?)\n(.*?)```'
34 matches = re.findall(pattern, code, re.DOTALL)
35 for match in matches:
36 code = match[1]
37 break
38 sample["generation"] = code
39
40 return sample
41
42
43def process_test(sample, problems, dataset_type, language_type, generation_mode):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected