Fix: Move model load inside @spaces.GPU to prevent CPU OOM crash
#4
by specimba - opened
The current app.py loads the 67GB model at module level (outside @spaces.GPU), which crashes during Gradio startup on CPU. This PR moves model loading into a lazy cache inside @spaces.GPU, so it only loads when GPU is active. Also increases GPU duration from 180s to 300s to accommodate cold model load.
Changes:
- Replace module-level
AutoTokenizer.from_pretrained+AutoModelForCausalLM.from_pretrainedwith lazy_load()inside@spaces.GPU - Increase duration from 180s to 300s
- Add
_model_cacheto avoid reloading per call
specimba changed pull request status to open
specimba changed pull request status to merged