(gzip_url, cache_path)
| 25 | |
| 26 | |
| 27 | def make_cache(gzip_url, cache_path): |
| 28 | # Check if human eval file exists in CACHE_DIR |
| 29 | if not os.path.exists(cache_path): |
| 30 | # Install HumanEval dataset and parse as jsonl |
| 31 | print(f"Downloading dataset from {gzip_url}") |
| 32 | with tempdir.TempDir() as tmpdir: |
| 33 | plus_gz_path = os.path.join(tmpdir, f"data.jsonl.gz") |
| 34 | wget.download(gzip_url, plus_gz_path) |
| 35 | |
| 36 | with gzip.open(plus_gz_path, "rb") as f: |
| 37 | plus = f.read().decode("utf-8") |
| 38 | |
| 39 | # create CACHE_DIR if not exists |
| 40 | if not os.path.exists(CACHE_DIR): |
| 41 | os.makedirs(CACHE_DIR) |
| 42 | |
| 43 | # Write the original human eval file to CACHE_DIR |
| 44 | with open(cache_path, "w") as f: |
| 45 | f.write(plus) |
| 46 | |
| 47 | |
| 48 | def write_jsonl( |
no test coverage detected