{
  "skill_name": "dali-dynamic-mode",
  "evals": [
    {
      "id": 1,
      "prompt": "Write a complete Python script that uses DALI dynamic mode to load and preprocess images for training an image classification model with PyTorch. The images are JPEGs on disk, and I need GPU-accelerated decode, resize to 224x224, and ImageNet normalization. The script should include the training loop.",
      "expected_output": "Complete pipeline using ndd.readers.File, ndd.decoders.image(device='gpu'), ndd.resize, ndd.crop_mirror_normalize, .torch() handoff",
      "files": [],
      "assertions": [
        {"name": "correct-import", "text": "Uses import nvidia.dali.experimental.dynamic as ndd"},
        {"name": "reader-no-batchsize-in-constructor", "text": "batch_size is NOT passed to the ndd.readers.File() constructor (it belongs in next_epoch(), not the reader constructor)"},
        {"name": "reader-pascalcase", "text": "Reader is PascalCase: ndd.readers.File(...)"},
        {"name": "reader-stateful", "text": "Reader created once outside loop, reused across epochs"},
        {"name": "next-epoch-iteration", "text": "Uses reader.next_epoch(batch_size=N) for iteration"},
        {"name": "device-gpu-not-mixed", "text": "Uses device='gpu' for decoder, NOT device='mixed'"},
        {"name": "no-pipeline-mode", "text": "No pipeline-mode constructs (no @pipeline_def, pipe.build(), pipe.run()) and operators called directly on ndd (e.g. ndd.resize, not fn.resize or ndd.fn.resize)"},
        {"name": "torch-handoff", "text": "Uses .torch() for PyTorch conversion"},
        {"name": "no-unnecessary-evaluate", "text": "No unnecessary .evaluate() calls"}
      ]
    },
    {
      "id": 2,
      "prompt": "I have a Batch of 2D random values in DALI dynamic mode and need to extract the first column as crop_x and the second column as crop_y to pass to an operator. How do I do this? Show a working code example.",
      "expected_output": "Uses batch.slice[0] and batch.slice[1] for samplewise slicing",
      "files": [],
      "assertions": [
        {"name": "correct-slice-usage", "text": "Uses batch.slice[0] and batch.slice[1] (not batch.select())"},
        {"name": "no-getitem", "text": "Does not use batch[0] or batch[:, 0] (Batch has no __getitem__)"},
        {"name": "correct-slice-semantics", "text": "Correctly explains that .slice indexes within each sample, not across samples"},
        {"name": "batch-size-to-random", "text": "Passes batch_size to ndd.random.uniform()"}
      ]
    },
    {
      "id": 3,
      "prompt": "Convert the following pipeline-mode DALI code to dynamic mode. Write the complete converted script.",
      "expected_output": "Correct conversion with all pipeline-mode patterns replaced",
      "files": ["evals/files/pipeline_to_convert.py"],
      "assertions": [
        {"name": "device-gpu-not-mixed", "text": "device='mixed' converted to device='gpu'"},
        {"name": "reader-pascalcase", "text": "fn.readers.file converted to ndd.readers.File (PascalCase)"},
        {"name": "no-pipeline-mode", "text": "No pipeline-mode constructs (no @pipeline_def, pipe.build(), pipe.run()) and operators called directly on ndd (e.g. ndd.rotate, not fn.rotate or ndd.fn.rotate)"},
        {"name": "next-epoch-iteration", "text": "Uses reader.next_epoch(batch_size=N) for iteration (batch_size in next_epoch, not reader constructor)"},
        {"name": "seed-handling", "text": "Pipeline seed converted to ndd.random.set_seed() or RNG(seed=)"},
        {"name": "set-num-threads", "text": "Pipeline num_threads converted to ndd.set_num_threads()"},
        {"name": "batch-size-to-random", "text": "batch_size passed to random operators (uniform, coin_flip)"}
      ]
    },
    {
      "id": 4,
      "prompt": "My data loading code built with DALI's dynamic (imperative) API produces wrong results intermittently — images sometimes appear corrupted. The code decodes JPEG images on the GPU, resizes them, and normalizes them. How do I debug this? Write a debugging guide with code examples.",
      "expected_output": "Recommends EvalMode.sync_full or sync_cpu for debugging, explains async execution model, code examples use correct dynamic mode patterns",
      "files": [],
      "assertions": [
        {"name": "recommends-sync-mode", "text": "Recommends EvalMode.sync_full or EvalMode.sync_cpu for debugging"},
        {"name": "no-scatter-evaluate", "text": "Does not recommend adding .evaluate() after every operation as the primary debugging approach"},
        {"name": "correct-evalmode-syntax", "text": "Uses correct context manager syntax: with ndd.EvalMode.sync_full: (not ndd.eval_mode(...) or other invented API)"},
        {"name": "correct-sample-inspection", "text": "When inspecting intermediate values, uses batch.select(i).cpu() or np.asarray(batch.select(i).cpu()) — not batch[i] or batch.as_cpu().as_array()"},
        {"name": "code-examples-no-pipeline-mode", "text": "All code examples in the guide use dynamic mode patterns (ndd.decoders.image, ndd.resize, etc.) — no fn.* or ndd.fn.* operators in any code snippet"},
        {"name": "code-examples-device-gpu", "text": "All code examples use device='gpu' for decode, NOT device='mixed'"}
      ]
    },
    {
      "id": 5,
      "prompt": "I need to train a speech classification model on WAV files using PyTorch. Write a complete Python script that uses DALI dynamic mode for the data loading and audio feature extraction (mel spectrograms). My audio clips have different durations.",
      "expected_output": "Uses ndd.readers, ndd.decoders.audio(), spectral ops, handles variable-length via .torch(pad=True)",
      "files": [],
      "assertions": [
        {"name": "correct-import", "text": "Uses import nvidia.dali.experimental.dynamic as ndd"},
        {"name": "device-gpu-not-mixed", "text": "Uses device='gpu' for audio decode, NOT device='mixed'"},
        {"name": "reader-pascalcase", "text": "Reader class is PascalCase (e.g. ndd.readers.File)"},
        {"name": "reader-stateful", "text": "Reader created once and reused across epochs via next_epoch()"},
        {"name": "torch-pad-true", "text": "Uses .torch(pad=True) to handle variable-length spectrograms when converting to PyTorch"},
        {"name": "no-pipeline-mode", "text": "No pipeline-mode constructs (no @pipeline_def, pipe.build(), pipe.run()) and operators called directly on ndd (e.g. ndd.resize, not fn.resize or ndd.fn.resize)"}
      ]
    },
    {
      "id": 6,
      "prompt": "Write a complete Python script for an object detection training pipeline using DALI dynamic mode and PyTorch. It should read COCO-format images and annotations, apply random horizontal flip as augmentation (both images and their bounding boxes), resize, normalize, and feed to a model.",
      "expected_output": "DALI reader with bbox support, coordinated augmentation via ndd.random, correct dynamic mode patterns",
      "files": [],
      "assertions": [
        {"name": "correct-import", "text": "Uses import nvidia.dali.experimental.dynamic as ndd"},
        {"name": "batch-size-to-random", "text": "Passes batch_size to the coin_flip/random operator"},
        {"name": "device-gpu-not-mixed", "text": "Uses device='gpu' for decode, NOT device='mixed'"},
        {"name": "next-epoch-iteration", "text": "Uses reader.next_epoch(batch_size=N) for iteration"},
        {"name": "torch-pad-true", "text": "Uses .torch(pad=True) for bounding boxes (ragged — different images have different numbers of boxes)"},
        {"name": "no-pipeline-mode", "text": "No pipeline-mode constructs (no @pipeline_def, pipe.build(), pipe.run()) and operators called directly on ndd (e.g. ndd.resize, not fn.resize or ndd.fn.resize)"},
        {"name": "coordinated-flip", "text": "The same coin_flip Batch is passed to both ndd.flip (images) and ndd.bb_flip (bounding boxes) — not two separate independent coin flips"}
      ]
    }
  ]
}
