Spaces:
Running on Zero
Running on Zero
Commit History
-
Add ZeroGPU support alongside CPU
legitcoconut +1: Claude Opus 5 (1M context)Same codebase now runs on either free tier, switching on the SPACES_ZERO_GPU env var HF sets — no code edit needed to change hardware. - import spaces before torch, so the CUDA emulation layer is installed in time for a module-level .to("cuda") - place the model on DEVICE at load, not lazily inside @spaces.GPU (docs: lazy placement is "significantly less efficient") - decorate classify with @spaces.GPU(duration=30), outside torch.no_grad; a short duration improves queue priority - root-level load_model() under ZeroGPU - no-op decorator fallback when the spaces package is absent, so CPU Spaces and local dev are unaffected - requirements: drop the pytorch CPU index (ZeroGPU needs CUDA wheels), add spaces, pin torch==2.8.0 (supported set is 2.8.0/2.9.1/2.10.0/2.11.0) - skip torch.set_num_threads on GPU - document that ZeroGPU's daily quota is billed to the CALLER: Code Arena is unauthenticated, so 2 min/day — CPU basic stays the right choice for batch checking during a live…5c893da -
DroidDetect-Large code authorship checker
legitcoconute84edab