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
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.
- +0Prompt · +0Research 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.
- +0mAgent did · +0mResearched 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.
- +13mPrompt · +13mInstead of loading images inline, push a proper HF dataset via hf cli and check if train_minicpm5_1b.py needs the same fix.
- +16mAgent did · +16mFound 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.
- +30mOutcome · +30mDataset push succeeded: 450 train + 50 test examples pushed to naazimsnh02/kirana-invoice-train-data on HF Hub.
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.