* Update official url for cuda 12-2 wheels

* Fix preview for audio to image

* Prevent download loop when remote is unreachable

* Prevent download loop when remote is unreachable

* changes (#444)

* Tidy up monkey patch

* Use cpu core count for concurrency count

* Dynamic concurrency_count for ideal Gradio performance

* Conditional download face analyser models

* Fix testing via pre_check()

* Introduce checking to process manager for blocking the UI

* Introduce checking to process manager for blocking the UI

* Introduce checking to process manager for blocking the UI

* Introduce checking to process manager for blocking the UI

* Move the blocking while model download to the correct position

* Remove unused imports

---------

Co-authored-by: Harisreedhar <46858047+harisreedhar@users.noreply.github.com>
This commit is contained in:
Henry Ruhs
2024-03-20 10:02:08 +01:00
committed by GitHub
co-authored by Harisreedhar
parent 1e2031e149
commit 6e67d7bff6
21 changed files with 133 additions and 52 deletions
@@ -1,5 +1,6 @@
from typing import Any, List, Literal, Optional
from argparse import ArgumentParser
from time import sleep
import cv2
import threading
import numpy
@@ -87,6 +88,8 @@ def get_frame_processor() -> Any:
global FRAME_PROCESSOR
with THREAD_LOCK:
while process_manager.is_checking():
sleep(0.5)
if FRAME_PROCESSOR is None:
model_path = get_options('model').get('path')
FRAME_PROCESSOR = onnxruntime.InferenceSession(model_path, providers = apply_execution_provider_options(facefusion.globals.execution_providers))
@@ -131,7 +134,9 @@ def pre_check() -> bool:
if not facefusion.globals.skip_download:
download_directory_path = resolve_relative_path('../.assets/models')
model_url = get_options('model').get('url')
process_manager.check()
conditional_download(download_directory_path, [ model_url ])
process_manager.end()
return True
@@ -1,5 +1,6 @@
from typing import Any, List, Literal, Optional
from argparse import ArgumentParser
from time import sleep
import threading
import numpy
import onnx
@@ -99,6 +100,8 @@ def get_frame_processor() -> Any:
global FRAME_PROCESSOR
with THREAD_LOCK:
while process_manager.is_checking():
sleep(0.5)
if FRAME_PROCESSOR is None:
model_path = get_options('model').get('path')
FRAME_PROCESSOR = onnxruntime.InferenceSession(model_path, providers = apply_execution_provider_options(facefusion.globals.execution_providers))
@@ -115,6 +118,8 @@ def get_model_matrix() -> Any:
global MODEL_MATRIX
with THREAD_LOCK:
while process_manager.is_checking():
sleep(0.5)
if MODEL_MATRIX is None:
model_path = get_options('model').get('path')
model = onnx.load(model_path)
@@ -171,7 +176,9 @@ def pre_check() -> bool:
if not facefusion.globals.skip_download:
download_directory_path = resolve_relative_path('../.assets/models')
model_url = get_options('model').get('url')
process_manager.check()
conditional_download(download_directory_path, [ model_url ])
process_manager.end()
return True
@@ -1,5 +1,6 @@
from typing import Any, List, Literal, Optional
from argparse import ArgumentParser
from time import sleep
import threading
import cv2
import numpy
@@ -69,6 +70,8 @@ def get_frame_processor() -> Any:
global FRAME_PROCESSOR
with THREAD_LOCK:
while process_manager.is_checking():
sleep(0.5)
if FRAME_PROCESSOR is None:
model_path = get_options('model').get('path')
FRAME_PROCESSOR = onnxruntime.InferenceSession(model_path, providers = apply_execution_provider_options(facefusion.globals.execution_providers))
@@ -113,7 +116,9 @@ def pre_check() -> bool:
if not facefusion.globals.skip_download:
download_directory_path = resolve_relative_path('../.assets/models')
model_url = get_options('model').get('url')
process_manager.check()
conditional_download(download_directory_path, [ model_url ])
process_manager.end()
return True
@@ -1,5 +1,6 @@
from typing import Any, List, Literal, Optional
from argparse import ArgumentParser
from time import sleep
import threading
import cv2
import numpy
@@ -45,6 +46,8 @@ def get_frame_processor() -> Any:
global FRAME_PROCESSOR
with THREAD_LOCK:
while process_manager.is_checking():
sleep(0.5)
if FRAME_PROCESSOR is None:
model_path = get_options('model').get('path')
FRAME_PROCESSOR = onnxruntime.InferenceSession(model_path, providers = apply_execution_provider_options(facefusion.globals.execution_providers))
@@ -87,7 +90,9 @@ def pre_check() -> bool:
if not facefusion.globals.skip_download:
download_directory_path = resolve_relative_path('../.assets/models')
model_url = get_options('model').get('url')
process_manager.check()
conditional_download(download_directory_path, [ model_url ])
process_manager.end()
return True