Datasets:
Commit Β·
54c091f
1
Parent(s): 867b03d
[src] fix: correct stale version in annotation fallback notice, print once per task type
Browse files- notice hardcoded "v1.1.0 annotation updates" but fires for any requested
version, so a v1.1.1 request printed a message naming the wrong release
- reword version-agnostically ("every update after v1.0.0") and name the
actual taskType instead of listing all non-TL task types
- print once per task type per process via _FALLBACK_NOTICE_SHOWN; the notice
carries no per-dataset detail yet repeated for every config in a run
- annotation file resolution unchanged: the fallback assignment stays outside
the print guard
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- MedVision.py +28 -19
MedVision.py
CHANGED
|
@@ -51,6 +51,11 @@ _HOME_PAGE = "https://huggingface.co/datasets/YongchengYAO/MedVision"
|
|
| 51 |
|
| 52 |
_LICENSE = "CC BY-NC 4.0"
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
def _enforce_release_ack(planner_version, latest_version):
|
| 56 |
"""Block silent use of outdated annotations (any task).
|
|
@@ -9012,29 +9017,33 @@ class MedVision(GeneratorBasedBuilder):
|
|
| 9012 |
|
| 9013 |
bm_plan_file = get_bm_plan_file(dataset_dir, _planner_version)
|
| 9014 |
|
| 9015 |
-
#
|
| 9016 |
-
#
|
| 9017 |
-
#
|
|
|
|
| 9018 |
if not os.path.exists(bm_plan_file) and self.config.taskType != "Tumor-Lesion-Size":
|
| 9019 |
fallback_version = "1.0.0"
|
| 9020 |
bm_plan_file_fallback = get_bm_plan_file(dataset_dir, fallback_version)
|
| 9021 |
if os.path.exists(bm_plan_file_fallback):
|
| 9022 |
-
|
| 9023 |
-
|
| 9024 |
-
|
| 9025 |
-
|
| 9026 |
-
|
| 9027 |
-
|
| 9028 |
-
|
| 9029 |
-
|
| 9030 |
-
|
| 9031 |
-
|
| 9032 |
-
|
| 9033 |
-
|
| 9034 |
-
|
| 9035 |
-
|
| 9036 |
-
|
| 9037 |
-
|
|
|
|
|
|
|
|
|
|
| 9038 |
bm_plan_file = bm_plan_file_fallback
|
| 9039 |
else:
|
| 9040 |
raise FileNotFoundError(
|
|
|
|
| 51 |
|
| 52 |
_LICENSE = "CC BY-NC 4.0"
|
| 53 |
|
| 54 |
+
# Task types whose annotation-version fallback notice has already been printed in
|
| 55 |
+
# this process. A benchmark run loads hundreds of configs, and the notice carries
|
| 56 |
+
# no per-dataset information, so printing it once per task type is enough.
|
| 57 |
+
_FALLBACK_NOTICE_SHOWN = set()
|
| 58 |
+
|
| 59 |
|
| 60 |
def _enforce_release_ack(planner_version, latest_version):
|
| 61 |
"""Block silent use of outdated annotations (any task).
|
|
|
|
| 9017 |
|
| 9018 |
bm_plan_file = get_bm_plan_file(dataset_dir, _planner_version)
|
| 9019 |
|
| 9020 |
+
# Annotation updates after v1.0.0 only changed the Tumor-Lesion-Size (TL)
|
| 9021 |
+
# task, so no newer annotation file was ever generated for the other task
|
| 9022 |
+
# types. Fall back to v1.0.0 and say so once per task type, so the caller
|
| 9023 |
+
# knows which file is actually being used without drowning in notices.
|
| 9024 |
if not os.path.exists(bm_plan_file) and self.config.taskType != "Tumor-Lesion-Size":
|
| 9025 |
fallback_version = "1.0.0"
|
| 9026 |
bm_plan_file_fallback = get_bm_plan_file(dataset_dir, fallback_version)
|
| 9027 |
if os.path.exists(bm_plan_file_fallback):
|
| 9028 |
+
if self.config.taskType not in _FALLBACK_NOTICE_SHOWN:
|
| 9029 |
+
_FALLBACK_NOTICE_SHOWN.add(self.config.taskType)
|
| 9030 |
+
print(
|
| 9031 |
+
"\n"
|
| 9032 |
+
"ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ\n"
|
| 9033 |
+
" MedVision: annotation version fallback (not an error)\n"
|
| 9034 |
+
"ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ\n"
|
| 9035 |
+
f" Task type : {self.config.taskType}\n"
|
| 9036 |
+
f" Requested : {os.path.basename(bm_plan_file)}\n"
|
| 9037 |
+
f" Loaded : {os.path.basename(bm_plan_file_fallback)}\n"
|
| 9038 |
+
"\n"
|
| 9039 |
+
" Every annotation update after v1.0.0 changed only the\n"
|
| 9040 |
+
" Tumor-Lesion-Size (TL) task, so no newer annotation file was\n"
|
| 9041 |
+
" ever generated for this task type. v1.0.0 IS the latest\n"
|
| 9042 |
+
" annotation for it, and these are the intended annotations.\n"
|
| 9043 |
+
"\n"
|
| 9044 |
+
" Shown once per task type; further datasets fall back silently.\n"
|
| 9045 |
+
"ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ\n"
|
| 9046 |
+
)
|
| 9047 |
bm_plan_file = bm_plan_file_fallback
|
| 9048 |
else:
|
| 9049 |
raise FileNotFoundError(
|