BUG: Garak and ML-VLSU loaders still load one example when max_examples is 0 or negative
Maintainer thường phản hồi trong vòng 2 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
Hướng nghiên cứu
Đọc garak_dataset.py và vlsu_multimodal_dataset.py, sau đó so sánh bước xác thực max_examples của chúng với bản sửa lỗi loader ComicJailbreak được tham chiếu trong #3589. Kiểm tra xem mỗi loader có từ chối giá trị bằng không và giá trị âm khi khởi tạo hay không; hoàn thành khi cả hai đều tạo ra ValueError đã nêu và các giới hạn dương hợp lệ vẫn hoạt động.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
The Garak loaders (_GarakRemoteDataset in pyrit/datasets/seed_datasets/remote/garak_dataset.py and every subclass, such as the package hallucination, system prompt and audio datasets) and _VLSUMultimodalDataset (vlsu_multimodal_dataset.py) accept any integer for max_examples. They compare against the cap only after appending, so a cap below 1 never stops the first item:
_GarakNpmDataset(max_examples=0)andmax_examples=-1each load 1 seed._VLSUMultimodalDataset(max_examples=0)loads the first matching example's text and image pair:len(prompts) >= 0 * 2is only checked after the pair is added.
This is the same pattern as max_examples in the ComicJailbreak loader (#3589).
Steps/Code to Reproduce
import asyncio
from unittest.mock import AsyncMock, patch
from pyrit.datasets.seed_datasets.remote.garak_package_hallucination_dataset import _GarakNpmDataset
from pyrit.datasets.seed_datasets.remote.vlsu_multimodal_dataset import _VLSUMultimodalDataset
from pyrit.setup.initialization import IN_MEMORY, initialize_pyrit_async
ROWS = [{"text": f"pkg{i}", "package_first_seen": "2010-01-01"} for i in range(3)]
async def main():
await initialize_pyrit_async(memory_db_type=IN_MEMORY)
for max_examples in (0, -1):
try:
loader = _GarakNpmDataset(max_examples=max_examples)
with patch.object(loader, "_fetch_from_huggingface_async", new=AsyncMock(return_value=ROWS)):
dataset = await loader.fetch_dataset_async()
print(f"garak npm max_examples={max_examples}: {len(dataset.seeds)} seeds")
except ValueError as e:
print(f"garak npm max_examples={max_examples}: ValueError: {e}")
try:
_VLSUMultimodalDataset(max_examples=max_examples)
print(f"ml_vlsu max_examples={max_examples}: accepted")
except ValueError as e:
print(f"ml_vlsu max_examples={max_examples}: ValueError: {e}")
asyncio.run(main())
Expected Results
A cap below 1 is rejected when the loader is created, as the ComicJailbreak fix for #3589 does:
garak npm max_examples=0: ValueError: max_examples must be at least 1 or None, got 0
ml_vlsu max_examples=0: ValueError: max_examples must be at least 1 or None, got 0
garak npm max_examples=-1: ValueError: max_examples must be at least 1 or None, got -1
ml_vlsu max_examples=-1: ValueError: max_examples must be at least 1 or None, got -1
Actual Results
garak npm max_examples=0: 1 seeds
ml_vlsu max_examples=0: accepted
garak npm max_examples=-1: 1 seeds
ml_vlsu max_examples=-1: accepted
Screenshots
N/A
Versions
- OS: Windows 11
- Python version: 3.11.9
- PyRIT version: installed from main (6224d531) in editable mode
- Ngôn ngữ chính
- Python
- Star
- 4.7k
- Fork
- 980
- Merge trung bình
- 2 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 422
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/PyRIT
-
BUG: ComicJailbreak max_examples counts goals that render nothing, so templates=["code"] with max_examples=10 failsCó thể đã có người làm @ShivamSharma43 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 2 ngày
-
BUG: SeedDatasetFilter matches harm_categories, modalities and size case-sensitively, unlike tagsCó thể đã có người làm @ShivamSharma43 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Conversation drawer shows the previous attack's conversations after switching attacksCó thể đã có người làm @ManoharPaturi đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
microsoft/PyRIT#3575 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Conversation draft turns permanently dirty when applied conversions match no pieceCó thể đã có người làm @ManoharPaturi đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
microsoft/PyRIT#3573 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Analytics page treats a bare # fragment as a malformed link and disables the dashboardCó thể đã có người làm @ManoharPaturi đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
microsoft/PyRIT#3571 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của microsoft/PyRIT
Issue tương tự
-
backlog
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
EchoTools/nevr-runtime#1108 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
parse names a key after a top-level multi() threshold Bitcoin Core v31.1 refuses as not validĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
btclib-org/btclib-wallet#587 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Judgment-Pack/judgment-pack-spec#275 ·
Maintainer thường phản hồi trong vòng 1 ngày