VideoFloatScaleScorer reports a score count in the rationale as a frame count
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 88/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- python
- 领域
- backend, testing-qa
调研方向
从 video_float_scale_scorer.py 开始,跟踪 video_scorer.py 中的 _score_frames_async,然后阅读 tests/unit/score/test_video_scorer.py:214-225。更新 rationale,使其报告提取出的帧,而不是返回的 scores,并使用一个为每帧返回多个 scores 的 mock 来加强测试。此外,修正该测试中过时的 aggregator 注释。
由索引模型根据 Issue 内容生成。
描述
VideoFloatScaleScorer writes a frame count into the persisted rationale that is the number of scores, not the number of frames. With the class's own documented defaults they differ by a factor of four.
What a user sees. VideoFloatScaleScorer(image_capable_scorer=AzureContentFilterScorer()) with no other arguments, on a 5-frame sample (the default, video_scorer.py:28), produces a rationale that reads:
Video scored by analyzing 20 frames
Five frames were extracted and five were sent to the Azure endpoint. The persisted number is 20.
Why. video_float_scale_scorer.py:187:
rationale_prefix = f"Video scored by analyzing {len(frame_scores)} frames"
frame_scores comes from VideoScorer._score_frames_async (video_scorer.py:165-169), which returns whatever image_scorer._score_batch_nested_async(...) produced — one Score per (frame × category), not one per frame. MessageFloatScaleScorer deliberately does not aggregate per frame; contrast MessageTrueFalseScorer._score_async (true_false_scorer.py:172-216), which folds the pieces into one.
So the count is only right when the image scorer happens to emit one score per frame. The class docstring says the default FloatScaleScorerByCategory.MAX is chosen precisely because it suits "scorers like AzureContentFilterScorer that return multiple scores per frame" (video_float_scale_scorer.py:28-30, repeated at :62-68) — the default is documented for the case where the count is wrong. AzureContentFilterScorer defaults to all four TextCategory values (azure_content_filter_scorer.py:126-129, pinned by test_azure_content_filter.py:114).
Why the true/false sibling is right. video_true_false_scorer.py:160 has the same len(frame_scores), but there image_capable_scorer is typed MessageTrueFalseScorer, which must return exactly one score per piece — TrueFalseScorer.validate_return_scores raises otherwise (true_false_scorer.py:73-74). The float sibling has no such invariant, so the identical expression is only accidentally correct there.
The existing test cannot see it. tests/unit/score/test_video_scorer.py:214-225 uses MockFloatScaleScorer(return_value=0.8), which returns one score per frame, so the number comes out right by luck — and it asserts only assert "Video scored by analyzing" in scores[0].score_rationale. The digits are never checked. (Its comment "With MAX aggregator (default)" is also stale: the default is FloatScaleScorerByCategory.MAX, not FloatScaleScoreAggregator.MAX — see video_float_scale_scorer.py:48.)
What I would change. Count the frames actually extracted rather than the scores returned — len(frames) is already in scope in _score_frames_async's caller — and assert the number in the existing test using a mock that emits more than one score per frame. I would also fix the stale aggregator comment in the same PR.
Two smaller things in the same area, offered separately
Separate root causes, so I am not folding them in here. Say if you would like either as its own issue.
AzureContentFilterScorer._score_piece_asyncdocumentsRaises: ValueError: If converted_value_data_type is not "text" or "image_path"(:273-274) but has noelseand no raise, so an unsupported type yields a completed0.0score through_empty_resultinstead. The validator one level up means the pipeline does not reach it today, so it is a latent contract gap rather than a live misreport.- With an
audio_scorerconfigured, the final score's rationale isfinal_result.rationale(video_true_false_scorer.py:183), which drops theFrames (N): …line entirely, so the video's frame detail disappears from the persisted output.
What I have not verified. I have not run this against a real video and the real Azure endpoint; the count above is derived from the two defaults and the call chain. I have verified the code path, both defaults, and that the existing test cannot see the problem.
- 主要语言
- Python
- 星标
- 4.6k
- 派生
- 944
- 平均合并
- 2 天 18 小时
- 30 天内合并 PR
- 369
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/PyRIT 的其他 Issue
-
BUG: label queries only return the final conversation of an attack可能已有人在做 @u7k4rs6 于 3 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 85/100
microsoft/PyRIT#3095 · 4 条评论 · 已指派 1 人 ·
维护者通常 2 天内回复
-
BUG Configuration keeps runtime-status errors after polling recovers可能已有人在做 @joeyvictorino 于 6 天前认领。 未关闭Bug: triage GUI help wanted
难度 2/5 1-3 小时 新手友好度 86/100
microsoft/PyRIT#2868 · 6 条评论 ·
维护者通常 2 天内回复
-
FEAT: Support PDF and file inputs via `binary_path` in OpenAI chat and response targets可能已有人在做 @PranavD2905 今天认领。 未关闭feature-request help wanted
难度 4/5 3-5 天 新手友好度 35/100
microsoft/PyRIT#3274 · 1 条评论 ·
维护者通常 2 天内回复
-
feature-request
难度 5/5 一周以上 新手友好度 18/100
维护者通常 2 天内回复
-
难度 3/5 1-2 天 新手友好度 35/100
维护者通常 2 天内回复
相似的 Issue
-
bot-triaged module: LrScheduler module: optimizer triaged
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
documentation glm5 llm-model
难度 2/5 1-3 小时 新手友好度 78/100
vllm-project/vllm-ascend#19062 ·
维护者通常 1 天内回复
-
author-page correction
难度 2/5 1-3 小时 新手友好度 68/100
acl-org/acl-anthology#10496 · 1 条评论 ·
维护者通常 1 天内回复
-
Issue Type: Bug Report
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
enhancement good first issue
难度 2/5 1-3 小时 新手友好度 76/100
SasanLabs/VulnerableApp#836 ·
维护者通常 1 天内回复