Spaces:
Sleeping
Sleeping
Commit History
-
fix: use bfloat16 instead of float16 for HAT GPU inference
HAT's residual stream isn't scaled between attention blocks, so its magnitude compounds across the 4 RHAG groups. A real checkpoint run showed it reaching ~4.6M in fp32, far past float16's ~65504 max. The production GPU path autocasts to float16, so it silently overflowed to NaN/Inf partway through the stack; those NaNs then rendered as solid black PNGs. bfloat16 keeps fp32's exponent range so it doesn't overflow here, without losing the speed/memory benefit of 16-bit inference. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>ff62b77 -
fix: use a plain module-level @spaces.GPU function, not a bound method
Decorating InferenceEngine.run_user_file directly was wrong: ZeroGPU forks a worker process and sends the call's args through a pickled multiprocessing queue. Since it's a bound method, `self` (the whole engine, including the loaded HAT model) got pickled and sent across that boundary. ZeroGPU's disk-offload tracking keys off the *original* tensor objects, so the unpickled copy in the worker was never recognized/materialized onto the GPU — conv2d kept hitting a placeholder tensor, same error as before. Add a plain top-level run_gpu_inference(file_path, model_name) that takes only small picklable arguments and reaches the model through the module-level `inference_engine` global, which the forked worker inherits for free via fork() instead of pickling. Both the Gradio handler and the REST /api/upload endpoint now call this single shared entrypoint (the latter via run_in_threadpool, since it's async and the call blocks on GPU scheduling). Co-Authored-By: Claude Sonnet 5 <noreply@anthrop…8ac6b2e -
fix: decorate InferenceEngine.run_user_file with @spaces.GPU
The REST /api/upload endpoint called inference_engine.run_user_file() directly, outside any @spaces.GPU context. ZeroGPU keeps model weights disk-offloaded until code runs inside a @spaces.GPU-decorated function, so conv2d hit a placeholder tensor: "Cannot apply function ... on disk-offloaded Tensor". Only the Gradio test tab worked, since its handler was separately decorated. Decorate the shared run_user_file method instead of each call site, and drop the now-redundant decorator on the Gradio handler to avoid nesting two ZeroGPU schedule calls in the same request. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>56da09b -
chore: add app files
7529108