Use resolve_download_url() everywhere, Vanish --skip-download flag
This commit is contained in:
parent
efd4071a3e
commit
44b4c926da
@ -103,7 +103,6 @@ execution_queue_count =
|
|||||||
|
|
||||||
[download]
|
[download]
|
||||||
download_providers =
|
download_providers =
|
||||||
skip_download =
|
|
||||||
|
|
||||||
[memory]
|
[memory]
|
||||||
video_memory_strategy =
|
video_memory_strategy =
|
||||||
|
@ -120,7 +120,6 @@ def apply_args(args : Args, apply_state_item : ApplyStateItem) -> None:
|
|||||||
apply_state_item('execution_queue_count', args.get('execution_queue_count'))
|
apply_state_item('execution_queue_count', args.get('execution_queue_count'))
|
||||||
# download
|
# download
|
||||||
apply_state_item('download_providers', args.get('download_providers'))
|
apply_state_item('download_providers', args.get('download_providers'))
|
||||||
apply_state_item('skip_download', args.get('skip_download'))
|
|
||||||
# memory
|
# memory
|
||||||
apply_state_item('video_memory_strategy', args.get('video_memory_strategy'))
|
apply_state_item('video_memory_strategy', args.get('video_memory_strategy'))
|
||||||
apply_state_item('system_memory_limit', args.get('system_memory_limit'))
|
apply_state_item('system_memory_limit', args.get('system_memory_limit'))
|
||||||
|
@ -5,7 +5,7 @@ import numpy
|
|||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
from facefusion import inference_manager, state_manager, wording
|
from facefusion import inference_manager, state_manager, wording
|
||||||
from facefusion.download import conditional_download_hashes, conditional_download_sources
|
from facefusion.download import conditional_download_hashes, conditional_download_sources, resolve_download_url
|
||||||
from facefusion.filesystem import resolve_relative_path
|
from facefusion.filesystem import resolve_relative_path
|
||||||
from facefusion.thread_helper import conditional_thread_semaphore
|
from facefusion.thread_helper import conditional_thread_semaphore
|
||||||
from facefusion.typing import Fps, InferencePool, ModelOptions, ModelSet, VisionFrame
|
from facefusion.typing import Fps, InferencePool, ModelOptions, ModelSet, VisionFrame
|
||||||
@ -26,7 +26,7 @@ def create_static_model_set() -> ModelSet:
|
|||||||
{
|
{
|
||||||
'content_analyser':
|
'content_analyser':
|
||||||
{
|
{
|
||||||
'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/open_nsfw.hash',
|
'url': resolve_download_url('models-3.0.0', 'open_nsfw.hash'),
|
||||||
'path': resolve_relative_path('../.assets/models/open_nsfw.hash')
|
'path': resolve_relative_path('../.assets/models/open_nsfw.hash')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -34,7 +34,7 @@ def create_static_model_set() -> ModelSet:
|
|||||||
{
|
{
|
||||||
'content_analyser':
|
'content_analyser':
|
||||||
{
|
{
|
||||||
'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/open_nsfw.onnx',
|
'url': resolve_download_url('models-3.0.0', 'open_nsfw.onnx'),
|
||||||
'path': resolve_relative_path('../.assets/models/open_nsfw.onnx')
|
'path': resolve_relative_path('../.assets/models/open_nsfw.onnx')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -52,14 +52,13 @@ def conditional_download_hashes(hashes : DownloadSet) -> bool:
|
|||||||
hash_paths = [ hashes.get(hash_key).get('path') for hash_key in hashes.keys() ]
|
hash_paths = [ hashes.get(hash_key).get('path') for hash_key in hashes.keys() ]
|
||||||
|
|
||||||
process_manager.check()
|
process_manager.check()
|
||||||
if not state_manager.get_item('skip_download'):
|
_, invalid_hash_paths = validate_hash_paths(hash_paths)
|
||||||
_, invalid_hash_paths = validate_hash_paths(hash_paths)
|
if invalid_hash_paths:
|
||||||
if invalid_hash_paths:
|
for index in hashes:
|
||||||
for index in hashes:
|
if hashes.get(index).get('path') in invalid_hash_paths:
|
||||||
if hashes.get(index).get('path') in invalid_hash_paths:
|
invalid_hash_url = hashes.get(index).get('url')
|
||||||
invalid_hash_url = hashes.get(index).get('url')
|
download_directory_path = os.path.dirname(hashes.get(index).get('path'))
|
||||||
download_directory_path = os.path.dirname(hashes.get(index).get('path'))
|
conditional_download(download_directory_path, [ invalid_hash_url ])
|
||||||
conditional_download(download_directory_path, [ invalid_hash_url ])
|
|
||||||
|
|
||||||
valid_hash_paths, invalid_hash_paths = validate_hash_paths(hash_paths)
|
valid_hash_paths, invalid_hash_paths = validate_hash_paths(hash_paths)
|
||||||
for valid_hash_path in valid_hash_paths:
|
for valid_hash_path in valid_hash_paths:
|
||||||
@ -78,14 +77,13 @@ def conditional_download_sources(sources : DownloadSet) -> bool:
|
|||||||
source_paths = [ sources.get(source_key).get('path') for source_key in sources.keys() ]
|
source_paths = [ sources.get(source_key).get('path') for source_key in sources.keys() ]
|
||||||
|
|
||||||
process_manager.check()
|
process_manager.check()
|
||||||
if not state_manager.get_item('skip_download'):
|
_, invalid_source_paths = validate_source_paths(source_paths)
|
||||||
_, invalid_source_paths = validate_source_paths(source_paths)
|
if invalid_source_paths:
|
||||||
if invalid_source_paths:
|
for index in sources:
|
||||||
for index in sources:
|
if sources.get(index).get('path') in invalid_source_paths:
|
||||||
if sources.get(index).get('path') in invalid_source_paths:
|
invalid_source_url = sources.get(index).get('url')
|
||||||
invalid_source_url = sources.get(index).get('url')
|
download_directory_path = os.path.dirname(sources.get(index).get('path'))
|
||||||
download_directory_path = os.path.dirname(sources.get(index).get('path'))
|
conditional_download(download_directory_path, [ invalid_source_url ])
|
||||||
conditional_download(download_directory_path, [ invalid_source_url ])
|
|
||||||
|
|
||||||
valid_source_paths, invalid_source_paths = validate_source_paths(source_paths)
|
valid_source_paths, invalid_source_paths = validate_source_paths(source_paths)
|
||||||
for valid_source_path in valid_source_paths:
|
for valid_source_path in valid_source_paths:
|
||||||
|
@ -4,7 +4,7 @@ from typing import List, Tuple
|
|||||||
import numpy
|
import numpy
|
||||||
|
|
||||||
from facefusion import inference_manager
|
from facefusion import inference_manager
|
||||||
from facefusion.download import conditional_download_hashes, conditional_download_sources
|
from facefusion.download import conditional_download_hashes, conditional_download_sources, resolve_download_url
|
||||||
from facefusion.face_helper import warp_face_by_face_landmark_5
|
from facefusion.face_helper import warp_face_by_face_landmark_5
|
||||||
from facefusion.filesystem import resolve_relative_path
|
from facefusion.filesystem import resolve_relative_path
|
||||||
from facefusion.thread_helper import conditional_thread_semaphore
|
from facefusion.thread_helper import conditional_thread_semaphore
|
||||||
@ -21,7 +21,7 @@ def create_static_model_set() -> ModelSet:
|
|||||||
{
|
{
|
||||||
'face_classifier':
|
'face_classifier':
|
||||||
{
|
{
|
||||||
'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/fairface.hash',
|
'url': resolve_download_url('models-3.0.0', 'fairface.hash'),
|
||||||
'path': resolve_relative_path('../.assets/models/fairface.hash')
|
'path': resolve_relative_path('../.assets/models/fairface.hash')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -29,7 +29,7 @@ def create_static_model_set() -> ModelSet:
|
|||||||
{
|
{
|
||||||
'face_classifier':
|
'face_classifier':
|
||||||
{
|
{
|
||||||
'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/fairface.onnx',
|
'url': resolve_download_url('models-3.0.0', 'fairface.onnx'),
|
||||||
'path': resolve_relative_path('../.assets/models/fairface.onnx')
|
'path': resolve_relative_path('../.assets/models/fairface.onnx')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -5,7 +5,7 @@ import numpy
|
|||||||
from charset_normalizer.md import lru_cache
|
from charset_normalizer.md import lru_cache
|
||||||
|
|
||||||
from facefusion import inference_manager, state_manager
|
from facefusion import inference_manager, state_manager
|
||||||
from facefusion.download import conditional_download_hashes, conditional_download_sources
|
from facefusion.download import conditional_download_hashes, conditional_download_sources, resolve_download_url
|
||||||
from facefusion.face_helper import create_rotated_matrix_and_size, create_static_anchors, distance_to_bounding_box, distance_to_face_landmark_5, normalize_bounding_box, transform_bounding_box, transform_points
|
from facefusion.face_helper import create_rotated_matrix_and_size, create_static_anchors, distance_to_bounding_box, distance_to_face_landmark_5, normalize_bounding_box, transform_bounding_box, transform_points
|
||||||
from facefusion.filesystem import resolve_relative_path
|
from facefusion.filesystem import resolve_relative_path
|
||||||
from facefusion.thread_helper import thread_semaphore
|
from facefusion.thread_helper import thread_semaphore
|
||||||
@ -23,7 +23,7 @@ def create_static_model_set() -> ModelSet:
|
|||||||
{
|
{
|
||||||
'retinaface':
|
'retinaface':
|
||||||
{
|
{
|
||||||
'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/retinaface_10g.hash',
|
'url': resolve_download_url('models-3.0.0', 'retinaface_10g.hash'),
|
||||||
'path': resolve_relative_path('../.assets/models/retinaface_10g.hash')
|
'path': resolve_relative_path('../.assets/models/retinaface_10g.hash')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -31,7 +31,7 @@ def create_static_model_set() -> ModelSet:
|
|||||||
{
|
{
|
||||||
'retinaface':
|
'retinaface':
|
||||||
{
|
{
|
||||||
'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/retinaface_10g.onnx',
|
'url': resolve_download_url('models-3.0.0', 'retinaface_10g.onnx'),
|
||||||
'path': resolve_relative_path('../.assets/models/retinaface_10g.onnx')
|
'path': resolve_relative_path('../.assets/models/retinaface_10g.onnx')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -42,7 +42,7 @@ def create_static_model_set() -> ModelSet:
|
|||||||
{
|
{
|
||||||
'scrfd':
|
'scrfd':
|
||||||
{
|
{
|
||||||
'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/scrfd_2.5g.hash',
|
'url': resolve_download_url('models-3.0.0', 'scrfd_2.5g.hash'),
|
||||||
'path': resolve_relative_path('../.assets/models/scrfd_2.5g.hash')
|
'path': resolve_relative_path('../.assets/models/scrfd_2.5g.hash')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -50,7 +50,7 @@ def create_static_model_set() -> ModelSet:
|
|||||||
{
|
{
|
||||||
'scrfd':
|
'scrfd':
|
||||||
{
|
{
|
||||||
'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/scrfd_2.5g.onnx',
|
'url': resolve_download_url('models-3.0.0', 'scrfd_2.5g.onnx'),
|
||||||
'path': resolve_relative_path('../.assets/models/scrfd_2.5g.onnx')
|
'path': resolve_relative_path('../.assets/models/scrfd_2.5g.onnx')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ def create_static_model_set() -> ModelSet:
|
|||||||
{
|
{
|
||||||
'yoloface':
|
'yoloface':
|
||||||
{
|
{
|
||||||
'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/yoloface_8n.hash',
|
'url': resolve_download_url('models-3.0.0', 'yoloface_8n.hash'),
|
||||||
'path': resolve_relative_path('../.assets/models/yoloface_8n.hash')
|
'path': resolve_relative_path('../.assets/models/yoloface_8n.hash')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -69,7 +69,7 @@ def create_static_model_set() -> ModelSet:
|
|||||||
{
|
{
|
||||||
'yoloface':
|
'yoloface':
|
||||||
{
|
{
|
||||||
'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/yoloface_8n.onnx',
|
'url': resolve_download_url('models-3.0.0', 'yoloface_8n.onnx'),
|
||||||
'path': resolve_relative_path('../.assets/models/yoloface_8n.onnx')
|
'path': resolve_relative_path('../.assets/models/yoloface_8n.onnx')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import cv2
|
|||||||
import numpy
|
import numpy
|
||||||
|
|
||||||
from facefusion import inference_manager, state_manager
|
from facefusion import inference_manager, state_manager
|
||||||
from facefusion.download import conditional_download_hashes, conditional_download_sources
|
from facefusion.download import conditional_download_hashes, conditional_download_sources, resolve_download_url
|
||||||
from facefusion.face_helper import create_rotated_matrix_and_size, estimate_matrix_by_face_landmark_5, transform_points, warp_face_by_translation
|
from facefusion.face_helper import create_rotated_matrix_and_size, estimate_matrix_by_face_landmark_5, transform_points, warp_face_by_translation
|
||||||
from facefusion.filesystem import resolve_relative_path
|
from facefusion.filesystem import resolve_relative_path
|
||||||
from facefusion.thread_helper import conditional_thread_semaphore
|
from facefusion.thread_helper import conditional_thread_semaphore
|
||||||
@ -22,7 +22,7 @@ def create_static_model_set() -> ModelSet:
|
|||||||
{
|
{
|
||||||
'2dfan4':
|
'2dfan4':
|
||||||
{
|
{
|
||||||
'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/2dfan4.hash',
|
'url': resolve_download_url('models-3.0.0', '2dfan4.hash'),
|
||||||
'path': resolve_relative_path('../.assets/models/2dfan4.hash')
|
'path': resolve_relative_path('../.assets/models/2dfan4.hash')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -30,7 +30,7 @@ def create_static_model_set() -> ModelSet:
|
|||||||
{
|
{
|
||||||
'2dfan4':
|
'2dfan4':
|
||||||
{
|
{
|
||||||
'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/2dfan4.onnx',
|
'url': resolve_download_url('models-3.0.0', '2dfan4.onnx'),
|
||||||
'path': resolve_relative_path('../.assets/models/2dfan4.onnx')
|
'path': resolve_relative_path('../.assets/models/2dfan4.onnx')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -42,7 +42,7 @@ def create_static_model_set() -> ModelSet:
|
|||||||
{
|
{
|
||||||
'peppa_wutz':
|
'peppa_wutz':
|
||||||
{
|
{
|
||||||
'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/peppa_wutz.hash',
|
'url': resolve_download_url('models-3.0.0', 'peppa_wutz.hash'),
|
||||||
'path': resolve_relative_path('../.assets/models/peppa_wutz.hash')
|
'path': resolve_relative_path('../.assets/models/peppa_wutz.hash')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -50,7 +50,7 @@ def create_static_model_set() -> ModelSet:
|
|||||||
{
|
{
|
||||||
'peppa_wutz':
|
'peppa_wutz':
|
||||||
{
|
{
|
||||||
'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/peppa_wutz.onnx',
|
'url': resolve_download_url('models-3.0.0', 'peppa_wutz.onnx'),
|
||||||
'path': resolve_relative_path('../.assets/models/peppa_wutz.onnx')
|
'path': resolve_relative_path('../.assets/models/peppa_wutz.onnx')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -62,7 +62,7 @@ def create_static_model_set() -> ModelSet:
|
|||||||
{
|
{
|
||||||
'fan_68_5':
|
'fan_68_5':
|
||||||
{
|
{
|
||||||
'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/fan_68_5.hash',
|
'url': resolve_download_url('models-3.0.0', 'fan_68_5.hash'),
|
||||||
'path': resolve_relative_path('../.assets/models/fan_68_5.hash')
|
'path': resolve_relative_path('../.assets/models/fan_68_5.hash')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -70,7 +70,7 @@ def create_static_model_set() -> ModelSet:
|
|||||||
{
|
{
|
||||||
'fan_68_5':
|
'fan_68_5':
|
||||||
{
|
{
|
||||||
'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/fan_68_5.onnx',
|
'url': resolve_download_url('models-3.0.0', 'fan_68_5.onnx'),
|
||||||
'path': resolve_relative_path('../.assets/models/fan_68_5.onnx')
|
'path': resolve_relative_path('../.assets/models/fan_68_5.onnx')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import numpy
|
|||||||
from cv2.typing import Size
|
from cv2.typing import Size
|
||||||
|
|
||||||
from facefusion import inference_manager
|
from facefusion import inference_manager
|
||||||
from facefusion.download import conditional_download_hashes, conditional_download_sources
|
from facefusion.download import conditional_download_hashes, conditional_download_sources, resolve_download_url
|
||||||
from facefusion.filesystem import resolve_relative_path
|
from facefusion.filesystem import resolve_relative_path
|
||||||
from facefusion.thread_helper import conditional_thread_semaphore
|
from facefusion.thread_helper import conditional_thread_semaphore
|
||||||
from facefusion.typing import DownloadSet, FaceLandmark68, FaceMaskRegion, InferencePool, Mask, ModelSet, Padding, VisionFrame
|
from facefusion.typing import DownloadSet, FaceLandmark68, FaceMaskRegion, InferencePool, Mask, ModelSet, Padding, VisionFrame
|
||||||
@ -36,7 +36,7 @@ def create_static_model_set() -> ModelSet:
|
|||||||
{
|
{
|
||||||
'face_occluder':
|
'face_occluder':
|
||||||
{
|
{
|
||||||
'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.1.0/xseg_groggy_5.hash',
|
'url': resolve_download_url('models-3.1.0', 'xseg_groggy_5.hash'),
|
||||||
'path': resolve_relative_path('../.assets/models/xseg_groggy_5.hash')
|
'path': resolve_relative_path('../.assets/models/xseg_groggy_5.hash')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -44,7 +44,7 @@ def create_static_model_set() -> ModelSet:
|
|||||||
{
|
{
|
||||||
'face_occluder':
|
'face_occluder':
|
||||||
{
|
{
|
||||||
'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.1.0/xseg_groggy_5.onnx',
|
'url': resolve_download_url('models-3.1.0', 'xseg_groggy_5.onnx'),
|
||||||
'path': resolve_relative_path('../.assets/models/xseg_groggy_5.onnx')
|
'path': resolve_relative_path('../.assets/models/xseg_groggy_5.onnx')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -56,7 +56,7 @@ def create_static_model_set() -> ModelSet:
|
|||||||
{
|
{
|
||||||
'face_parser':
|
'face_parser':
|
||||||
{
|
{
|
||||||
'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/bisenet_resnet_34.hash',
|
'url': resolve_download_url('models-3.0.0', 'bisenet_resnet_34.hash'),
|
||||||
'path': resolve_relative_path('../.assets/models/bisenet_resnet_34.hash')
|
'path': resolve_relative_path('../.assets/models/bisenet_resnet_34.hash')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -64,7 +64,7 @@ def create_static_model_set() -> ModelSet:
|
|||||||
{
|
{
|
||||||
'face_parser':
|
'face_parser':
|
||||||
{
|
{
|
||||||
'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/bisenet_resnet_34.onnx',
|
'url': resolve_download_url('models-3.0.0', 'bisenet_resnet_34'),
|
||||||
'path': resolve_relative_path('../.assets/models/bisenet_resnet_34.onnx')
|
'path': resolve_relative_path('../.assets/models/bisenet_resnet_34.onnx')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -4,7 +4,7 @@ from typing import Tuple
|
|||||||
import numpy
|
import numpy
|
||||||
|
|
||||||
from facefusion import inference_manager
|
from facefusion import inference_manager
|
||||||
from facefusion.download import conditional_download_hashes, conditional_download_sources
|
from facefusion.download import conditional_download_hashes, conditional_download_sources, resolve_download_url
|
||||||
from facefusion.face_helper import warp_face_by_face_landmark_5
|
from facefusion.face_helper import warp_face_by_face_landmark_5
|
||||||
from facefusion.filesystem import resolve_relative_path
|
from facefusion.filesystem import resolve_relative_path
|
||||||
from facefusion.thread_helper import conditional_thread_semaphore
|
from facefusion.thread_helper import conditional_thread_semaphore
|
||||||
@ -21,7 +21,7 @@ def create_static_model_set() -> ModelSet:
|
|||||||
{
|
{
|
||||||
'face_recognizer':
|
'face_recognizer':
|
||||||
{
|
{
|
||||||
'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/arcface_w600k_r50.hash',
|
'url': resolve_download_url('models-3.0.0', 'arcface_w600k_r50.hash'),
|
||||||
'path': resolve_relative_path('../.assets/models/arcface_w600k_r50.hash')
|
'path': resolve_relative_path('../.assets/models/arcface_w600k_r50.hash')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -29,7 +29,7 @@ def create_static_model_set() -> ModelSet:
|
|||||||
{
|
{
|
||||||
'face_recognizer':
|
'face_recognizer':
|
||||||
{
|
{
|
||||||
'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/arcface_w600k_r50.onnx',
|
'url': resolve_download_url('models-3.0.0', 'arcface_w600k_r50.onnx'),
|
||||||
'path': resolve_relative_path('../.assets/models/arcface_w600k_r50.onnx')
|
'path': resolve_relative_path('../.assets/models/arcface_w600k_r50.onnx')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -207,14 +207,6 @@ def create_download_providers_program() -> ArgumentParser:
|
|||||||
return program
|
return program
|
||||||
|
|
||||||
|
|
||||||
def create_skip_download_program() -> ArgumentParser:
|
|
||||||
program = ArgumentParser(add_help = False)
|
|
||||||
group_download = program.add_argument_group('download')
|
|
||||||
group_download.add_argument('--skip-download', help = wording.get('help.skip_download'), action = 'store_true', default = config.get_bool_value('misc.skip_download'))
|
|
||||||
job_store.register_job_keys([ 'skip_download' ])
|
|
||||||
return program
|
|
||||||
|
|
||||||
|
|
||||||
def create_memory_program() -> ArgumentParser:
|
def create_memory_program() -> ArgumentParser:
|
||||||
program = ArgumentParser(add_help = False)
|
program = ArgumentParser(add_help = False)
|
||||||
group_memory = program.add_argument_group('memory')
|
group_memory = program.add_argument_group('memory')
|
||||||
@ -256,7 +248,7 @@ def collect_step_program() -> ArgumentParser:
|
|||||||
|
|
||||||
|
|
||||||
def collect_job_program() -> ArgumentParser:
|
def collect_job_program() -> ArgumentParser:
|
||||||
return ArgumentParser(parents= [ create_execution_program(), create_download_providers_program(), create_skip_download_program(), create_memory_program(), create_log_level_program() ], add_help = False)
|
return ArgumentParser(parents= [ create_execution_program(), create_download_providers_program(), create_memory_program(), create_log_level_program() ], add_help = False)
|
||||||
|
|
||||||
|
|
||||||
def create_program() -> ArgumentParser:
|
def create_program() -> ArgumentParser:
|
||||||
|
@ -249,7 +249,6 @@ StateKey = Literal\
|
|||||||
'execution_thread_count',
|
'execution_thread_count',
|
||||||
'execution_queue_count',
|
'execution_queue_count',
|
||||||
'download_providers',
|
'download_providers',
|
||||||
'skip_download',
|
|
||||||
'video_memory_strategy',
|
'video_memory_strategy',
|
||||||
'system_memory_limit',
|
'system_memory_limit',
|
||||||
'log_level',
|
'log_level',
|
||||||
@ -310,7 +309,6 @@ State = TypedDict('State',
|
|||||||
'execution_thread_count' : int,
|
'execution_thread_count' : int,
|
||||||
'execution_queue_count' : int,
|
'execution_queue_count' : int,
|
||||||
'download_providers' : List[DownloadProviderKey],
|
'download_providers' : List[DownloadProviderKey],
|
||||||
'skip_download' : bool,
|
|
||||||
'video_memory_strategy' : VideoMemoryStrategy,
|
'video_memory_strategy' : VideoMemoryStrategy,
|
||||||
'system_memory_limit' : int,
|
'system_memory_limit' : int,
|
||||||
'log_level' : LogLevel,
|
'log_level' : LogLevel,
|
||||||
|
@ -5,7 +5,7 @@ from facefusion.uis.typing import JobManagerAction, JobRunnerAction, WebcamMode
|
|||||||
job_manager_actions : List[JobManagerAction] = [ 'job-create', 'job-submit', 'job-delete', 'job-add-step', 'job-remix-step', 'job-insert-step', 'job-remove-step' ]
|
job_manager_actions : List[JobManagerAction] = [ 'job-create', 'job-submit', 'job-delete', 'job-add-step', 'job-remix-step', 'job-insert-step', 'job-remove-step' ]
|
||||||
job_runner_actions : List[JobRunnerAction] = [ 'job-run', 'job-run-all', 'job-retry', 'job-retry-all' ]
|
job_runner_actions : List[JobRunnerAction] = [ 'job-run', 'job-run-all', 'job-retry', 'job-retry-all' ]
|
||||||
|
|
||||||
common_options : List[str] = [ 'keep-temp', 'skip-audio', 'skip-download' ]
|
common_options : List[str] = [ 'keep-temp', 'skip-audio' ]
|
||||||
|
|
||||||
webcam_modes : List[WebcamMode] = [ 'inline', 'udp', 'v4l2' ]
|
webcam_modes : List[WebcamMode] = [ 'inline', 'udp', 'v4l2' ]
|
||||||
webcam_resolutions : List[str] = [ '320x240', '640x480', '800x600', '1024x768', '1280x720', '1280x960', '1920x1080', '2560x1440', '3840x2160' ]
|
webcam_resolutions : List[str] = [ '320x240', '640x480', '800x600', '1024x768', '1280x720', '1280x960', '1920x1080', '2560x1440', '3840x2160' ]
|
||||||
|
@ -13,8 +13,6 @@ def render() -> None:
|
|||||||
|
|
||||||
common_options = []
|
common_options = []
|
||||||
|
|
||||||
if state_manager.get_item('skip_download'):
|
|
||||||
common_options.append('skip-download')
|
|
||||||
if state_manager.get_item('keep_temp'):
|
if state_manager.get_item('keep_temp'):
|
||||||
common_options.append('keep-temp')
|
common_options.append('keep-temp')
|
||||||
if state_manager.get_item('skip_audio'):
|
if state_manager.get_item('skip_audio'):
|
||||||
@ -32,9 +30,7 @@ def listen() -> None:
|
|||||||
|
|
||||||
|
|
||||||
def update(common_options : List[str]) -> None:
|
def update(common_options : List[str]) -> None:
|
||||||
skip_temp = 'skip-download' in common_options
|
|
||||||
keep_temp = 'keep-temp' in common_options
|
keep_temp = 'keep-temp' in common_options
|
||||||
skip_audio = 'skip-audio' in common_options
|
skip_audio = 'skip-audio' in common_options
|
||||||
state_manager.set_item('skip_download', skip_temp)
|
|
||||||
state_manager.set_item('keep_temp', keep_temp)
|
state_manager.set_item('keep_temp', keep_temp)
|
||||||
state_manager.set_item('skip_audio', skip_audio)
|
state_manager.set_item('skip_audio', skip_audio)
|
||||||
|
@ -6,21 +6,19 @@ from facefusion.uis.components import about, age_modifier_options, benchmark, be
|
|||||||
|
|
||||||
|
|
||||||
def pre_check() -> bool:
|
def pre_check() -> bool:
|
||||||
if not state_manager.get_item('skip_download'):
|
conditional_download('.assets/examples',
|
||||||
conditional_download('.assets/examples',
|
[
|
||||||
[
|
resolve_download_url('examples-3.0.0', 'source.jpg'),
|
||||||
resolve_download_url('examples-3.0.0', 'source.jpg'),
|
resolve_download_url('examples-3.0.0', 'source.mp3'),
|
||||||
resolve_download_url('examples-3.0.0', 'source.mp3'),
|
resolve_download_url('examples-3.0.0', 'target-240p.mp4'),
|
||||||
resolve_download_url('examples-3.0.0', 'target-240p.mp4'),
|
resolve_download_url('examples-3.0.0', 'target-360p.mp4'),
|
||||||
resolve_download_url('examples-3.0.0', 'target-360p.mp4'),
|
resolve_download_url('examples-3.0.0', 'target-540p.mp4'),
|
||||||
resolve_download_url('examples-3.0.0', 'target-540p.mp4'),
|
resolve_download_url('examples-3.0.0', 'target-720p.mp4'),
|
||||||
resolve_download_url('examples-3.0.0', 'target-720p.mp4'),
|
resolve_download_url('examples-3.0.0', 'target-1080p.mp4'),
|
||||||
resolve_download_url('examples-3.0.0', 'target-1080p.mp4'),
|
resolve_download_url('examples-3.0.0', 'target-1440p.mp4'),
|
||||||
resolve_download_url('examples-3.0.0', 'target-1440p.mp4'),
|
resolve_download_url('examples-3.0.0', 'target-2160p.mp4')
|
||||||
resolve_download_url('examples-3.0.0', 'target-2160p.mp4')
|
])
|
||||||
])
|
return True
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def render() -> gradio.Blocks:
|
def render() -> gradio.Blocks:
|
||||||
|
@ -5,7 +5,7 @@ import numpy
|
|||||||
import scipy
|
import scipy
|
||||||
|
|
||||||
from facefusion import inference_manager
|
from facefusion import inference_manager
|
||||||
from facefusion.download import conditional_download_hashes, conditional_download_sources
|
from facefusion.download import conditional_download_hashes, conditional_download_sources, resolve_download_url
|
||||||
from facefusion.filesystem import resolve_relative_path
|
from facefusion.filesystem import resolve_relative_path
|
||||||
from facefusion.thread_helper import thread_semaphore
|
from facefusion.thread_helper import thread_semaphore
|
||||||
from facefusion.typing import Audio, AudioChunk, InferencePool, ModelOptions, ModelSet
|
from facefusion.typing import Audio, AudioChunk, InferencePool, ModelOptions, ModelSet
|
||||||
@ -21,7 +21,7 @@ def create_static_model_set() -> ModelSet:
|
|||||||
{
|
{
|
||||||
'voice_extractor':
|
'voice_extractor':
|
||||||
{
|
{
|
||||||
'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/kim_vocal_2.hash',
|
'url': resolve_download_url('models-3.0.0', 'kim_vocal_2.hash'),
|
||||||
'path': resolve_relative_path('../.assets/models/kim_vocal_2.hash')
|
'path': resolve_relative_path('../.assets/models/kim_vocal_2.hash')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -29,7 +29,7 @@ def create_static_model_set() -> ModelSet:
|
|||||||
{
|
{
|
||||||
'voice_extractor':
|
'voice_extractor':
|
||||||
{
|
{
|
||||||
'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/kim_vocal_2.onnx',
|
'url': resolve_download_url('models-3.0.0', 'kim_vocal_2.onnx'),
|
||||||
'path': resolve_relative_path('../.assets/models/kim_vocal_2.onnx')
|
'path': resolve_relative_path('../.assets/models/kim_vocal_2.onnx')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,6 @@ WORDING : Dict[str, Any] =\
|
|||||||
'execution_queue_count': 'specify the amount of frames each thread is processing',
|
'execution_queue_count': 'specify the amount of frames each thread is processing',
|
||||||
# download
|
# download
|
||||||
'download_providers': 'download using different providers (choices: {choices}, ...)',
|
'download_providers': 'download using different providers (choices: {choices}, ...)',
|
||||||
'skip_download': 'omit downloads and remote lookups',
|
|
||||||
# memory
|
# memory
|
||||||
'video_memory_strategy': 'balance fast processing and low VRAM usage',
|
'video_memory_strategy': 'balance fast processing and low VRAM usage',
|
||||||
'system_memory_limit': 'limit the available RAM that can be used while processing',
|
'system_memory_limit': 'limit the available RAM that can be used while processing',
|
||||||
|
@ -21,6 +21,7 @@ def before_all() -> None:
|
|||||||
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('source.jpg'), '-vf', 'crop=iw*0.6:ih*0.6', get_test_example_file('source-60crop.jpg') ])
|
subprocess.run([ 'ffmpeg', '-i', get_test_example_file('source.jpg'), '-vf', 'crop=iw*0.6:ih*0.6', get_test_example_file('source-60crop.jpg') ])
|
||||||
state_manager.init_item('execution_device_id', 0)
|
state_manager.init_item('execution_device_id', 0)
|
||||||
state_manager.init_item('execution_providers', [ 'cpu' ])
|
state_manager.init_item('execution_providers', [ 'cpu' ])
|
||||||
|
state_manager.init_item('download_providers', [ 'github' ])
|
||||||
state_manager.init_item('face_detector_angles', [ 0 ])
|
state_manager.init_item('face_detector_angles', [ 0 ])
|
||||||
state_manager.init_item('face_detector_model', 'many')
|
state_manager.init_item('face_detector_model', 'many')
|
||||||
state_manager.init_item('face_detector_score', 0.5)
|
state_manager.init_item('face_detector_score', 0.5)
|
||||||
|
@ -9,9 +9,10 @@ from facefusion.inference_manager import INFERENCE_POOLS, get_inference_pool
|
|||||||
|
|
||||||
@pytest.fixture(scope = 'module', autouse = True)
|
@pytest.fixture(scope = 'module', autouse = True)
|
||||||
def before_all() -> None:
|
def before_all() -> None:
|
||||||
content_analyser.pre_check()
|
|
||||||
state_manager.init_item('execution_device_id', 0)
|
state_manager.init_item('execution_device_id', 0)
|
||||||
state_manager.init_item('execution_providers', [ 'cpu' ])
|
state_manager.init_item('execution_providers', [ 'cpu' ])
|
||||||
|
state_manager.init_item('download_providers', [ 'github' ])
|
||||||
|
content_analyser.pre_check()
|
||||||
|
|
||||||
|
|
||||||
def test_get_inference_pool() -> None:
|
def test_get_inference_pool() -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user