Use reentrant generation lock (#6107)

This commit is contained in:
theo77186 2024-06-13 04:25:05 +02:00 committed by GitHub
parent a36fa73071
commit b675151f25
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -32,7 +32,7 @@ import sys
import time import time
from functools import partial from functools import partial
from pathlib import Path from pathlib import Path
from threading import Lock, Thread from threading import RLock, Thread
import yaml import yaml
@ -243,7 +243,7 @@ if __name__ == "__main__":
if shared.args.lora: if shared.args.lora:
add_lora_to_model(shared.args.lora) add_lora_to_model(shared.args.lora)
shared.generation_lock = Lock() shared.generation_lock = RLock()
if shared.args.idle_timeout > 0: if shared.args.idle_timeout > 0:
timer_thread = Thread(target=unload_model_if_idle) timer_thread = Thread(target=unload_model_if_idle)