Spaces:
Running on Zero
Running on Zero
Commit History
29 days ago
-
fix(zerogpu): persist quota ledger so a restart stops claiming phantom minutes
The adaptive lease sizing added in b5a8e39 clamps the requested GPU lease to the remaining daily allowance, but the tracker behind it was in-memory only. Every Space reload therefore reported a full 40 minutes while Hugging Face was already refusing leases, so the clamp saw headroom that did not exist and re-requested the full window: exactly the denial it was meant to avoid, and the reason the UI could show '31/40 min left' next to a GPU-limit 429. Persist the ledger to the Space's writable data directory (opt out with FLOW_QUOTA_LEDGER_PATH, disabled under pytest) and report zero remaining while a fresh platform refusal is on record, since an observed refusal outranks a ledger that only knows the leases this process watched.db08952
-
fix(quota): expire stale quota_exhausted_observed flag via TTL
AndrianBalanescuOne quota error used to stick the exhausted flag for the whole UTC day even when HF's rolling-24h window had actually freed up. Now the flag expires after FLOW_QUOTA_FLAG_TTL_S (default 2700s), mirroring the client-side guard in model_dispatcher.check_gpu_quota. A real generation attempt always arbitrates. Includes 2 new unit tests (15 pass).a29d413
-
feat(telemetry): record completion tokens for GPU throughput metric
AndrianBalanesculease_end now carries completion_tokens extracted from chat usage, so chat_throughput_tokens_per_gpu_second becomes live. Adds quota-error exhaustion test for the 429 mapping path.11732b0 -
fix(telemetry): detect cold start inside ZeroGPU worker body
AndrianBalanescuZeroGPU executes @spaces.GPU bodies in a worker process; get_model sets _llm/_loaded_file there and the globals never reach the web process, so the outer residency pre-check always saw no model and the -1.0 sentinel leaked into records (summary filtered it to 0.0). Residency is now evaluated inside the worker and returned with the result, which does propagate back. Regression test pins the worker-side semantics.54cef29 -
fix(telemetry): gpu_tracked_call must open lease before GPU body
AndrianBalanescuCaught live: /v1/gpu/status showed calls_total=0 after successful chat calls because gpu_tracked_call never called lease_start, so lease_end found no active call and dropped the record. Adds offline regression tests for the success and error paths with module-state isolation.3ef32ca -
feat(telemetry): ZeroGPU quota accounting in /v1/gpu/status (GOAL.md M3 line 54)
AndrianBalanescuGPUUsageTracker records wall-clock lease seconds per @spaces.GPU call (the honest billing unit), queue-wait upper bound, daily rollup against the 40 min/day PRO budget, quota-consumed percent, and quota-exhaustion state from 429 errors. gpu_tracked_call wraps the chat endpoint, the Gradio chat handler, and the warmup probe. /v1/gpu/status now returns a quota snapshot: {daily: {gpu_seconds_used, gpu_minutes_used, quota_consumed_percent, quota_exhausted_observed, ...}, profile: {avg_queue_wait_seconds, chat_throughput_tokens_per_gpu_second, total_calls}}. In-memory by design: single-process Space; GOAL.md requires no claims without live observation, and persistence would risk stale numbers masquerading as measured usage. 8 offline unit tests with injected fake clock (no ZeroGPU dependency). Suite: 148 passed, 1 skipped; verify_all.sh ALL CHECKS PASSED.de2772a