BUG: LLMGenericTextConverter identifier changes between processes for set-valued template parameters
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 llm_generic_text_converter.py 中第 67 行左右的 _describe_template_value 开始,那里把 set 和 frozenset 值当作列表处理。分别将 PYTHONHASHSEED 设为 1 和 2,运行两次复现脚本,并比较标识符的输出。当标识符在不同种子间一致,且模板渲染保持不变(正如 issue 所要求的)时,即为完成。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
_describe_template_value handles set and frozenset like a list (llm_generic_text_converter.py:67), so the identifier follows set iteration order. That order depends on PYTHONHASHSEED, so the same configuration gets a different hash in each process.
Steps/Code to Reproduce
Run on main at 5fb4fb977, once with PYTHONHASHSEED=1 and once with PYTHONHASHSEED=2.
import asyncio
from pyrit.converter import LLMGenericTextConverter
from pyrit.models import SeedPrompt
from pyrit.prompt_target import OpenAIChatTarget
from pyrit.setup import IN_MEMORY, initialize_pyrit_async
async def main() -> None:
await initialize_pyrit_async(memory_db_type=IN_MEMORY, silent=True)
target = OpenAIChatTarget(endpoint="https://example.invalid/v1", api_key="unused", model_name="model-a")
converter = LLMGenericTextConverter(
converter_target=target,
system_prompt_template=SeedPrompt(value="Use one of these tones: {{ tone }}", parameters=["tone"]),
tone={"alpha", "beta", "gamma", "delta", "epsilon", "zeta"},
)
print(converter.get_identifier().unique_name)
asyncio.run(main())
Expected Results
The same identifier in both runs.
Actual Results
PYTHONHASHSEED=1 LLMGenericTextConverter::34b80fa1
PYTHONHASHSEED=2 LLMGenericTextConverter::9136bd54
Versions
- OS: Windows 11
- Python version: 3.12.0
- PyRIT version: source checkout of
mainat5fb4fb977
System:
python: 3.12.0 (tags/v3.12.0:0fb18b0, Oct 2 2023, 13:03:39) [MSC v.1935 64 bit (AMD64)]
executable: C:\dev\pyr-main\Scripts\python.exe
machine: Windows-11-10.0.26300-SP0
Python dependencies:
pyrit: 1.2.0.dev0
Cython: None
numpy: 2.4.6
openai: 2.54.0
packaging: 26.3
pip: 23.2.1
scipy: 1.17.1
setuptools: 84.2.1
sqlite3: None
torch: None
transformers: 5.20.2
The rendered prompt moves too when a template prints the set: {{ tone }} gives a different order under each seed. Sorting inside _describe_template_value fixes the identifier. Rendering is a separate call: leave it, or reject sets as template parameters.
- 主要语言
- Python
- 星标
- 4.7k
- 派生
- 1k
- 平均合并
- 2 天 3 小时
- 30 天内合并 PR
- 450
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/PyRIT 的其他 Issue
-
BUG: SelfAskGeneral scorers leave their output keys out of the identifier可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭Bug: triage
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 2 天内回复
-
Description-only preset edits split comma-containing exact goals into separate goals可能已有人在做 @MRX-72 于 2 天前认领。 未关闭help wanted
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
-
GUI rejects valid empty-string SearchReplaceConverter settings, preventing deletion converters可能已有人在做 @Darshika140 于 1 天前认领。 未关闭help wanted
难度 2/5 1-3 小时 新手友好度 76/100
microsoft/PyRIT#3749 · 3 条评论 · 已指派 1 人 ·
维护者通常 2 天内回复
-
HTML scenario export replaces an intentionally empty converted message with the original text可能已有人在做 @VISHNU0906 于 2 天前认领。 未关闭help wanted
难度 2/5 1-3 小时 新手友好度 77/100
microsoft/PyRIT#3741 · 1 条评论 · 已指派 1 人 ·
维护者通常 2 天内回复
-
ReferenceField has no component tests and only 42.4% line coverage可能已有人在做 @ppcvote 今天认领。 未关闭help wanted
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 2 天内回复
相似的 Issue
-
cost:cheap practicality:seen-in-the-wild severity:medium
难度 2/5 1-3 小时 新手友好度 72/100
fairagro/m4.2_advanced_middleware_api#620 ·
维护者通常 1 天内回复
-
area:security effort:S priority:P2 provider:local-libvirt status:ready type:docs
难度 2/5 1-3 小时 新手友好度 75/100
randomparity/kdive#3495 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
microsoft/markitdown#2820 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复