* Reduce caching to avoid RAM explosion

* Reduce caching to avoid RAM explosion

* Reduce caching to avoid RAM explosion

* fix bounding_box scale

* Bump to 3.4.2

* More conservative on audio caching

* Fix coverage issue

* Fix coverage issue

---------

Co-authored-by: harisreedhar <h4harisreedhar.s.s@gmail.com>
This commit is contained in:
Henry Ruhs
2025-10-29 11:51:42 +01:00
committed by GitHub
parent f3be23d19b
commit 189d750621
6 changed files with 10 additions and 14 deletions

2
.coveragerc Normal file
View File

@@ -0,0 +1,2 @@
[run]
patch = subprocess

View File

@@ -11,7 +11,7 @@ from facefusion.types import Audio, AudioFrame, Fps, Mel, MelFilterBank, Spectro
from facefusion.voice_extractor import batch_extract_voice
@lru_cache()
@lru_cache(maxsize = 64)
def read_static_audio(audio_path : str, fps : Fps) -> Optional[List[AudioFrame]]:
return read_audio(audio_path, fps)
@@ -31,7 +31,7 @@ def read_audio(audio_path : str, fps : Fps) -> Optional[List[AudioFrame]]:
return None
@lru_cache()
@lru_cache(maxsize = 64)
def read_static_voice(audio_path : str, fps : Fps) -> Optional[List[AudioFrame]]:
return read_voice(audio_path, fps)

View File

@@ -41,7 +41,7 @@ def conditional_download(download_directory_path : str, urls : List[str]) -> Non
progress.update(current_size - progress.n)
@lru_cache(maxsize = 1024)
@lru_cache(maxsize = 64)
def get_static_download_size(url : str) -> int:
commands = curl_builder.chain(
curl_builder.head(url),
@@ -59,7 +59,7 @@ def get_static_download_size(url : str) -> int:
return 0
@lru_cache(maxsize = 1024)
@lru_cache(maxsize = 64)
def ping_static_url(url : str) -> bool:
commands = curl_builder.chain(
curl_builder.head(url),

View File

@@ -128,13 +128,7 @@ def scale_face(target_face : Face, target_vision_frame : VisionFrame, temp_visio
scale_x = temp_vision_frame.shape[1] / target_vision_frame.shape[1]
scale_y = temp_vision_frame.shape[0] / target_vision_frame.shape[0]
bounding_box =\
[
target_face.bounding_box * scale_x,
target_face.bounding_box * scale_y,
target_face.bounding_box * scale_x,
target_face.bounding_box * scale_y
]
bounding_box = target_face.bounding_box * [ scale_x, scale_y, scale_x, scale_y ]
landmark_set =\
{
'5': target_face.landmark_set.get('5') * numpy.array([ scale_x, scale_y ]),

View File

@@ -4,7 +4,7 @@ METADATA =\
{
'name': 'FaceFusion',
'description': 'Industry leading face manipulation platform',
'version': '3.4.1',
'version': '3.4.2',
'license': 'OpenRAIL-AS',
'author': 'Henry Ruhs',
'url': 'https://facefusion.io'

View File

@@ -22,7 +22,7 @@ def read_static_images(image_paths : List[str]) -> List[VisionFrame]:
return vision_frames
@lru_cache(maxsize = 1024)
@lru_cache(maxsize = 64)
def read_static_image(image_path : str) -> Optional[VisionFrame]:
return read_image(image_path)
@@ -65,7 +65,7 @@ def restrict_image_resolution(image_path : str, resolution : Resolution) -> Reso
return resolution
@lru_cache(maxsize = 1024)
@lru_cache(maxsize = 64)
def read_static_video_frame(video_path : str, frame_number : int = 0) -> Optional[VisionFrame]:
return read_video_frame(video_path, frame_number)