Spaces:
Sleeping
Sleeping
Commit ·
bbd9ae1
1
Parent(s): 9ced855
debugged the task validation error
Browse files- app/__pycache__/grader.cpython-313.pyc +0 -0
- app/grader.py +6 -1
- validate_submission.py +1 -1
app/__pycache__/grader.cpython-313.pyc
CHANGED
|
Binary files a/app/__pycache__/grader.cpython-313.pyc and b/app/__pycache__/grader.cpython-313.pyc differ
|
|
|
app/grader.py
CHANGED
|
@@ -12,6 +12,9 @@ _IRRELEVANT_MARKERS = {
|
|
| 12 |
"politics",
|
| 13 |
}
|
| 14 |
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
def _normalize(text: str) -> str:
|
| 17 |
return " ".join(re.findall(r"[a-z0-9_+.#-]+", text.lower()))
|
|
@@ -56,7 +59,9 @@ def grade_review(task: TaskDefinition, review: str) -> GradeResult:
|
|
| 56 |
penalties["missing_overall_score"] = 0.10
|
| 57 |
|
| 58 |
total_penalty = sum(penalties.values())
|
| 59 |
-
|
|
|
|
|
|
|
| 60 |
|
| 61 |
rationale = (
|
| 62 |
f"Coverage={coverage_score:.2f}; Penalty={total_penalty:.2f}; "
|
|
|
|
| 12 |
"politics",
|
| 13 |
}
|
| 14 |
|
| 15 |
+
_MIN_SCORE = 0.01
|
| 16 |
+
_MAX_SCORE = 0.99
|
| 17 |
+
|
| 18 |
|
| 19 |
def _normalize(text: str) -> str:
|
| 20 |
return " ".join(re.findall(r"[a-z0-9_+.#-]+", text.lower()))
|
|
|
|
| 59 |
penalties["missing_overall_score"] = 0.10
|
| 60 |
|
| 61 |
total_penalty = sum(penalties.values())
|
| 62 |
+
raw_score = coverage_score - total_penalty
|
| 63 |
+
# Keep scores strictly within (0, 1) for evaluator compatibility.
|
| 64 |
+
final_score = max(_MIN_SCORE, min(_MAX_SCORE, raw_score))
|
| 65 |
|
| 66 |
rationale = (
|
| 67 |
f"Coverage={coverage_score:.2f}; Penalty={total_penalty:.2f}; "
|
validate_submission.py
CHANGED
|
@@ -65,7 +65,7 @@ def _check_tasks_and_graders() -> None:
|
|
| 65 |
for task_id, task in TASKS.items():
|
| 66 |
review = sample_reviews.get(task_id, "Provide relevant code review feedback with score.")
|
| 67 |
result = grade_review(task, review)
|
| 68 |
-
assert 0.0 <
|
| 69 |
|
| 70 |
|
| 71 |
def _check_inference_script(path: Path) -> None:
|
|
|
|
| 65 |
for task_id, task in TASKS.items():
|
| 66 |
review = sample_reviews.get(task_id, "Provide relevant code review feedback with score.")
|
| 67 |
result = grade_review(task, review)
|
| 68 |
+
assert 0.0 < result.score < 1.0, f"Score out of strict range for {task_id}: {result.score}"
|
| 69 |
|
| 70 |
|
| 71 |
def _check_inference_script(path: Path) -> None:
|