Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

BUG: Overlapping scorer-evaluation globs duplicate CSVs and change accuracy

Aperta Adatta ai principianti
#3,430 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@its-amann ci sta già lavorando.

Dal 21/10/2026.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
pandas, python
Ambito
backend, data

Direzione di ricerca

Inizia in pyrit/score/scorer_evaluation/scorer_evaluator.py, da run_evaluation_async(), e segui come i pattern human_labeled_datasets_files selezionano i file CSV. Aggiungi test di regressione per pattern sovrapposti e ripetuti, mantenendo i file distinti con stringhe di versione uguali; verifica che entrambe le configurazioni valutino due risposte con un'accuratezza di 0.5.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe the bug

Overlapping human_labeled_datasets_files patterns load the same CSV more than once in run_evaluation_async(), changing sample weights and reported accuracy. For the same two files and deterministic scorer, adding an already-matched filename changes accuracy from 0.5 to 0.6667.

Steps/Code to Reproduce

No model API or external dataset needed. Only the dataset root is redirected; loading, scoring, and metrics use the real implementations.

import asyncio
from pathlib import Path
from tempfile import TemporaryDirectory
from unittest.mock import patch

from pyrit.memory import CentralMemory, SQLiteMemory
from pyrit.score import RegistryUpdateBehavior, SubStringScorer
from pyrit.score.scorer_evaluation import scorer_evaluator as se


async def run_async(root: Path) -> None:
    try:
        with patch.object(se, "SCORER_EVALS_PATH", root):
            for patterns in (["*.csv"], ["*.csv", "a.csv"]):
                evaluator = se.ObjectiveScorerEvaluator(SubStringScorer(substring="marker"))
                result = await evaluator.run_evaluation_async(
                    dataset_files=se.ScorerEvalDatasetFiles(
                        human_labeled_datasets_files=patterns, result_file="unused.jsonl"
                    ),
                    num_scorer_trials=1,
                    update_registry_behavior=RegistryUpdateBehavior.NEVER_UPDATE,
                )
                print(patterns, result.num_responses, round(float(result.accuracy), 4))
    finally:
        await CentralMemory.get_memory_instance().dispose_engine_async()


with TemporaryDirectory() as directory:
    root = Path(directory)
    for name, label in [("a.csv", 1), ("b.csv", 0)]:
        (root / name).write_text(
            "# dataset_version=1.0\nassistant_response,objective,human_score\n"
            f"marker,Synthetic objective,{label}\n",
            encoding="utf-8",
        )
    CentralMemory.set_memory_instance(SQLiteMemory(db_path=":memory:", silent=True))
    asyncio.run(run_async(root))
Expected Results

Both configurations evaluate the same two responses, with accuracy 0.5.

Actual Results
['*.csv'] 2 0.5
['*.csv', 'a.csv'] 3 0.6667

Would deduplicating matched paths before loading be appropriate? I'd keep distinct files with equal version strings intact and add regression tests for overlapping and repeated patterns. I'd like to take this if you mark it ready for contribution; I'll wait for triage before preparing a PR.

Versions

macOS ARM64, Python 3.12.13, PyRIT 1.2.0.dev0 (ac196e57, main), numpy 2.4.6, pandas 3.0.6, scipy 1.17.1. Dependencies installed with uv sync --locked --no-dev.

AI-assisted investigation; the reproduction above was executed locally against unmodified source.

Lingua principale
Python
Stelle
4.6k
Fork
962
Merge medio
2g 13h
PR unite (30g)
417

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/PyRIT

Tutte le issue di microsoft/PyRIT

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.