CoolFace
Apppublic

ArchCoder/Openenv

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
App README

PyTorch Debug Env ๐Ÿ”ฅ

A complete OpenEnv environment for the Meta PyTorch Hackathon where an AI agent investigates and diagnoses broken PyTorch training jobs.

Quick Start

python
from openenv import AutoEnv, AutoAction

env = AutoEnv.from_env("ArchCoder/pytorch-debug-env")
Action = AutoAction.from_env("ArchCoder/pytorch-debug-env")

with env.sync() as client:
    result = client.reset(task_id="easy")
    action = Action(
        current_hypothesis={
            "bug_type": "missing_zero_grad",
            "affected_file": "train.py",
            "confidence": 0.7
        },
        commit_diagnosis=False
    )
    step_result = client.step(action)

API Endpoints

EndpointMethodDescription
/GETEnvironment info
/healthGETHealth check
/reset?task_id=easyPOSTStart new episode
/stepPOSTSubmit hypothesis + action
/stateGETCurrent episode state

Tasks

TaskDifficultyDescription
easyโญSingle-file bug โ€” missing zero_grad, wrong loss
mediumโญโญMulti-file root cause โ€” data leakage, learning-rate misconfig
hardโญโญโญSilent failure โ€” memory leak, AMP overflow, red herrings

Each difficulty draws from multiple bug templates, so repeated runs do not recycle the same exact failure.

Reward Structure

  • โ€”Hypothesis delta (60%) โ€” reward for improving your bug hypothesis each step
  • โ€”Investigation (20%) โ€” reward for inspecting the right files
  • โ€”Final diagnosis (20%) โ€” accuracy of committed diagnosis vs ground truth

Scores range from 0.0 to 1.0. Partial credit for correct bug category on hard tasks.

Investigation Actions

  • โ€”reveal_file: reveal a file from the synthetic repo
  • โ€”extend_loss_curve: reveal more loss-curve points
  • โ€”extend_gpu_profile: reveal more GPU profile points
  • โ€”reveal_log_chunk: append additional training log lines
  • โ€”run_diagnostic: expose a diagnostic summary report

Reproducibility

Use SEED to make scenario selection and artifacts deterministic across runs:

bash
set SEED=42
python inference.py

Baseline Scores

Run inference.py with a fixed SEED to record your baseline scores. The script prints per-task [END] lines with the final rewards.

Example template (fill after running):

ModelSeedEasyMediumHard
gpt-3.5-turbo420.xx0.xx0.xx

Environment State

Each episode provides a synthetic PyTorch repo with:

  • โ€”Source files (train.py, model/, data/, config/)
  • โ€”Loss curves and GPU memory profiles
  • โ€”Training logs with realistic noise and red herrings

The agent reveals files progressively across up to 5โ€“6 steps, refining its hypothesis before committing a final diagnosis.

Author

Priyansh Saxena โ€” IIIT Gwalior