Spaces:
Running on Zero
Running on Zero
Finish loading in pyharp's worker before process_fn can reserve a GPU.
Browse files
app.py
CHANGED
|
@@ -74,7 +74,15 @@ def download_beat_checkpoint():
|
|
| 74 |
beat_checkpoint_ready.set()
|
| 75 |
|
| 76 |
|
| 77 |
-
threading.Thread(target=download_beat_checkpoint, daemon=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
|
| 80 |
model_card = ModelCard(
|
|
|
|
| 74 |
beat_checkpoint_ready.set()
|
| 75 |
|
| 76 |
|
| 77 |
+
_loader = threading.Thread(target=download_beat_checkpoint, daemon=True)
|
| 78 |
+
_loader.start()
|
| 79 |
+
|
| 80 |
+
# pyharp's worker imports this file to reach process_fn (as __mp_main__ rather than
|
| 81 |
+
# __main__), so it finishes loading here, before process_fn can reserve a GPU, instead
|
| 82 |
+
# of racing the check there. The server itself keeps loading in the background, which
|
| 83 |
+
# lets it start at once.
|
| 84 |
+
if __name__ != "__main__":
|
| 85 |
+
_loader.join()
|
| 86 |
|
| 87 |
|
| 88 |
model_card = ModelCard(
|