Download src/datasets/HumanEvalDataset.py from smallan13/DebateCoder: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/smallan13/DebateCoder/resolve/c7a0d4bb35b29abc02cb9891bd19979bf3eab7ad/src/datasets/HumanEvalDataset.py
- Command line
-
hf download hf://smallan13/DebateCoder@c7a0d4bb35b29abc02cb9891bd19979bf3eab7ad/src/datasets/HumanEvalDataset.py
-
curl -L -o HumanEvalDataset.py https://huggingface.co/smallan13/DebateCoder/resolve/c7a0d4bb35b29abc02cb9891bd19979bf3eab7ad/src/datasets/HumanEvalDataset.py
1.07 kB
| from .Dataset import Dataset | |
| from evaluations.func_evaluate import evaluate_functional_correctness, evaluate_io | |
| from constants.paths import * | |
| class HumanDataset(Dataset): | |
| def __init__( | |
| self, | |
| path: str = HUMAN_WST_DATA_PATH, | |
| ): | |
| super().__init__(path) | |
| self.id_key = "task_id" | |
| def evaluate( | |
| self, | |
| item: dict, | |
| cur_imp: str, | |
| language: str, | |
| ): | |
| result = evaluate_functional_correctness( | |
| problem=item, | |
| completion=cur_imp | |
| ) | |
| return result == "passed" | |
| def evaluate_sample_io( | |
| self, | |
| item: dict, | |
| cur_imp: str, | |
| language: str, | |
| ): | |
| return evaluate_io( | |
| sample_io=item["sample_io"], | |
| completion=cur_imp, | |
| ) | |
| def get_prompt(item): | |
| if "prompt" in item: | |
| return f"{item['prompt']}" | |
| elif "text" in item: | |
| return f"{item['text']}" | |
| else: | |
| raise Exception("No prompt or text in item") | |