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
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.
- +0Prompt · +0Phase 1 code is written; deploy the Modal backend, smoke-test generation, and run the Gradio app locally. Getting ModuleNotFoundError: No module named 'config'.
- +0mAgent did · +0mTraced 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.
- +10mAgent did · +10mConfirmed Qwen generated real CBSE MCQs on Modal; fixed a Gradio 6.0 crash caused by the removed `theme` kwarg on gr.Blocks.
- +25mFail · +25mLocal test worked but a fresh Modal run hit the same ModuleNotFoundError: No module named 'config' again — the deployed container still had the old code.
- +25mAgent did · +25mDiagnosed 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.
- +35mAgent did · +35mBuilt 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.
- +1h 30mFail · +1h 30mWorksheet/homework/quiz output showed the difficulty agent's verbose validation report instead of actual student-facing questions.
- +1h 30mAgent did · +1h 30mTraced 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.
- +1h 33mAgent did · +1h 33mBuilt 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.
- Break · 31m away, not counted
- +2h 10mOutcome · +2h 10mAll 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.
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.