Skip to content
Claude Code · Claude Sonnet 4.6featureBackend15 files · +1084 −173

Deploy TutorDesk AI on Modal + Gradio with Qwen3-4B and MiniCPM-V

Session from tutordesk-agent-traces on Hugging Face by naazimsnh02 · MIT · condensed by Coders Talk

2h 10msession
0interventions
GOAL

Get TutorDesk AI's phased build (Modal-hosted Qwen3-4B and MiniCPM-V, Gradio front end) fully deployed and working end to end, then fine-tune Qwen3-4B on NCERT data for a custom model.

  1. Prompt · +0
    Phase 1 code is written; deploy the Modal backend, smoke-test generation, and run the Gradio app locally. Getting ModuleNotFoundError: No module named 'config'.
  2. Agent did · +0m
    Traced the error to Modal only mounting modal_app.py (not config.py); inlined the two config constants used so the serving module is self-contained.
  3. Agent did · +10m
    Confirmed Qwen generated real CBSE MCQs on Modal; fixed a Gradio 6.0 crash caused by the removed `theme` kwarg on gr.Blocks.
  4. Fail · +25m
    Local test worked but a fresh Modal run hit the same ModuleNotFoundError: No module named 'config' again — the deployed container still had the old code.
  5. Agent did · +25m
    Diagnosed that the fix was never redeployed; ran `modal deploy` to push the fix, then confirmed it worked and committed Phase 1 (Weekly Teaching Pack) with progress.md updates.
  6. Agent did · +35m
    Built Phase 2 (Worksheet-from-Textbook): implemented MiniCPM-V load/read_image on Modal, a thin client, and the Gradio tab; iteratively fixed Qwen thinking-tag leakage, a MiniCPM device_map crash, then a transformers 5.x incompatibility by pinning transformers<5.0 and adding an HF token secret.
  7. Fail · +1h 30m
    Worksheet/homework/quiz output showed the difficulty agent's verbose validation report instead of actual student-facing questions.
  8. Agent did · +1h 30m
    Traced the bug to the difficulty agent's prompt asking for a 'validation report'; rewrote it to output only labeled questions, fixing the pipeline output, and committed.
  9. Agent did · +1h 33m
    Built Phase 3: data prep scripts, LoRA fine-tune job on Modal for Qwen3-4B, fixing a string of errors (vol.commit misuse, duplicate volume files, TRL API churn across versions, tokenizer padding mismatch) by ultimately dropping SFTTrainer for plain transformers.Trainer; training completed and a model card was pushed to HF Hub.
  10. Break · 31m away, not counted
  11. Outcome · +2h 10m
    All three phases shipped and committed: Weekly Teaching Pack, Worksheet-from-Textbook (MiniCPM-V), and a fine-tuned Qwen3-4B model published at huggingface.co/naazimsnh02/tutordesk-qwen3-4b with a model card.
VERDICT

Next time I'd tell it upfront which library versions are pinned (transformers, TRL) since half the debugging loop was chasing breaking API changes across versions I hadn't pinned. The fix that actually mattered was catching that the difficulty agent's prompt was leaking a validation report into the student-facing output — that one silently broke the core feature until I actually read the generated content. Ending with a deployed app across three phases and a fine-tuned model on the Hub felt worth the churn.

I tried this · 0

Discussion · 0

How Builds work