Spaces:
Build error
Build error
Improve ZeroGPU compatibility
#2
by hysts HF Staff - opened
Hi @haodongli , I noticed a couple of things that could be improved for ZeroGPU, so I'm opening this PR.
- Eager model loading: Moved checkpoint download and
load_model()to module level. On ZeroGPU, models loaded at startup are automatically managed (moved between CPU/GPU) by the backend, so there's no need to spend GPU quota time on initialization. - Frame limit: Added a cap of 300 frames to avoid loading arbitrarily long videos into memory, which could cause OOM or ZeroGPU quota timeout. The limit and
duration=90are tentative. Feel free to adjust if you have better numbers in mind. read_video_limited(): A small wrapper around the same cv2 logic inread_video(), just with an early stop atMAX_FRAMESso it doesn't load the entire video upfront.
hysts changed pull request status to open
haodongli changed pull request status to merged
