Skip to content
Claude CodedebugData & ML1 file · +129 −88

Fix MiniCPM-V fine-tuning pipeline on Modal with Unsloth

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

30msession
0interventions
GOAL

Debug and fix a Modal-based fine-tuning script for MiniCPM-V that was failing on dataset construction, and get the training pipeline running end to end for the June 2026 model/library versions.

  1. Prompt · +0
    Research the model properly, check samples, and fix the Modal training script failing with an Arrow cast error on the images column, as of June 2026.
  2. Agent did · +0m
    Researched MiniCPM-V fine-tuning, found root cause was Dataset.from_list storing images as strings then failing cast_column to Sequence(HFImage), fixed by loading PIL images directly in build_chat_sample and removing cast_column.
  3. Prompt · +13m
    Instead of loading images inline, push a proper HF dataset via hf cli and check if train_minicpm5_1b.py needs the same fix.
  4. Agent did · +16m
    Found deeper issue: messages.content mixed strings and lists causing Arrow type conflict; rewrote train_minicpm_v.py to build and push a proper HF dataset (two-step workflow); confirmed train_minicpm5_1b.py was unaffected since its content fields are all strings.
  5. Outcome · +30m
    Dataset push succeeded: 450 train + 50 test examples pushed to naazimsnh02/kirana-invoice-train-data on HF Hub.
VERDICT

Next time I'd tell the agent upfront to check the model card on Hugging Face for the exact transformers version needed, since half the debugging loop was chasing version mismatches (MiniCPM-V-4.6 model_type not registered, then peft/transformers pin conflicts) that a single doc check would have caught. Pushing a real HF dataset instead of trying to patch Arrow casting in place was the fix that actually worked — the inline PIL image and mixed-type messages column was never going to serialize cleanly.

I tried this · 0

Discussion · 0

How Builds work