Source Code added
This commit is contained in:
parent
800376eafd
commit
9efa9bc6dd
3912 changed files with 754770 additions and 2 deletions
12
machine-learning/immich_ml/gunicorn_conf.py
Normal file
12
machine-learning/immich_ml/gunicorn_conf.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import os
|
||||
|
||||
from gunicorn.arbiter import Arbiter
|
||||
from gunicorn.workers.base import Worker
|
||||
|
||||
device_ids = os.environ.get("MACHINE_LEARNING_DEVICE_IDS", "0").replace(" ", "").split(",")
|
||||
env = os.environ
|
||||
|
||||
|
||||
# Round-robin device assignment for each worker
|
||||
def pre_fork(arbiter: Arbiter, _: Worker) -> None:
|
||||
env["MACHINE_LEARNING_DEVICE_ID"] = device_ids[len(arbiter.WORKERS) % len(device_ids)]
|
||||
Loading…
Add table
Add a link
Reference in a new issue