human-eval-rust 2.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HumanEval_rust.jsonl +164 -0
- data/HumanEval_rust_extended.jsonl +2 -0
- data/example_rust_problem.jsonl +1 -0
- data/example_rust_samples.jsonl +4 -0
- human_eval/__init__.py +23 -0
- human_eval/data.py +74 -0
- human_eval/evaluate_functional_correctness.py +112 -0
- human_eval/evaluation.py +281 -0
- human_eval/execution.py +186 -0
- human_eval/logging_config.py +43 -0
- human_eval/resource_monitor.py +58 -0
- human_eval/rust_execution.py +802 -0
- human_eval/sandbox.py +586 -0
- human_eval_rust-2.1.0.dist-info/METADATA +488 -0
- human_eval_rust-2.1.0.dist-info/RECORD +19 -0
- human_eval_rust-2.1.0.dist-info/WHEEL +5 -0
- human_eval_rust-2.1.0.dist-info/entry_points.txt +2 -0
- human_eval_rust-2.1.0.dist-info/licenses/LICENSE +21 -0
- human_eval_rust-2.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Logging configuration for HumanEval Rust evaluation.
|
|
3
|
+
|
|
4
|
+
Provides structured logging setup for CLI and library usage.
|
|
5
|
+
|
|
6
|
+
Copyright (c) 2025 Dave Tofflemire, SigilDERG Project
|
|
7
|
+
Version: 2.1.0
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import logging
|
|
11
|
+
import sys
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def setup_logging(
|
|
15
|
+
level: int = logging.INFO, json_format: bool = False
|
|
16
|
+
) -> logging.Logger:
|
|
17
|
+
"""Configure logging for human-eval-rust."""
|
|
18
|
+
|
|
19
|
+
logger = logging.getLogger("human_eval")
|
|
20
|
+
logger.setLevel(level)
|
|
21
|
+
|
|
22
|
+
handler = logging.StreamHandler(sys.stderr)
|
|
23
|
+
if json_format:
|
|
24
|
+
formatter = logging.Formatter(
|
|
25
|
+
'{"time": "%(asctime)s", "level": "%(levelname)s", '
|
|
26
|
+
'"module": "%(module)s", "message": "%(message)s"}'
|
|
27
|
+
)
|
|
28
|
+
else:
|
|
29
|
+
formatter = logging.Formatter(
|
|
30
|
+
"%(asctime)s [%(levelname)s] %(module)s: %(message)s"
|
|
31
|
+
)
|
|
32
|
+
handler.setFormatter(formatter)
|
|
33
|
+
if not logger.handlers:
|
|
34
|
+
logger.addHandler(handler)
|
|
35
|
+
|
|
36
|
+
return logger
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
# Module-level logger for convenience imports
|
|
40
|
+
logger = logging.getLogger("human_eval")
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
__all__ = ["setup_logging", "logger"]
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Resource monitoring for HumanEval Rust evaluation.
|
|
3
|
+
|
|
4
|
+
Provides worker slot management and memory usage monitoring during parallel evaluation.
|
|
5
|
+
|
|
6
|
+
Copyright (c) 2025 Dave Tofflemire, SigilDERG Project
|
|
7
|
+
Version: 2.1.0
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import threading
|
|
11
|
+
|
|
12
|
+
import psutil
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ResourceMonitor:
|
|
16
|
+
"""Monitor and limit resource usage during evaluation."""
|
|
17
|
+
|
|
18
|
+
def __init__(
|
|
19
|
+
self,
|
|
20
|
+
max_memory_percent: float = 80.0,
|
|
21
|
+
max_workers: int = 24,
|
|
22
|
+
check_interval: float = 1.0,
|
|
23
|
+
):
|
|
24
|
+
self.max_memory_percent = max_memory_percent
|
|
25
|
+
self.max_workers = max_workers
|
|
26
|
+
self.check_interval = check_interval
|
|
27
|
+
self._active_workers = 0
|
|
28
|
+
self._lock = threading.Lock()
|
|
29
|
+
self._stop_event = threading.Event()
|
|
30
|
+
|
|
31
|
+
def acquire_worker(self) -> bool:
|
|
32
|
+
"""Try to acquire a worker slot. Returns False if limit reached."""
|
|
33
|
+
|
|
34
|
+
with self._lock:
|
|
35
|
+
if psutil.virtual_memory().percent > self.max_memory_percent:
|
|
36
|
+
return False
|
|
37
|
+
if self._active_workers >= self.max_workers:
|
|
38
|
+
return False
|
|
39
|
+
self._active_workers += 1
|
|
40
|
+
return True
|
|
41
|
+
|
|
42
|
+
def release_worker(self) -> None:
|
|
43
|
+
"""Release a worker slot."""
|
|
44
|
+
with self._lock:
|
|
45
|
+
self._active_workers = max(0, self._active_workers - 1)
|
|
46
|
+
|
|
47
|
+
def stop(self) -> None:
|
|
48
|
+
"""Signal the monitor to stop. Sets the internal stop event."""
|
|
49
|
+
self._stop_event.set()
|
|
50
|
+
|
|
51
|
+
@property
|
|
52
|
+
def active_workers(self) -> int:
|
|
53
|
+
"""Return the current number of active workers."""
|
|
54
|
+
with self._lock:
|
|
55
|
+
return self._active_workers
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
__all__ = ["ResourceMonitor"]
|