Spaces:
Running on Zero
Running on Zero
Download native_gpu.py from Reubencf/Kiku-Engine: direct link, hf CLI and curl.
- Browser
- Download file 505 Bytes
-
https://huggingface.co/spaces/Reubencf/Kiku-Engine/resolve/main/native_gpu.py
- Command line
-
hf download hf://spaces/Reubencf/Kiku-Engine/native_gpu.py
-
curl -L -o native_gpu.py https://huggingface.co/spaces/Reubencf/Kiku-Engine/resolve/main/native_gpu.py
505 Bytes
| """Serialize the shared CUDA handlers on Modal without ZeroGPU leases.""" | |
| from functools import wraps | |
| from threading import RLock | |
| lock = RLock() | |
| after_call = None | |
| def GPU(*, duration=None): | |
| def decorate(function): | |
| def invoke(*args, **kwargs): | |
| with lock: | |
| result = function(*args, **kwargs) | |
| if after_call is not None: | |
| after_call() | |
| return result | |
| return invoke | |
| return decorate | |