IDU 0.2.0: add decider-4b as a second backend
Browse files
app.py
CHANGED
|
@@ -749,17 +749,18 @@ def health():
|
|
| 749 |
"the GPU worker and model_in_web_process will read False by design.")}
|
| 750 |
|
| 751 |
|
|
|
|
| 752 |
def warmup_decider() -> dict:
|
| 753 |
"""Build decider-4b and run one real decision, so both backends are warm at startup.
|
| 754 |
|
| 755 |
-
|
| 756 |
-
|
| 757 |
-
|
|
|
|
|
|
|
| 758 |
|
| 759 |
-
|
| 760 |
-
|
| 761 |
-
"cuda" at import time is not possible. `_decider_move_to_gpu` degrades to CPU rather
|
| 762 |
-
than raising, so this returns a result either way and the device is reported.
|
| 763 |
"""
|
| 764 |
try:
|
| 765 |
get_decider()
|
|
|
|
| 749 |
"the GPU worker and model_in_web_process will read False by design.")}
|
| 750 |
|
| 751 |
|
| 752 |
+
@GPU
|
| 753 |
def warmup_decider() -> dict:
|
| 754 |
"""Build decider-4b and run one real decision, so both backends are warm at startup.
|
| 755 |
|
| 756 |
+
DECORATED WITH @GPU, which is not optional here. Without it this runs outside any GPU
|
| 757 |
+
context: on ZeroGPU `torch.cuda.is_available()` can still report True while no device is
|
| 758 |
+
actually attached, so moving the model fails inside the CUDA runtime with
|
| 759 |
+
"no CUDA-capable device is detected". The decorated call is the only place a device
|
| 760 |
+
exists.
|
| 761 |
|
| 762 |
+
Kept separate from `warmup` so a decider failure cannot take Laya down with it -- the
|
| 763 |
+
two are independent services sharing a UI.
|
|
|
|
|
|
|
| 764 |
"""
|
| 765 |
try:
|
| 766 |
get_decider()
|