mirror of
https://github.com/facefusion/facefusion.git
synced 2026-08-03 23:58:37 +02:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
218b78a1c9 |
+2
-1
@@ -5,7 +5,7 @@ import signal
|
|||||||
import sys
|
import sys
|
||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
from facefusion import benchmarker, cli_helper, content_analyser, hash_helper, logger, state_manager, translator
|
from facefusion import benchmarker, cli_helper, content_analyser, hash_helper, logger, memory_manager, state_manager, translator
|
||||||
from facefusion.args import apply_args, collect_job_args, reduce_job_args, reduce_step_args
|
from facefusion.args import apply_args, collect_job_args, reduce_job_args, reduce_step_args
|
||||||
from facefusion.download import conditional_download_hashes, conditional_download_sources
|
from facefusion.download import conditional_download_hashes, conditional_download_sources
|
||||||
from facefusion.exit_helper import hard_exit, signal_exit
|
from facefusion.exit_helper import hard_exit, signal_exit
|
||||||
@@ -305,6 +305,7 @@ def process_step(job_id : str, step_index : int, step_args : Args) -> bool:
|
|||||||
logger.info(translator.get('processing_step').format(step_current = step_index + 1, step_total = step_total), __name__)
|
logger.info(translator.get('processing_step').format(step_current = step_index + 1, step_total = step_total), __name__)
|
||||||
if common_pre_check() and processors_pre_check():
|
if common_pre_check() and processors_pre_check():
|
||||||
error_code = conditional_process()
|
error_code = conditional_process()
|
||||||
|
memory_manager.release_memory()
|
||||||
return error_code == 0
|
return error_code == 0
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
@@ -32,12 +32,10 @@ def get_inference_pool(module_name : str, model_names : List[str], model_source_
|
|||||||
for execution_device_id in execution_device_ids:
|
for execution_device_id in execution_device_ids:
|
||||||
inference_context = get_inference_context(module_name, model_names, execution_device_id, execution_providers)
|
inference_context = get_inference_context(module_name, model_names, execution_device_id, execution_providers)
|
||||||
|
|
||||||
if state_manager.get_item('video_memory_strategy') == 'tolerant':
|
if app_context == 'cli' and INFERENCE_POOL_SET.get('ui').get(inference_context):
|
||||||
if app_context == 'cli' and INFERENCE_POOL_SET.get('ui').get(inference_context):
|
INFERENCE_POOL_SET['cli'][inference_context] = INFERENCE_POOL_SET.get('ui').get(inference_context)
|
||||||
INFERENCE_POOL_SET['cli'][inference_context] = INFERENCE_POOL_SET.get('ui').get(inference_context)
|
if app_context == 'ui' and INFERENCE_POOL_SET.get('cli').get(inference_context):
|
||||||
if app_context == 'ui' and INFERENCE_POOL_SET.get('cli').get(inference_context):
|
INFERENCE_POOL_SET['ui'][inference_context] = INFERENCE_POOL_SET.get('cli').get(inference_context)
|
||||||
INFERENCE_POOL_SET['ui'][inference_context] = INFERENCE_POOL_SET.get('cli').get(inference_context)
|
|
||||||
|
|
||||||
if not INFERENCE_POOL_SET.get(app_context).get(inference_context):
|
if not INFERENCE_POOL_SET.get(app_context).get(inference_context):
|
||||||
inference_providers = resolve_static_inference_providers(module_name, execution_device_id)
|
inference_providers = resolve_static_inference_providers(module_name, execution_device_id)
|
||||||
INFERENCE_POOL_SET[app_context][inference_context] = create_inference_pool(model_source_set, inference_providers)
|
INFERENCE_POOL_SET[app_context][inference_context] = create_inference_pool(model_source_set, inference_providers)
|
||||||
@@ -51,7 +49,6 @@ def create_inference_pool(model_source_set : DownloadSet, inference_providers :
|
|||||||
|
|
||||||
for model_name in model_source_set.keys():
|
for model_name in model_source_set.keys():
|
||||||
model_path = model_source_set.get(model_name).get('path')
|
model_path = model_source_set.get(model_name).get('path')
|
||||||
|
|
||||||
if is_file(model_path):
|
if is_file(model_path):
|
||||||
inference_pool[model_name] = create_inference_session(model_path, inference_providers)
|
inference_pool[model_name] = create_inference_session(model_path, inference_providers)
|
||||||
|
|
||||||
@@ -68,7 +65,6 @@ def clear_inference_pool(module_name : str, model_names : List[str]) -> None:
|
|||||||
|
|
||||||
for execution_device_id in execution_device_ids:
|
for execution_device_id in execution_device_ids:
|
||||||
inference_context = get_inference_context(module_name, model_names, execution_device_id, execution_providers)
|
inference_context = get_inference_context(module_name, model_names, execution_device_id, execution_providers)
|
||||||
|
|
||||||
if INFERENCE_POOL_SET.get(app_context).get(inference_context):
|
if INFERENCE_POOL_SET.get(app_context).get(inference_context):
|
||||||
del INFERENCE_POOL_SET[app_context][inference_context]
|
del INFERENCE_POOL_SET[app_context][inference_context]
|
||||||
|
|
||||||
|
|||||||
@@ -19,17 +19,16 @@ LOCALES =\
|
|||||||
}
|
}
|
||||||
ONNXRUNTIME_SET =\
|
ONNXRUNTIME_SET =\
|
||||||
{
|
{
|
||||||
'default': ('onnxruntime', '1.28.0')
|
'default': ('onnxruntime', '1.26.0')
|
||||||
}
|
}
|
||||||
if is_windows() or is_linux():
|
if is_windows() or is_linux():
|
||||||
ONNXRUNTIME_SET['cuda@12'] = ('onnxruntime-gpu', '1.26.0')
|
ONNXRUNTIME_SET['cuda'] = ('onnxruntime-gpu', '1.26.0')
|
||||||
ONNXRUNTIME_SET['cuda@13'] = ('onnxruntime-gpu', '1.28.0')
|
|
||||||
ONNXRUNTIME_SET['openvino'] = ('onnxruntime-openvino', '1.24.1')
|
ONNXRUNTIME_SET['openvino'] = ('onnxruntime-openvino', '1.24.1')
|
||||||
if is_windows():
|
if is_windows():
|
||||||
ONNXRUNTIME_SET['directml'] = ('onnxruntime-directml', '1.24.4')
|
ONNXRUNTIME_SET['directml'] = ('onnxruntime-directml', '1.24.4')
|
||||||
ONNXRUNTIME_SET['qnn'] = ('onnxruntime-qnn', '2.4.0')
|
ONNXRUNTIME_SET['qnn'] = ('onnxruntime-qnn', '1.24.4')
|
||||||
if is_linux():
|
if is_linux():
|
||||||
ONNXRUNTIME_SET['migraphx'] = ('onnxruntime-migraphx', '1.27.1')
|
ONNXRUNTIME_SET['migraphx'] = ('onnxruntime-migraphx', '1.26.0')
|
||||||
ONNXRUNTIME_SET['rocm'] = ('onnxruntime-rocm', '1.22.2.post3')
|
ONNXRUNTIME_SET['rocm'] = ('onnxruntime-rocm', '1.22.2.post3')
|
||||||
|
|
||||||
|
|
||||||
@@ -64,7 +63,6 @@ def run(program : ArgumentParser) -> None:
|
|||||||
|
|
||||||
for line in file.readlines():
|
for line in file.readlines():
|
||||||
__line__ = line.strip()
|
__line__ = line.strip()
|
||||||
|
|
||||||
if not __line__.startswith('onnxruntime'):
|
if not __line__.startswith('onnxruntime'):
|
||||||
commands.append(__line__)
|
commands.append(__line__)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import ctypes
|
||||||
|
import ctypes.util
|
||||||
|
from functools import lru_cache
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
|
||||||
|
def pre_check() -> bool:
|
||||||
|
return create_static_library() is not None
|
||||||
|
|
||||||
|
|
||||||
|
@lru_cache
|
||||||
|
def create_static_library() -> Optional[ctypes.CDLL]:
|
||||||
|
library_path = ctypes.util.find_library('c')
|
||||||
|
|
||||||
|
if library_path:
|
||||||
|
library = ctypes.CDLL(library_path)
|
||||||
|
|
||||||
|
if hasattr(library, 'malloc_trim'):
|
||||||
|
return init_ctypes(library)
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def init_ctypes(library : ctypes.CDLL) -> ctypes.CDLL:
|
||||||
|
library.malloc_trim.argtypes = [ ctypes.c_size_t ]
|
||||||
|
library.malloc_trim.restype = ctypes.c_int
|
||||||
|
|
||||||
|
return library
|
||||||
@@ -4,7 +4,7 @@ METADATA =\
|
|||||||
{
|
{
|
||||||
'name': 'FaceFusion',
|
'name': 'FaceFusion',
|
||||||
'description': 'Industry leading face manipulation platform',
|
'description': 'Industry leading face manipulation platform',
|
||||||
'version': '3.8.1',
|
'version': '3.8.0',
|
||||||
'license': 'OpenRAIL-AS',
|
'license': 'OpenRAIL-AS',
|
||||||
'author': 'Henry Ruhs',
|
'author': 'Henry Ruhs',
|
||||||
'url': 'https://facefusion.io'
|
'url': 'https://facefusion.io'
|
||||||
|
|||||||
@@ -504,15 +504,15 @@ def clear_inference_pool() -> None:
|
|||||||
|
|
||||||
def adjust_inference_providers() -> List[InferenceProvider]:
|
def adjust_inference_providers() -> List[InferenceProvider]:
|
||||||
model_precision = get_model_options().get('precision')
|
model_precision = get_model_options().get('precision')
|
||||||
|
model_type = get_model_options().get('type')
|
||||||
|
|
||||||
if is_macos() and has_execution_provider('coreml') and model_precision == 'fp16':
|
if is_macos() and has_execution_provider('coreml'):
|
||||||
if state_manager.get_item('workflow_mode') == 'image-to-video':
|
if model_type in [ 'ghost', 'uniface' ] or model_precision == 'fp16':
|
||||||
return\
|
return\
|
||||||
[
|
[
|
||||||
(facefusion.choices.execution_provider_set.get('coreml'),
|
(facefusion.choices.execution_provider_set.get('coreml'),
|
||||||
{
|
{
|
||||||
'ModelFormat': 'MLProgram',
|
'ModelFormat': 'MLProgram'
|
||||||
'MLComputeUnits': 'CPUAndGPU'
|
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ gradio-rangeslider==0.0.8
|
|||||||
gradio==5.50.0
|
gradio==5.50.0
|
||||||
numpy==2.4.6
|
numpy==2.4.6
|
||||||
onnx==1.22.0
|
onnx==1.22.0
|
||||||
onnxruntime==1.28.0
|
onnxruntime==1.26.0
|
||||||
opencv-python-headless==5.0.0.93
|
opencv-python-headless==5.0.0.93
|
||||||
tqdm==4.70.0
|
tqdm==4.70.0
|
||||||
scipy==1.18.0
|
scipy==1.18.0
|
||||||
|
|||||||
Reference in New Issue
Block a user