Skip to content
This repository was archived by the owner on Jul 20, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove unused imports and increase K values
  • Loading branch information
Indraneil Paul Indraneil Paul
Indraneil Paul authored and Indraneil Paul committed May 26, 2024
commit 2c33a263d7c39b4167e4307c9093248ebd03b7d5
2 changes: 0 additions & 2 deletions wildcode/eval/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@
import faulthandler
import io
import os
import sys
import platform
import signal
import tempfile
import subprocess
import threading
import multiprocessing
from typing import Optional

Expand Down
2 changes: 1 addition & 1 deletion wildcode/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def stucking_checker():

pass_at_k = {
f"pass@{k}": estimate_pass_at_k(total, base_correct, k).mean()
for k in [1, 5, 10]
for k in [1, 5, 10, 25, 100]
if total.min() >= k
}
cprint(f"{flags.dataset}", "green")
Expand Down
19 changes: 10 additions & 9 deletions wildcode/gen/util/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import time
import os
import sys
import types
import unittest
import builtins

from copy import deepcopy

from wildcode.eval.utils import (
create_tempdir,
Expand All @@ -14,14 +10,16 @@
time_limit,
safe_environment,
)


def trusted_exec(code, test_code, task_id):
"""Execute trusted code in place."""

with create_tempdir():
import os
import shutil
import builtins

rmtree = shutil.rmtree
rmdir = os.rmdir
chdir = os.chdir
Expand All @@ -44,7 +42,8 @@ def trusted_exec(code, test_code, task_id):
full_code = code + "\n" + test_code

# Compile and execute the combined code within the new module
exec(compile(full_code, f"{module_name}.py", 'exec'), new_module.__dict__)
exec(compile(full_code, f"{module_name}.py", 'exec'),
new_module.__dict__)
sys.modules[module_name] = new_module
TestCases = getattr(new_module, 'TestCases')
loader = unittest.TestLoader()
Expand All @@ -59,8 +58,10 @@ def trusted_exec(code, test_code, task_id):
shutil.rmtree = rmtree
os.rmdir = rmdir
os.chdir = chdir
assert len(test_result.failures+test_result.errors) == 0, f"{task_id} failed"

assert len(
test_result.failures + test_result.errors
) == 0, f"{task_id} failed with errors: {test_result.errors} and failures: {test_result.failures}"

return time.time() - start

def trusted_check_exec(code, inputs):
Expand Down
1 change: 0 additions & 1 deletion wildcode/inspect.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from wildcode.data import get_wildcodebench
import sys
import os
import shutil
import json
Expand Down
199 changes: 0 additions & 199 deletions wildcode/lecacy_sanitize.py

This file was deleted.

1 change: 0 additions & 1 deletion wildcode/sanitize.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Post-processing LLM-generated Python code implemented using tree-sitter."""

import os
import ast
import pathlib
from typing import Dict, Generator, List, Optional, Set, Tuple

Expand Down