Spaces:
Sleeping
Sleeping
Use speech clips under 10s, drop the listen checkbox, and set Times New Roman
Browse files- .gitattributes +4 -0
- README.md +1 -1
- app.py +20 -18
- audio/{0ed9d7c8-3b63-4861-af81-925d4176c059.mp3 → 1b9e32b8-cf8e-42d6-bc08-292ad5857d67.mp3} +2 -2
- audio/26600e97-5df3-43be-80ed-ff817c078a77.mp3 +0 -0
- audio/30bb0e51-2077-4217-ac2b-a2c7019f35ee.mp3 +0 -0
- audio/3c4fa8f8-972a-4dcb-a24b-e5d1039dd23f.mp3 +0 -0
- audio/427ba822-c000-4303-bf21-7da0a703efc2.mp3 +0 -0
- audio/47ae81d9-8cb5-4267-9394-2f511cc84871.mp3 +0 -0
- audio/{3ffe9ee1-8d66-4542-aab3-b40fbde3f157.mp3 → 54d927bb-d3ef-42c7-b09c-25f94ccf252e.mp3} +2 -2
- audio/71f95ca1-a409-47b0-af02-80a272f776d5.mp3 +0 -3
- audio/7d857919-89a2-42ca-9cd8-bd75ad56a147.mp3 +0 -3
- audio/7e68bc7b-2ab8-48a9-88db-bcc7b2e0dd5e.mp3 +0 -0
- audio/{2b6096e7-a66f-451f-886b-8210e362f84b.mp3 → 85ca4722-71ec-47dd-b3e2-8337d376a513.mp3} +2 -2
- audio/91eb5cf6-e889-495e-81b6-8756eb629e59.mp3 +0 -0
- audio/d9d7f111-da32-47cb-baa0-fd5ba4e4bca1.mp3 +0 -3
- audio/{6966bbc3-e2c0-40f4-9002-90983182b802.mp3 → ed934345-29e0-4511-b12f-a66d160b9fd5.mp3} +2 -2
- audio/f995bc92-74f6-4e69-94b8-bf6e073fa19f.mp3 +0 -3
- audio/fec3402e-7883-45c0-90d4-38647f615dc3.mp3 +0 -0
- data/desc_items.json +101 -100
- mos_core.py +6 -16
- prepare_mos_data.py +28 -2
.gitattributes
CHANGED
|
@@ -41,3 +41,7 @@ audio/71f95ca1-a409-47b0-af02-80a272f776d5.mp3 filter=lfs diff=lfs merge=lfs -te
|
|
| 41 |
audio/7d857919-89a2-42ca-9cd8-bd75ad56a147.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 42 |
audio/d9d7f111-da32-47cb-baa0-fd5ba4e4bca1.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 43 |
audio/f995bc92-74f6-4e69-94b8-bf6e073fa19f.mp3 filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
audio/7d857919-89a2-42ca-9cd8-bd75ad56a147.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 42 |
audio/d9d7f111-da32-47cb-baa0-fd5ba4e4bca1.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 43 |
audio/f995bc92-74f6-4e69-94b8-bf6e073fa19f.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
audio/1b9e32b8-cf8e-42d6-bc08-292ad5857d67.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
audio/54d927bb-d3ef-42c7-b09c-25f94ccf252e.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
audio/85ca4722-71ec-47dd-b3e2-8337d376a513.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
audio/ed934345-29e0-4511-b12f-a66d160b9fd5.mp3 filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -26,7 +26,7 @@ pinned: false
|
|
| 26 |
|
| 27 |
## 题目
|
| 28 |
|
| 29 |
-
第一部分
|
| 30 |
|
| 31 |
打分规则与 `temp/rebuttal/desc_support.py` 相同:只判断描述里已经写出的说法是否符合音频,不评价完整性。1 到 5 分。只打分,不要求写下不准确的句子。
|
| 32 |
|
|
|
|
| 26 |
|
| 27 |
## 题目
|
| 28 |
|
| 29 |
+
第一部分只从 MMAU test-mini 的 speech 子集抽取,并且每段不超过 10 秒。两边都有 `perceiver_description` 的样本里,用 seed 42 抽了 10 段。每一题同时播放音频并展示两段描述,左右顺序随机。播放文件是原始 wav 转出来的 192 kbps MP3。
|
| 30 |
|
| 31 |
打分规则与 `temp/rebuttal/desc_support.py` 相同:只判断描述里已经写出的说法是否符合音频,不评价完整性。1 到 5 分。只打分,不要求写下不准确的句子。
|
| 32 |
|
app.py
CHANGED
|
@@ -129,7 +129,6 @@ def view(state: Optional[Dict[str, Any]], message: str = "", kind: str = "error"
|
|
| 129 |
"desc_score_1": None,
|
| 130 |
"desc_text_2": "",
|
| 131 |
"desc_score_2": None,
|
| 132 |
-
"desc_listened": False,
|
| 133 |
"desc_prev": gr.update(interactive=False),
|
| 134 |
"desc_next": gr.update(value="下一题"),
|
| 135 |
"aspect_progress": "",
|
|
@@ -162,7 +161,6 @@ def view(state: Optional[Dict[str, Any]], message: str = "", kind: str = "error"
|
|
| 162 |
"desc_score_1": None if stored_left["score"] is None else str(stored_left["score"]),
|
| 163 |
"desc_text_2": right["description"],
|
| 164 |
"desc_score_2": None if stored_right["score"] is None else str(stored_right["score"]),
|
| 165 |
-
"desc_listened": stored_left["listened"] or stored_right["listened"],
|
| 166 |
"desc_prev": gr.update(interactive=index > 0),
|
| 167 |
"desc_next": gr.update(value="进入第二部分" if index + 1 == total else "下一题"),
|
| 168 |
}
|
|
@@ -205,7 +203,6 @@ OUTPUT_KEYS = [
|
|
| 205 |
"desc_score_1",
|
| 206 |
"desc_text_2",
|
| 207 |
"desc_score_2",
|
| 208 |
-
"desc_listened",
|
| 209 |
"desc_prev",
|
| 210 |
"desc_next",
|
| 211 |
"aspect_progress",
|
|
@@ -264,12 +261,11 @@ def on_desc(
|
|
| 264 |
state: Optional[Dict[str, Any]],
|
| 265 |
score_left: Any,
|
| 266 |
score_right: Any,
|
| 267 |
-
listened: bool,
|
| 268 |
step: int,
|
| 269 |
) -> tuple:
|
| 270 |
if not state or state.get("phase") != "desc":
|
| 271 |
return pack(view(state, "当前不在描述评测。"))
|
| 272 |
-
updated, message = STUDY.move_desc(copy.deepcopy(state), score_left, score_right,
|
| 273 |
return pack(view(updated, message))
|
| 274 |
|
| 275 |
|
|
@@ -312,7 +308,7 @@ def build_demo() -> gr.Blocks:
|
|
| 312 |
with gr.Column(visible=False) as desc_panel:
|
| 313 |
desc_progress = gr.Markdown()
|
| 314 |
gr.Markdown(
|
| 315 |
-
"请
|
| 316 |
"**不要因为描述短或有遗漏而扣分。** 左右顺序是随机的。"
|
| 317 |
)
|
| 318 |
desc_audio = gr.Audio(label="原始音频", interactive=False, type="filepath")
|
|
@@ -325,7 +321,6 @@ def build_demo() -> gr.Blocks:
|
|
| 325 |
desc_score_2 = gr.Radio(choices=SCORE_CHOICES, label="描述 2 的准确性")
|
| 326 |
with gr.Accordion("评分规则", open=False):
|
| 327 |
gr.Markdown(RUBRIC)
|
| 328 |
-
desc_listened = gr.Checkbox(label="我已经完整听完这段音频")
|
| 329 |
with gr.Row():
|
| 330 |
desc_prev = gr.Button("上一题")
|
| 331 |
desc_next = gr.Button("下一题", variant="primary")
|
|
@@ -365,7 +360,6 @@ def build_demo() -> gr.Blocks:
|
|
| 365 |
desc_score_1,
|
| 366 |
desc_text_2,
|
| 367 |
desc_score_2,
|
| 368 |
-
desc_listened,
|
| 369 |
desc_prev,
|
| 370 |
desc_next,
|
| 371 |
aspect_progress,
|
|
@@ -384,18 +378,14 @@ def build_demo() -> gr.Blocks:
|
|
| 384 |
cont.click(resume, [name], outputs, api_name="resume")
|
| 385 |
restart_btn.click(restart, [name, acknowledged], outputs, api_name="restart")
|
| 386 |
desc_next.click(
|
| 387 |
-
lambda state, score_left, score_right
|
| 388 |
-
|
| 389 |
-
),
|
| 390 |
-
[state, desc_score_1, desc_score_2, desc_listened],
|
| 391 |
outputs,
|
| 392 |
api_name="desc_next",
|
| 393 |
)
|
| 394 |
desc_prev.click(
|
| 395 |
-
lambda state, score_left, score_right
|
| 396 |
-
|
| 397 |
-
),
|
| 398 |
-
[state, desc_score_1, desc_score_2, desc_listened],
|
| 399 |
outputs,
|
| 400 |
api_name="desc_prev",
|
| 401 |
)
|
|
@@ -418,11 +408,23 @@ def build_demo() -> gr.Blocks:
|
|
| 418 |
demo = build_demo()
|
| 419 |
|
| 420 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 421 |
if __name__ == "__main__":
|
| 422 |
launch_kwargs = {
|
| 423 |
"allowed_paths": [str((ROOT / "audio").resolve())],
|
| 424 |
-
"theme": gr.themes.Soft(),
|
| 425 |
-
"css":
|
| 426 |
}
|
| 427 |
if os.environ.get("MOS_PORT"):
|
| 428 |
launch_kwargs["server_name"] = os.environ.get("MOS_HOST", "127.0.0.1")
|
|
|
|
| 129 |
"desc_score_1": None,
|
| 130 |
"desc_text_2": "",
|
| 131 |
"desc_score_2": None,
|
|
|
|
| 132 |
"desc_prev": gr.update(interactive=False),
|
| 133 |
"desc_next": gr.update(value="下一题"),
|
| 134 |
"aspect_progress": "",
|
|
|
|
| 161 |
"desc_score_1": None if stored_left["score"] is None else str(stored_left["score"]),
|
| 162 |
"desc_text_2": right["description"],
|
| 163 |
"desc_score_2": None if stored_right["score"] is None else str(stored_right["score"]),
|
|
|
|
| 164 |
"desc_prev": gr.update(interactive=index > 0),
|
| 165 |
"desc_next": gr.update(value="进入第二部分" if index + 1 == total else "下一题"),
|
| 166 |
}
|
|
|
|
| 203 |
"desc_score_1",
|
| 204 |
"desc_text_2",
|
| 205 |
"desc_score_2",
|
|
|
|
| 206 |
"desc_prev",
|
| 207 |
"desc_next",
|
| 208 |
"aspect_progress",
|
|
|
|
| 261 |
state: Optional[Dict[str, Any]],
|
| 262 |
score_left: Any,
|
| 263 |
score_right: Any,
|
|
|
|
| 264 |
step: int,
|
| 265 |
) -> tuple:
|
| 266 |
if not state or state.get("phase") != "desc":
|
| 267 |
return pack(view(state, "当前不在描述评测。"))
|
| 268 |
+
updated, message = STUDY.move_desc(copy.deepcopy(state), score_left, score_right, step)
|
| 269 |
return pack(view(updated, message))
|
| 270 |
|
| 271 |
|
|
|
|
| 308 |
with gr.Column(visible=False) as desc_panel:
|
| 309 |
desc_progress = gr.Markdown()
|
| 310 |
gr.Markdown(
|
| 311 |
+
"请听完音频,再给两段描述分别打分。"
|
| 312 |
"**不要因为描述短或有遗漏而扣分。** 左右顺序是随机的。"
|
| 313 |
)
|
| 314 |
desc_audio = gr.Audio(label="原始音频", interactive=False, type="filepath")
|
|
|
|
| 321 |
desc_score_2 = gr.Radio(choices=SCORE_CHOICES, label="描述 2 的准确性")
|
| 322 |
with gr.Accordion("评分规则", open=False):
|
| 323 |
gr.Markdown(RUBRIC)
|
|
|
|
| 324 |
with gr.Row():
|
| 325 |
desc_prev = gr.Button("上一题")
|
| 326 |
desc_next = gr.Button("下一题", variant="primary")
|
|
|
|
| 360 |
desc_score_1,
|
| 361 |
desc_text_2,
|
| 362 |
desc_score_2,
|
|
|
|
| 363 |
desc_prev,
|
| 364 |
desc_next,
|
| 365 |
aspect_progress,
|
|
|
|
| 378 |
cont.click(resume, [name], outputs, api_name="resume")
|
| 379 |
restart_btn.click(restart, [name, acknowledged], outputs, api_name="restart")
|
| 380 |
desc_next.click(
|
| 381 |
+
lambda state, score_left, score_right: on_desc(state, score_left, score_right, 1),
|
| 382 |
+
[state, desc_score_1, desc_score_2],
|
|
|
|
|
|
|
| 383 |
outputs,
|
| 384 |
api_name="desc_next",
|
| 385 |
)
|
| 386 |
desc_prev.click(
|
| 387 |
+
lambda state, score_left, score_right: on_desc(state, score_left, score_right, -1),
|
| 388 |
+
[state, desc_score_1, desc_score_2],
|
|
|
|
|
|
|
| 389 |
outputs,
|
| 390 |
api_name="desc_prev",
|
| 391 |
)
|
|
|
|
| 408 |
demo = build_demo()
|
| 409 |
|
| 410 |
|
| 411 |
+
PAGE_CSS = """
|
| 412 |
+
.gradio-container {
|
| 413 |
+
max-width: 1080px !important;
|
| 414 |
+
margin-left: auto !important;
|
| 415 |
+
margin-right: auto !important;
|
| 416 |
+
}
|
| 417 |
+
.gradio-container, .gradio-container * {
|
| 418 |
+
font-family: "Times New Roman", Times, serif !important;
|
| 419 |
+
}
|
| 420 |
+
"""
|
| 421 |
+
|
| 422 |
+
|
| 423 |
if __name__ == "__main__":
|
| 424 |
launch_kwargs = {
|
| 425 |
"allowed_paths": [str((ROOT / "audio").resolve())],
|
| 426 |
+
"theme": gr.themes.Soft(font=["Times New Roman", "Times", "serif"]),
|
| 427 |
+
"css": PAGE_CSS,
|
| 428 |
}
|
| 429 |
if os.environ.get("MOS_PORT"):
|
| 430 |
launch_kwargs["server_name"] = os.environ.get("MOS_HOST", "127.0.0.1")
|
audio/{0ed9d7c8-3b63-4861-af81-925d4176c059.mp3 → 1b9e32b8-cf8e-42d6-bc08-292ad5857d67.mp3}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c6cd68d980257d182ec37864cc11a25992619e4cf61a3a4265241b2a420da009
|
| 3 |
+
size 108764
|
audio/26600e97-5df3-43be-80ed-ff817c078a77.mp3
DELETED
|
Binary file (67.8 kB)
|
|
|
audio/30bb0e51-2077-4217-ac2b-a2c7019f35ee.mp3
DELETED
|
Binary file (72.1 kB)
|
|
|
audio/3c4fa8f8-972a-4dcb-a24b-e5d1039dd23f.mp3
ADDED
|
Binary file (67.1 kB). View file
|
|
|
audio/427ba822-c000-4303-bf21-7da0a703efc2.mp3
ADDED
|
Binary file (62.7 kB). View file
|
|
|
audio/47ae81d9-8cb5-4267-9394-2f511cc84871.mp3
ADDED
|
Binary file (73.4 kB). View file
|
|
|
audio/{3ffe9ee1-8d66-4542-aab3-b40fbde3f157.mp3 → 54d927bb-d3ef-42c7-b09c-25f94ccf252e.mp3}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f6d369677ee31a483b7c4b3f0a08cc339d61a31455c2d2eb079d7a8b26a6da0e
|
| 3 |
+
size 164301
|
audio/71f95ca1-a409-47b0-af02-80a272f776d5.mp3
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:0942b01542e18f1acf3b83f0b672aaebcfbe19b8648554780ece65cf10db332f
|
| 3 |
-
size 241964
|
|
|
|
|
|
|
|
|
|
|
|
audio/7d857919-89a2-42ca-9cd8-bd75ad56a147.mp3
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:981a56f86760d94484f9f612a81f01a5c402276068b187a96fc086a9ffe58357
|
| 3 |
-
size 319781
|
|
|
|
|
|
|
|
|
|
|
|
audio/7e68bc7b-2ab8-48a9-88db-bcc7b2e0dd5e.mp3
ADDED
|
Binary file (69 kB). View file
|
|
|
audio/{2b6096e7-a66f-451f-886b-8210e362f84b.mp3 → 85ca4722-71ec-47dd-b3e2-8337d376a513.mp3}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:073350cc141355948dec479833e62be4f6a79d108f2d4b12010558035d48f6ad
|
| 3 |
+
size 151964
|
audio/91eb5cf6-e889-495e-81b6-8756eb629e59.mp3
ADDED
|
Binary file (58.3 kB). View file
|
|
|
audio/d9d7f111-da32-47cb-baa0-fd5ba4e4bca1.mp3
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:99b7ab44f3f1fdff53c063b2251af287673842460fd61274cdcf5aba3573df3c
|
| 3 |
-
size 149804
|
|
|
|
|
|
|
|
|
|
|
|
audio/{6966bbc3-e2c0-40f4-9002-90983182b802.mp3 → ed934345-29e0-4511-b12f-a66d160b9fd5.mp3}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9cddeadb42526db189918cdd8837eeac6fdb46ef9a4023a79416ba348ce6fc99
|
| 3 |
+
size 137342
|
audio/f995bc92-74f6-4e69-94b8-bf6e073fa19f.mp3
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:ba4b17ea63292fe950944317448dcaf7624d664cda0df64db61ca248410cd564
|
| 3 |
-
size 108044
|
|
|
|
|
|
|
|
|
|
|
|
audio/fec3402e-7883-45c0-90d4-38647f615dc3.mp3
ADDED
|
Binary file (86.4 kB). View file
|
|
|
data/desc_items.json
CHANGED
|
@@ -1,169 +1,170 @@
|
|
| 1 |
{
|
| 2 |
"task": "description_accuracy",
|
| 3 |
"subset": "speech",
|
|
|
|
| 4 |
"seed": 42,
|
| 5 |
"n_audios": 10,
|
| 6 |
"playback": "192 kbps MP3 transcoded from the original wav",
|
| 7 |
"items": [
|
| 8 |
{
|
| 9 |
-
"uid": "
|
| 10 |
-
"audio_id": "
|
| 11 |
-
"audio": "audio/
|
| 12 |
-
"duration_sec":
|
| 13 |
"system": "A",
|
| 14 |
-
"description": "
|
| 15 |
},
|
| 16 |
{
|
| 17 |
-
"uid": "
|
| 18 |
-
"audio_id": "
|
| 19 |
-
"audio": "audio/
|
| 20 |
-
"duration_sec":
|
| 21 |
"system": "B",
|
| 22 |
-
"description": "
|
| 23 |
},
|
| 24 |
{
|
| 25 |
-
"uid": "
|
| 26 |
-
"audio_id": "
|
| 27 |
-
"audio": "audio/
|
| 28 |
-
"duration_sec":
|
| 29 |
"system": "A",
|
| 30 |
-
"description": "
|
| 31 |
},
|
| 32 |
{
|
| 33 |
-
"uid": "
|
| 34 |
-
"audio_id": "
|
| 35 |
-
"audio": "audio/
|
| 36 |
-
"duration_sec":
|
| 37 |
"system": "B",
|
| 38 |
-
"description": "The
|
| 39 |
},
|
| 40 |
{
|
| 41 |
-
"uid": "
|
| 42 |
-
"audio_id": "
|
| 43 |
-
"audio": "audio/
|
| 44 |
-
"duration_sec":
|
| 45 |
"system": "A",
|
| 46 |
-
"description": "
|
| 47 |
},
|
| 48 |
{
|
| 49 |
-
"uid": "
|
| 50 |
-
"audio_id": "
|
| 51 |
-
"audio": "audio/
|
| 52 |
-
"duration_sec":
|
| 53 |
"system": "B",
|
| 54 |
-
"description": "
|
| 55 |
},
|
| 56 |
{
|
| 57 |
-
"uid": "
|
| 58 |
-
"audio_id": "
|
| 59 |
-
"audio": "audio/
|
| 60 |
-
"duration_sec":
|
| 61 |
"system": "A",
|
| 62 |
-
"description": "
|
| 63 |
},
|
| 64 |
{
|
| 65 |
-
"uid": "
|
| 66 |
-
"audio_id": "
|
| 67 |
-
"audio": "audio/
|
| 68 |
-
"duration_sec":
|
| 69 |
"system": "B",
|
| 70 |
-
"description": "
|
| 71 |
},
|
| 72 |
{
|
| 73 |
-
"uid": "
|
| 74 |
-
"audio_id": "
|
| 75 |
-
"audio": "audio/
|
| 76 |
-
"duration_sec":
|
| 77 |
"system": "A",
|
| 78 |
-
"description": "
|
| 79 |
},
|
| 80 |
{
|
| 81 |
-
"uid": "
|
| 82 |
-
"audio_id": "
|
| 83 |
-
"audio": "audio/
|
| 84 |
-
"duration_sec":
|
| 85 |
"system": "B",
|
| 86 |
-
"description": "A
|
| 87 |
},
|
| 88 |
{
|
| 89 |
-
"uid": "
|
| 90 |
-
"audio_id": "
|
| 91 |
-
"audio": "audio/
|
| 92 |
-
"duration_sec":
|
| 93 |
"system": "A",
|
| 94 |
-
"description": "
|
| 95 |
},
|
| 96 |
{
|
| 97 |
-
"uid": "
|
| 98 |
-
"audio_id": "
|
| 99 |
-
"audio": "audio/
|
| 100 |
-
"duration_sec":
|
| 101 |
"system": "B",
|
| 102 |
-
"description": "
|
| 103 |
},
|
| 104 |
{
|
| 105 |
-
"uid": "
|
| 106 |
-
"audio_id": "
|
| 107 |
-
"audio": "audio/
|
| 108 |
-
"duration_sec":
|
| 109 |
"system": "A",
|
| 110 |
-
"description": "
|
| 111 |
},
|
| 112 |
{
|
| 113 |
-
"uid": "
|
| 114 |
-
"audio_id": "
|
| 115 |
-
"audio": "audio/
|
| 116 |
-
"duration_sec":
|
| 117 |
"system": "B",
|
| 118 |
-
"description": "A
|
| 119 |
},
|
| 120 |
{
|
| 121 |
-
"uid": "
|
| 122 |
-
"audio_id": "
|
| 123 |
-
"audio": "audio/
|
| 124 |
-
"duration_sec":
|
| 125 |
"system": "A",
|
| 126 |
-
"description": "
|
| 127 |
},
|
| 128 |
{
|
| 129 |
-
"uid": "
|
| 130 |
-
"audio_id": "
|
| 131 |
-
"audio": "audio/
|
| 132 |
-
"duration_sec":
|
| 133 |
"system": "B",
|
| 134 |
-
"description": "
|
| 135 |
},
|
| 136 |
{
|
| 137 |
-
"uid": "
|
| 138 |
-
"audio_id": "
|
| 139 |
-
"audio": "audio/
|
| 140 |
-
"duration_sec":
|
| 141 |
"system": "A",
|
| 142 |
-
"description": "
|
| 143 |
},
|
| 144 |
{
|
| 145 |
-
"uid": "
|
| 146 |
-
"audio_id": "
|
| 147 |
-
"audio": "audio/
|
| 148 |
-
"duration_sec":
|
| 149 |
"system": "B",
|
| 150 |
-
"description": "
|
| 151 |
},
|
| 152 |
{
|
| 153 |
-
"uid": "
|
| 154 |
-
"audio_id": "
|
| 155 |
-
"audio": "audio/
|
| 156 |
-
"duration_sec":
|
| 157 |
"system": "A",
|
| 158 |
-
"description": "
|
| 159 |
},
|
| 160 |
{
|
| 161 |
-
"uid": "
|
| 162 |
-
"audio_id": "
|
| 163 |
-
"audio": "audio/
|
| 164 |
-
"duration_sec":
|
| 165 |
"system": "B",
|
| 166 |
-
"description": "
|
| 167 |
}
|
| 168 |
]
|
| 169 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"task": "description_accuracy",
|
| 3 |
"subset": "speech",
|
| 4 |
+
"max_duration_sec": 10.0,
|
| 5 |
"seed": 42,
|
| 6 |
"n_audios": 10,
|
| 7 |
"playback": "192 kbps MP3 transcoded from the original wav",
|
| 8 |
"items": [
|
| 9 |
{
|
| 10 |
+
"uid": "47ae81d9-8cb5-4267-9394-2f511cc84871::A",
|
| 11 |
+
"audio_id": "47ae81d9-8cb5-4267-9394-2f511cc84871",
|
| 12 |
+
"audio": "audio/47ae81d9-8cb5-4267-9394-2f511cc84871.mp3",
|
| 13 |
+
"duration_sec": 3.0,
|
| 14 |
"system": "A",
|
| 15 |
+
"description": "Lexical & Semantic Content: \"Gertie's\" is the first word in the sentence."
|
| 16 |
},
|
| 17 |
{
|
| 18 |
+
"uid": "47ae81d9-8cb5-4267-9394-2f511cc84871::B",
|
| 19 |
+
"audio_id": "47ae81d9-8cb5-4267-9394-2f511cc84871",
|
| 20 |
+
"audio": "audio/47ae81d9-8cb5-4267-9394-2f511cc84871.mp3",
|
| 21 |
+
"duration_sec": 3.0,
|
| 22 |
"system": "B",
|
| 23 |
+
"description": "The word \"great-grandma\" is spoken first with a clear, natural delivery by a young female speaker, characterized by a high pitch, normal volume, and steady speaking rate. The pronunciation is precise, with no disfluencies or pauses, and the word is followed by a brief pause before the next word, \"aghast,\" which is spoken with a slightly rising intonation and moderate stress on the first syllable."
|
| 24 |
},
|
| 25 |
{
|
| 26 |
+
"uid": "1b9e32b8-cf8e-42d6-bc08-292ad5857d67::A",
|
| 27 |
+
"audio_id": "1b9e32b8-cf8e-42d6-bc08-292ad5857d67",
|
| 28 |
+
"audio": "audio/1b9e32b8-cf8e-42d6-bc08-292ad5857d67.mp3",
|
| 29 |
+
"duration_sec": 5.32,
|
| 30 |
"system": "A",
|
| 31 |
+
"description": "Counting words with at least one unstressed phoneme: \"but\", \"he\", \"was\", \"trying\", \"to\", \"make\", \"a\", \"surprise\", \"party\", \"and\", \"I\", \"knew\", \"all\", \"about\", \"it\", \"he\", \"was\", \"trying\", \"to\", \"surprise\", \"me\", \"with\", \"a\", \"lot\", \"of\", \"things\", \"I'm\", \"a\", \"nosey\", \"bitch\"."
|
| 32 |
},
|
| 33 |
{
|
| 34 |
+
"uid": "1b9e32b8-cf8e-42d6-bc08-292ad5857d67::B",
|
| 35 |
+
"audio_id": "1b9e32b8-cf8e-42d6-bc08-292ad5857d67",
|
| 36 |
+
"audio": "audio/1b9e32b8-cf8e-42d6-bc08-292ad5857d67.mp3",
|
| 37 |
+
"duration_sec": 5.32,
|
| 38 |
"system": "B",
|
| 39 |
+
"description": "The utterance \"But he was trying to make a surprise party and I knew all about it, and he was trying to surprise me with a lot of things, and I'm a nosy bitch\" is delivered by a female speaker with a natural, conversational rhythm. The words \"But,\" \"he,\" \"was,\" \"trying,\" \"to,\" \"make,\" \"a,\" \"surprise,\" \"party,\" \"and,\" \"I,\" \"knew,\" \"all,\" \"about,\" \"it,\" \"and,\" \"he,\" \"was,\" \"trying,\" \"to,\" \"surprise,\" \"me,\" \"with,\" \"a,\" \"lot,\" \"of,\" \"things,\" \"and,\" \"I'm,\" \"a,\" \"nosy,\" \"bitch\" are spoken with consistent stress on the first syllable of each word, except for the unstressed syllables in \"surprise,\" \"party,\" \"knew,\" \"all,\" \"about,\" \"it,\" \"trying,\" \"surprise,\" \"me,\" \"things,\" \"nosy,\" and \"bitch,\" which are delivered with reduced pitch and duration, indicating unstressed phonemes."
|
| 40 |
},
|
| 41 |
{
|
| 42 |
+
"uid": "91eb5cf6-e889-495e-81b6-8756eb629e59::A",
|
| 43 |
+
"audio_id": "91eb5cf6-e889-495e-81b6-8756eb629e59",
|
| 44 |
+
"audio": "audio/91eb5cf6-e889-495e-81b6-8756eb629e59.mp3",
|
| 45 |
+
"duration_sec": 2.36,
|
| 46 |
"system": "A",
|
| 47 |
+
"description": "Lexical and semantic content analysis of the sentence reveals the presence of the word 'Forfar' once."
|
| 48 |
},
|
| 49 |
{
|
| 50 |
+
"uid": "91eb5cf6-e889-495e-81b6-8756eb629e59::B",
|
| 51 |
+
"audio_id": "91eb5cf6-e889-495e-81b6-8756eb629e59",
|
| 52 |
+
"audio": "audio/91eb5cf6-e889-495e-81b6-8756eb629e59.mp3",
|
| 53 |
+
"duration_sec": 2.36,
|
| 54 |
"system": "B",
|
| 55 |
+
"description": "A male speaker with a high-pitched, loud voice delivers the sentence \"East Fife, for, forfar\" at a slow pace, with clear articulation and deliberate pauses between \"for\" and \"forfar,\" where the word \"forfar\" is pronounced with a distinct, slightly elongated vowel sound and a rising intonation at the end."
|
| 56 |
},
|
| 57 |
{
|
| 58 |
+
"uid": "85ca4722-71ec-47dd-b3e2-8337d376a513::A",
|
| 59 |
+
"audio_id": "85ca4722-71ec-47dd-b3e2-8337d376a513",
|
| 60 |
+
"audio": "audio/85ca4722-71ec-47dd-b3e2-8337d376a513.mp3",
|
| 61 |
+
"duration_sec": 7.48,
|
| 62 |
"system": "A",
|
| 63 |
+
"description": "was, panel"
|
| 64 |
},
|
| 65 |
{
|
| 66 |
+
"uid": "85ca4722-71ec-47dd-b3e2-8337d376a513::B",
|
| 67 |
+
"audio_id": "85ca4722-71ec-47dd-b3e2-8337d376a513",
|
| 68 |
+
"audio": "audio/85ca4722-71ec-47dd-b3e2-8337d376a513.mp3",
|
| 69 |
+
"duration_sec": 7.48,
|
| 70 |
"system": "B",
|
| 71 |
+
"description": "The speaker, an older man with a slow, deliberate speaking rate and low volume, says \"I was working on a vegetable truck for three dollars a week,\" with clear stress on the word \"was\" and an unstressed version of the same phoneme in \"a\" at the end of \"three dollars a week,\" where the vowel is reduced and less prominent."
|
| 72 |
},
|
| 73 |
{
|
| 74 |
+
"uid": "7e68bc7b-2ab8-48a9-88db-bcc7b2e0dd5e::A",
|
| 75 |
+
"audio_id": "7e68bc7b-2ab8-48a9-88db-bcc7b2e0dd5e",
|
| 76 |
+
"audio": "audio/7e68bc7b-2ab8-48a9-88db-bcc7b2e0dd5e.mp3",
|
| 77 |
+
"duration_sec": 2.82,
|
| 78 |
"system": "A",
|
| 79 |
+
"description": "Key words: \"Watergate scandal\", \"brought down\", \"president\"."
|
| 80 |
},
|
| 81 |
{
|
| 82 |
+
"uid": "7e68bc7b-2ab8-48a9-88db-bcc7b2e0dd5e::B",
|
| 83 |
+
"audio_id": "7e68bc7b-2ab8-48a9-88db-bcc7b2e0dd5e",
|
| 84 |
+
"audio": "audio/7e68bc7b-2ab8-48a9-88db-bcc7b2e0dd5e.mp3",
|
| 85 |
+
"duration_sec": 2.82,
|
| 86 |
"system": "B",
|
| 87 |
+
"description": "A female speaker with a clear, steady articulation and moderate speaking rate delivers the utterance: \"The Watergate scandal brought down a huge president.\" The phrase \"Watergate scandal\" is spoken with emphasis on \"scandal,\" and \"brought down a huge president\" is delivered with a rising intonation on \"huge,\" suggesting significance. The speaker's tone conveys seriousness and urgency, and the word \"huge\" is stressed and elongated, indicating a strong emotional weight. The mention of \"huge president\" is spoken with a slight pause before and after, emphasizing the phrase. The speaker's accent is neutral American, and the delivery is fluent with no disfluencies."
|
| 88 |
},
|
| 89 |
{
|
| 90 |
+
"uid": "54d927bb-d3ef-42c7-b09c-25f94ccf252e::A",
|
| 91 |
+
"audio_id": "54d927bb-d3ef-42c7-b09c-25f94ccf252e",
|
| 92 |
+
"audio": "audio/54d927bb-d3ef-42c7-b09c-25f94ccf252e.mp3",
|
| 93 |
+
"duration_sec": 6.78,
|
| 94 |
"system": "A",
|
| 95 |
+
"description": "red threads"
|
| 96 |
},
|
| 97 |
{
|
| 98 |
+
"uid": "54d927bb-d3ef-42c7-b09c-25f94ccf252e::B",
|
| 99 |
+
"audio_id": "54d927bb-d3ef-42c7-b09c-25f94ccf252e",
|
| 100 |
+
"audio": "audio/54d927bb-d3ef-42c7-b09c-25f94ccf252e.mp3",
|
| 101 |
+
"duration_sec": 6.78,
|
| 102 |
"system": "B",
|
| 103 |
+
"description": "A young female speaker with a high-pitched, loud voice delivers the utterance \"Fred Thruffles 35: Fine threads of finer threads than Fred Thruffles 35 thick threads\" at a normal speaking rate, with clear articulation and emphasis on \"Fine\" at the beginning of the sentence, followed by a brief pause before \"thick threads\" is spoken."
|
| 104 |
},
|
| 105 |
{
|
| 106 |
+
"uid": "427ba822-c000-4303-bf21-7da0a703efc2::A",
|
| 107 |
+
"audio_id": "427ba822-c000-4303-bf21-7da0a703efc2",
|
| 108 |
+
"audio": "audio/427ba822-c000-4303-bf21-7da0a703efc2.mp3",
|
| 109 |
+
"duration_sec": 2.54,
|
| 110 |
"system": "A",
|
| 111 |
+
"description": "Lexical & Semantic Content: The sentence contains the word 'attention' twice."
|
| 112 |
},
|
| 113 |
{
|
| 114 |
+
"uid": "427ba822-c000-4303-bf21-7da0a703efc2::B",
|
| 115 |
+
"audio_id": "427ba822-c000-4303-bf21-7da0a703efc2",
|
| 116 |
+
"audio": "audio/427ba822-c000-4303-bf21-7da0a703efc2.mp3",
|
| 117 |
+
"duration_sec": 2.54,
|
| 118 |
"system": "B",
|
| 119 |
+
"description": "A young female speaker with a high-pitched, natural tone delivers the sentence \"Detention helped Rita's attention retention\" at a normal speaking rate, with clear articulation and no disfluencies; the word \"attention\" is spoken once, with a slight emphasis on the first syllable and a rising intonation at the end of the sentence."
|
| 120 |
},
|
| 121 |
{
|
| 122 |
+
"uid": "ed934345-29e0-4511-b12f-a66d160b9fd5::A",
|
| 123 |
+
"audio_id": "ed934345-29e0-4511-b12f-a66d160b9fd5",
|
| 124 |
+
"audio": "audio/ed934345-29e0-4511-b12f-a66d160b9fd5.mp3",
|
| 125 |
+
"duration_sec": 5.65,
|
| 126 |
"system": "A",
|
| 127 |
+
"description": "the speaker mentions \"the first half of the century\" which implies a time period spanning the first half of a century. This suggests the event is from the twentieth century."
|
| 128 |
},
|
| 129 |
{
|
| 130 |
+
"uid": "ed934345-29e0-4511-b12f-a66d160b9fd5::B",
|
| 131 |
+
"audio_id": "ed934345-29e0-4511-b12f-a66d160b9fd5",
|
| 132 |
+
"audio": "audio/ed934345-29e0-4511-b12f-a66d160b9fd5.mp3",
|
| 133 |
+
"duration_sec": 5.65,
|
| 134 |
"system": "B",
|
| 135 |
+
"description": "An older male speaker with a clear, steady articulation and moderate speaking rate states, \"The Poronynian Massacre was one of the most horrific events of the 20th century,\" emphasizing \"20th century\" with a slight pause before and after, indicating deliberate stress on the time frame."
|
| 136 |
},
|
| 137 |
{
|
| 138 |
+
"uid": "3c4fa8f8-972a-4dcb-a24b-e5d1039dd23f::A",
|
| 139 |
+
"audio_id": "3c4fa8f8-972a-4dcb-a24b-e5d1039dd23f",
|
| 140 |
+
"audio": "audio/3c4fa8f8-972a-4dcb-a24b-e5d1039dd23f.mp3",
|
| 141 |
+
"duration_sec": 2.73,
|
| 142 |
"system": "A",
|
| 143 |
+
"description": "tracy's"
|
| 144 |
},
|
| 145 |
{
|
| 146 |
+
"uid": "3c4fa8f8-972a-4dcb-a24b-e5d1039dd23f::B",
|
| 147 |
+
"audio_id": "3c4fa8f8-972a-4dcb-a24b-e5d1039dd23f",
|
| 148 |
+
"audio": "audio/3c4fa8f8-972a-4dcb-a24b-e5d1039dd23f.mp3",
|
| 149 |
+
"duration_sec": 2.73,
|
| 150 |
"system": "B",
|
| 151 |
+
"description": "A male speaker with a normal pitch and high volume delivers the sentence \"Tracy's truancy tricked teachers\" at a slow pace, with clear articulation and no disfluencies. The word \"Tracy's\" is pronounced with a slight emphasis on \"Tracy,\" followed by a brief pause before \"truancy,\" which is spoken with a steady rhythm and moderate stress. The word \"teachers\" follows immediately after \"truancy,\" with a slight rise in pitch and a clear, distinct pronunciation, indicating it is the second word in the utterance."
|
| 152 |
},
|
| 153 |
{
|
| 154 |
+
"uid": "fec3402e-7883-45c0-90d4-38647f615dc3::A",
|
| 155 |
+
"audio_id": "fec3402e-7883-45c0-90d4-38647f615dc3",
|
| 156 |
+
"audio": "audio/fec3402e-7883-45c0-90d4-38647f615dc3.mp3",
|
| 157 |
+
"duration_sec": 4.2,
|
| 158 |
"system": "A",
|
| 159 |
+
"description": "Lexical & Semantic Content: The words \"really\" and \"really\" are both stressed in the utterance. Prosody & Delivery: The stress on \"really\" is evident in the pitch and rhythm of the speech."
|
| 160 |
},
|
| 161 |
{
|
| 162 |
+
"uid": "fec3402e-7883-45c0-90d4-38647f615dc3::B",
|
| 163 |
+
"audio_id": "fec3402e-7883-45c0-90d4-38647f615dc3",
|
| 164 |
+
"audio": "audio/fec3402e-7883-45c0-90d4-38647f615dc3.mp3",
|
| 165 |
+
"duration_sec": 4.2,
|
| 166 |
"system": "B",
|
| 167 |
+
"description": "A male speaker with a low pitch and normal volume delivers the utterance \"What was I saying, how could I put it, without really--\" at a slow pace. The word \"saying\" is pronounced with a stressed vowel, while \"really\" is spoken with an unstressed vowel, both exhibiting a similar phonetic quality in their vowel sounds."
|
| 168 |
}
|
| 169 |
]
|
| 170 |
}
|
mos_core.py
CHANGED
|
@@ -192,10 +192,7 @@ class Study:
|
|
| 192 |
|
| 193 |
def stored_desc(self, state: Dict[str, Any], uid: str) -> Dict[str, Any]:
|
| 194 |
row = state.get("desc_answers", {}).get(uid) or {}
|
| 195 |
-
return {
|
| 196 |
-
"score": row.get("score"),
|
| 197 |
-
"listened": bool(row.get("listened")),
|
| 198 |
-
}
|
| 199 |
|
| 200 |
def stored_aspects(self, state: Dict[str, Any], uid: str) -> List[str]:
|
| 201 |
row = state.get("aspect_answers", {}).get(uid) or {}
|
|
@@ -206,24 +203,18 @@ class Study:
|
|
| 206 |
state: Dict[str, Any],
|
| 207 |
score_left: Any,
|
| 208 |
score_right: Any,
|
| 209 |
-
listened: Any,
|
| 210 |
step: int,
|
| 211 |
) -> Tuple[Dict[str, Any], str]:
|
| 212 |
if state.get("phase") != "desc":
|
| 213 |
return state, ""
|
| 214 |
trial = state["desc_trials"][int(state["desc_idx"])]
|
| 215 |
scores = [_coerce_score(score_left), _coerce_score(score_right)]
|
| 216 |
-
heard = bool(listened)
|
| 217 |
for uid, score in zip(trial["uids"], scores):
|
| 218 |
state["desc_answers"][uid] = {
|
| 219 |
"score": score,
|
| 220 |
-
"
|
| 221 |
-
"complete": heard and score is not None,
|
| 222 |
}
|
| 223 |
if step > 0:
|
| 224 |
-
if not heard:
|
| 225 |
-
self.save_partial(state)
|
| 226 |
-
return state, "请先完整听完音频,再打分。"
|
| 227 |
if any(score is None for score in scores):
|
| 228 |
self.save_partial(state)
|
| 229 |
return state, "请给两段描述都打分。"
|
|
@@ -396,14 +387,13 @@ def run_self_check() -> None:
|
|
| 396 |
for item in study.desc["items"]:
|
| 397 |
assert set(item) <= allowed
|
| 398 |
assert item["system"] in {"A", "B"}
|
|
|
|
| 399 |
public_aspect = json.loads((ROOT / "data" / "aspect_items.json").read_text(encoding="utf-8"))
|
| 400 |
for item in public_aspect["items"]:
|
| 401 |
assert "answer" not in item and "aspects" not in item
|
| 402 |
with tempfile.TemporaryDirectory() as tmp:
|
| 403 |
scratch = Study(ROOT, Path(tmp))
|
| 404 |
-
blocked, message = scratch.move_desc(
|
| 405 |
-
scratch.new_session("discard-me", seed=1), None, None, False, 1
|
| 406 |
-
)
|
| 407 |
assert message and blocked["desc_idx"] == 0
|
| 408 |
state = scratch.new_session("self-check", seed=7)
|
| 409 |
assert scratch.load_partial("self-check")["seed"] == 7
|
|
@@ -411,7 +401,7 @@ def run_self_check() -> None:
|
|
| 411 |
assert shown_first == {"A", "B"}
|
| 412 |
error = ""
|
| 413 |
while state["phase"] == "desc":
|
| 414 |
-
state, error = scratch.move_desc(state, 4, 5,
|
| 415 |
assert error == "", error
|
| 416 |
while state["phase"] == "aspect":
|
| 417 |
state, error = scratch.move_aspect(state, ["6", "1"], 1)
|
|
@@ -423,7 +413,7 @@ def run_self_check() -> None:
|
|
| 423 |
assert len(saved[0]["description_ratings"]) == 20
|
| 424 |
assert {row["score"] for row in saved[0]["description_ratings"]} == {4, 5}
|
| 425 |
assert saved[0]["aspect_ratings"][0]["selected"] == ["1", "6"]
|
| 426 |
-
state, error = scratch.move_desc(state, 5, 5,
|
| 427 |
assert state["phase"] == "done"
|
| 428 |
assert len(ratings.read_text(encoding="utf-8").splitlines()) == 1
|
| 429 |
print(
|
|
|
|
| 192 |
|
| 193 |
def stored_desc(self, state: Dict[str, Any], uid: str) -> Dict[str, Any]:
|
| 194 |
row = state.get("desc_answers", {}).get(uid) or {}
|
| 195 |
+
return {"score": row.get("score")}
|
|
|
|
|
|
|
|
|
|
| 196 |
|
| 197 |
def stored_aspects(self, state: Dict[str, Any], uid: str) -> List[str]:
|
| 198 |
row = state.get("aspect_answers", {}).get(uid) or {}
|
|
|
|
| 203 |
state: Dict[str, Any],
|
| 204 |
score_left: Any,
|
| 205 |
score_right: Any,
|
|
|
|
| 206 |
step: int,
|
| 207 |
) -> Tuple[Dict[str, Any], str]:
|
| 208 |
if state.get("phase") != "desc":
|
| 209 |
return state, ""
|
| 210 |
trial = state["desc_trials"][int(state["desc_idx"])]
|
| 211 |
scores = [_coerce_score(score_left), _coerce_score(score_right)]
|
|
|
|
| 212 |
for uid, score in zip(trial["uids"], scores):
|
| 213 |
state["desc_answers"][uid] = {
|
| 214 |
"score": score,
|
| 215 |
+
"complete": score is not None,
|
|
|
|
| 216 |
}
|
| 217 |
if step > 0:
|
|
|
|
|
|
|
|
|
|
| 218 |
if any(score is None for score in scores):
|
| 219 |
self.save_partial(state)
|
| 220 |
return state, "请给两段描述都打分。"
|
|
|
|
| 387 |
for item in study.desc["items"]:
|
| 388 |
assert set(item) <= allowed
|
| 389 |
assert item["system"] in {"A", "B"}
|
| 390 |
+
assert float(item["duration_sec"]) <= 10.0
|
| 391 |
public_aspect = json.loads((ROOT / "data" / "aspect_items.json").read_text(encoding="utf-8"))
|
| 392 |
for item in public_aspect["items"]:
|
| 393 |
assert "answer" not in item and "aspects" not in item
|
| 394 |
with tempfile.TemporaryDirectory() as tmp:
|
| 395 |
scratch = Study(ROOT, Path(tmp))
|
| 396 |
+
blocked, message = scratch.move_desc(scratch.new_session("discard-me", seed=1), None, None, 1)
|
|
|
|
|
|
|
| 397 |
assert message and blocked["desc_idx"] == 0
|
| 398 |
state = scratch.new_session("self-check", seed=7)
|
| 399 |
assert scratch.load_partial("self-check")["seed"] == 7
|
|
|
|
| 401 |
assert shown_first == {"A", "B"}
|
| 402 |
error = ""
|
| 403 |
while state["phase"] == "desc":
|
| 404 |
+
state, error = scratch.move_desc(state, 4, 5, 1)
|
| 405 |
assert error == "", error
|
| 406 |
while state["phase"] == "aspect":
|
| 407 |
state, error = scratch.move_aspect(state, ["6", "1"], 1)
|
|
|
|
| 413 |
assert len(saved[0]["description_ratings"]) == 20
|
| 414 |
assert {row["score"] for row in saved[0]["description_ratings"]} == {4, 5}
|
| 415 |
assert saved[0]["aspect_ratings"][0]["selected"] == ["1", "6"]
|
| 416 |
+
state, error = scratch.move_desc(state, 5, 5, 1)
|
| 417 |
assert state["phase"] == "done"
|
| 418 |
assert len(ratings.read_text(encoding="utf-8").splitlines()) == 1
|
| 419 |
print(
|
prepare_mos_data.py
CHANGED
|
@@ -107,6 +107,7 @@ def parse_args() -> argparse.Namespace:
|
|
| 107 |
parser.add_argument("--n-desc", type=int, default=10, help="Paired audios per system.")
|
| 108 |
parser.add_argument("--n-aspect", type=int, default=10)
|
| 109 |
parser.add_argument("--bitrate", type=int, default=192_000, help="MP3 bitrate for web playback.")
|
|
|
|
| 110 |
return parser.parse_args()
|
| 111 |
|
| 112 |
|
|
@@ -141,6 +142,18 @@ def parse_aspects(text: str) -> List[str]:
|
|
| 141 |
return found
|
| 142 |
|
| 143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
def transcode_mp3(src: Path, dst: Path, bit_rate: int) -> float:
|
| 145 |
import av
|
| 146 |
|
|
@@ -183,17 +196,23 @@ def write_json(path: Path, payload: Any) -> None:
|
|
| 183 |
path.write_text(json.dumps(payload, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
|
| 184 |
|
| 185 |
|
| 186 |
-
def select_description_pairs(n: int, seed: int, bit_rate: int) -> Dict[str, Any]:
|
| 187 |
baseline_rows = {row["id"]: row for row in load_json(BASELINE_JSON) if row.get("task") == "speech"}
|
| 188 |
ours_rows = {row["id"]: row for row in load_json(OURS_JSON) if row.get("task") == "speech"}
|
| 189 |
candidates = []
|
|
|
|
| 190 |
for sample_id in sorted(set(baseline_rows) & set(ours_rows)):
|
| 191 |
baseline_desc = str(baseline_rows[sample_id].get("perceiver_description") or "").strip()
|
| 192 |
ours_desc = str(ours_rows[sample_id].get("perceiver_description") or "").strip()
|
| 193 |
audio_path = resolve_audio(str(baseline_rows[sample_id].get("audio_id") or ""))
|
| 194 |
if not baseline_desc or not ours_desc or audio_path is None:
|
| 195 |
continue
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
candidates.append(sample_id)
|
|
|
|
| 197 |
if len(candidates) < n:
|
| 198 |
raise RuntimeError(f"Only {len(candidates)} usable speech pairs; need {n}.")
|
| 199 |
|
|
@@ -247,6 +266,7 @@ def select_description_pairs(n: int, seed: int, bit_rate: int) -> Dict[str, Any]
|
|
| 247 |
"public": {
|
| 248 |
"task": "description_accuracy",
|
| 249 |
"subset": "speech",
|
|
|
|
| 250 |
"seed": seed,
|
| 251 |
"n_audios": n,
|
| 252 |
"playback": f"{bit_rate // 1000} kbps MP3 transcoded from the original wav",
|
|
@@ -314,7 +334,13 @@ def main() -> None:
|
|
| 314 |
"Old ratings stay aligned only while these stimulus ids are unchanged."
|
| 315 |
)
|
| 316 |
|
| 317 |
-
desc = select_description_pairs(args.n_desc, args.seed, args.bitrate)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 318 |
aspect = select_aspect_items(args.n_aspect, args.seed)
|
| 319 |
created = datetime.now(timezone.utc).isoformat()
|
| 320 |
|
|
|
|
| 107 |
parser.add_argument("--n-desc", type=int, default=10, help="Paired audios per system.")
|
| 108 |
parser.add_argument("--n-aspect", type=int, default=10)
|
| 109 |
parser.add_argument("--bitrate", type=int, default=192_000, help="MP3 bitrate for web playback.")
|
| 110 |
+
parser.add_argument("--max-duration", type=float, default=10.0, help="Keep speech clips no longer than this many seconds.")
|
| 111 |
return parser.parse_args()
|
| 112 |
|
| 113 |
|
|
|
|
| 142 |
return found
|
| 143 |
|
| 144 |
|
| 145 |
+
def audio_duration(path: Path) -> float:
|
| 146 |
+
import av
|
| 147 |
+
|
| 148 |
+
with av.open(str(path)) as container:
|
| 149 |
+
if container.duration:
|
| 150 |
+
return float(container.duration) / 1_000_000
|
| 151 |
+
stream = container.streams.audio[0]
|
| 152 |
+
if stream.duration:
|
| 153 |
+
return float(stream.duration * stream.time_base)
|
| 154 |
+
return 0.0
|
| 155 |
+
|
| 156 |
+
|
| 157 |
def transcode_mp3(src: Path, dst: Path, bit_rate: int) -> float:
|
| 158 |
import av
|
| 159 |
|
|
|
|
| 196 |
path.write_text(json.dumps(payload, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
|
| 197 |
|
| 198 |
|
| 199 |
+
def select_description_pairs(n: int, seed: int, bit_rate: int, max_duration: float) -> Dict[str, Any]:
|
| 200 |
baseline_rows = {row["id"]: row for row in load_json(BASELINE_JSON) if row.get("task") == "speech"}
|
| 201 |
ours_rows = {row["id"]: row for row in load_json(OURS_JSON) if row.get("task") == "speech"}
|
| 202 |
candidates = []
|
| 203 |
+
too_long = 0
|
| 204 |
for sample_id in sorted(set(baseline_rows) & set(ours_rows)):
|
| 205 |
baseline_desc = str(baseline_rows[sample_id].get("perceiver_description") or "").strip()
|
| 206 |
ours_desc = str(ours_rows[sample_id].get("perceiver_description") or "").strip()
|
| 207 |
audio_path = resolve_audio(str(baseline_rows[sample_id].get("audio_id") or ""))
|
| 208 |
if not baseline_desc or not ours_desc or audio_path is None:
|
| 209 |
continue
|
| 210 |
+
duration = audio_duration(audio_path)
|
| 211 |
+
if duration <= 0 or duration > max_duration:
|
| 212 |
+
too_long += 1
|
| 213 |
+
continue
|
| 214 |
candidates.append(sample_id)
|
| 215 |
+
print(f"Speech pairs at most {max_duration:.0f}s: {len(candidates)} (excluded {too_long} longer clips)")
|
| 216 |
if len(candidates) < n:
|
| 217 |
raise RuntimeError(f"Only {len(candidates)} usable speech pairs; need {n}.")
|
| 218 |
|
|
|
|
| 266 |
"public": {
|
| 267 |
"task": "description_accuracy",
|
| 268 |
"subset": "speech",
|
| 269 |
+
"max_duration_sec": max_duration,
|
| 270 |
"seed": seed,
|
| 271 |
"n_audios": n,
|
| 272 |
"playback": f"{bit_rate // 1000} kbps MP3 transcoded from the original wav",
|
|
|
|
| 334 |
"Old ratings stay aligned only while these stimulus ids are unchanged."
|
| 335 |
)
|
| 336 |
|
| 337 |
+
desc = select_description_pairs(args.n_desc, args.seed, args.bitrate, args.max_duration)
|
| 338 |
+
keep = {item["audio"] for item in desc["public"]["items"]}
|
| 339 |
+
audio_dir = MOS_DIR / "audio"
|
| 340 |
+
if audio_dir.is_dir():
|
| 341 |
+
for old in audio_dir.glob("*.mp3"):
|
| 342 |
+
if f"audio/{old.name}" not in keep:
|
| 343 |
+
old.unlink()
|
| 344 |
aspect = select_aspect_items(args.n_aspect, args.seed)
|
| 345 |
created = datetime.now(timezone.utc).isoformat()
|
| 346 |
|