Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto Apto para principiantes
#3,430 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

@its-amann ya está trabajando en esto.

Desde el 21/10/2026.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
pandas, python
Área
backend, data

Línea de trabajo

Empieza en pyrit/score/scorer_evaluation/scorer_evaluator.py, en run_evaluation_async(), y sigue cómo los patrones de human_labeled_datasets_files seleccionan archivos CSV. Añade cobertura de regresión para patrones que se solapan y se repiten, conservando los archivos distintos que tienen las mismas cadenas de versión; verifica que ambas configuraciones evalúen dos respuestas con una precisión de 0.5.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Python
Estrellas
4.6k
Forks
962
Merge medio
2 d 13 h
PR fusionados (30 d)
423

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoft/PyRIT

Todos los issues de microsoft/PyRIT

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.