Skip to content
Claude CodedebugData & ML3 files · +36 −23

Fix Modal fine-tuning scripts for YOLO26n and MiniCPM-V before running

Session from kirana-detective-build-traces on Hugging Face by build-small-hackathon · MIT · condensed by Coders Talk

22msession
0interventions
GOAL

Review three Modal fine-tuning scripts (YOLO26n, MiniCPM-V 4.6, MiniCPM5-1B) against current June 2026 official docs before running them, and fix any bugs so they run cleanly on Modal.

  1. Prompt · +0
    Check the three finetune scripts (YOLO26n, MiniCPM-V, MiniCPM5-1B) before I run them on Modal — research official June 2026 MiniCPM training docs and confirm the scripts are correct.
  2. Agent did · +0m
    Read all three fine-tune scripts and dispatched research subagents to check current Unsloth VLM patterns and MiniCPM-V/MiniCPM5-1B status as of June 2026.
  3. Agent did · +2m
    Applied fixes across all three scripts: corrected pip extras/version pins, fixed image-path vs PIL Image handling, added missing UnslothVisionDataCollator, and fixed ONNX export path capture in the YOLO script.
  4. Fail · +12m
    modal run of train_minicpm_v.py failed during image build with repeated apt-get 404 errors from a stale Debian bookworm package index.
  5. Agent did · +13m
    Diagnosed that .run_commands("apt-get install...") skipped apt-get update; switched to Modal's .apt_install() which refreshes the index, and dropped the unneeded ffmpeg dependency.
  6. Fail · +21m
    Image built successfully but training crashed with a pyarrow ArrowInvalid error — PIL Image objects could not be serialized into the HuggingFace Arrow dataset.
  7. Agent did · +22m
    Reworked the dataset build to store image file paths in a separate 'images' column, cast it with datasets.Image(), used a {'type':'image'} placeholder in messages, and relied on UnslothVisionDataCollator to pair them at training time — the standard Unsloth VLM pattern.
  8. Outcome · +22m
    Session ends with the dataset-format fix applied and a retry of 'modal run finetune/train_minicpm_v.py' queued; two build/runtime failures (apt 404s, Arrow/PIL serialization) were diagnosed and fixed in sequence.
VERDICT

Next time I'd ask it to actually dry-run or at least trace the Modal image build and dataset serialization steps against Unsloth's current examples, not just review the code — the static review missed both the apt-get ordering bug and the PIL/Arrow serialization issue, which only showed up once I actually ran it on Modal. The fix that did the real work was switching to .apt_install() for a fresh package index and moving images into a separate datasets.Image() column instead of embedding PIL objects directly.

I tried this · 0

Discussion · 0

How Builds work