Spaces:
Runtime error
Runtime error
jjyang77
commited on
Commit
·
9184913
1
Parent(s):
c614380
trade num threads and speed for stability
Browse files- api/app.py +4 -1
api/app.py
CHANGED
|
@@ -45,7 +45,10 @@ def create_app() -> FastAPI:
|
|
| 45 |
Evaluate the correctness of the solutions in the given samples data.
|
| 46 |
"""
|
| 47 |
if parallel < 1:
|
| 48 |
-
n_workers =
|
|
|
|
|
|
|
|
|
|
| 49 |
else:
|
| 50 |
n_workers = parallel
|
| 51 |
|
|
|
|
| 45 |
Evaluate the correctness of the solutions in the given samples data.
|
| 46 |
"""
|
| 47 |
if parallel < 1:
|
| 48 |
+
n_workers = min(4, multiprocessing.cpu_count() // 2)
|
| 49 |
+
if n_workers < 1:
|
| 50 |
+
n_workers = 1
|
| 51 |
+
|
| 52 |
else:
|
| 53 |
n_workers = parallel
|
| 54 |
|