Skip to content
Claude CodedebugData & ML16 files · +349 −68

Debug Modal fine-tuning script for MiniCPM5-1B and migrate HF repo paths

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

51msession
1interventions
GOAL

Fix a failing Modal training job for fine-tuning MiniCPM5-1B on Indian FMCG product names, then generate model cards and migrate all HuggingFace repo references to a new hackathon org.

  1. Prompt · +0
    Fix this Modal training script error: SFTTrainer needs a formatting_func for chat/messages format dataset
  2. Agent did · +0m
    Added a formatting_func applying the tokenizer's chat template to convert messages into training text
  3. Fail · +3m
    Same traceback again — Unsloth passes batches not single examples to formatting_func
  4. Agent did · +3m
    Rewrote formatting_func to accept a batch dict and return a list of strings
  5. Intervention · +5m
    Still crashing on the probe call; told the agent to 'research and fix properly' instead of patching again
    Why: The quick patches kept breaking on the same root cause, so I wanted a proper fix, not another band-aid.
  6. Agent did · +5m
    Switched approach: pre-mapped dataset to a 'text' column and used dataset_text_field instead of formatting_func, per Unsloth's recommended pattern
  7. Fail · +13m
    Training succeeded but GGUF conversion failed — llama.cpp installer calls input() in non-interactive container
  8. Agent did · +13m
    Pre-installed curl, git, cmake, libssl-dev, libcurl4-openssl-dev in the Modal image so Unsloth skips the interactive prompt
  9. Fail · +29m
    Job completed but HF repo only had gitignore/readme — no model files uploaded
  10. Agent did · +29m
    Found Unsloth appends '_gguf' to the output path so upload scanned the wrong dir; fixed path, then generated model cards for MiniCPM5-1B and YOLO26n, and migrated all naazimsnh02/ HF repo references across ~15 files to build-small-hackathon/ org
  11. Outcome · +51m
    Training pipeline fixed end-to-end (3 root causes resolved), model published to HF with correct files, two model cards generated, and all repo references migrated across the codebase with zero stragglers on final grep
VERDICT

Next time I'd paste the full Unsloth/Modal error and ask for the actual root cause up front instead of letting quick patches loop on the same symptom. Telling it to 'research and fix properly' after the second identical crash is what got us off the formatting_func rabbit hole and onto the dataset_text_field fix that actually worked. The rest — GGUF path bug, org migration — went smoothly once the trainer itself was solid.

I tried this · 0

Discussion · 0

How Builds work