xaviviro / refacer Goto Github PK
View Code? Open in Web Editor NEWRefacer: One-Click Deepfake Multi-Face Swap Tool
License: MIT License
Refacer: One-Click Deepfake Multi-Face Swap Tool
License: MIT License
refacer colab dont work
queue 1/1 61s then something went wrong
Time out uploading data to server
Using the collab listed.
I screenshot the video with the destination face, upscaled it (and used raw) , it processed the video but didn't swap the face. Have used thresholds 0.2 and 1 with no effect. The video is only 3 seconds but that's still 75 frames.
What is best practice ? Size of photo used, video resolution etc? Size and number of characters on screen? What does the threshold refer to exactly?
Thanks for this version with gradio and extras, more fun to be had with better spoofs.
I'm not a programmer so maybe I broke something..
When I installed ROOP I didn't have any issues the installation was smooth.
I followed the steps in the main REFACER github.
Once I activated REFACER environment and install all GPU requirements, the last step was to run the "app.py"
Can somebody please help me make REFACER run, there are no tutorials beside the page but since I'm not a programmer probably it's more complicated to install compare to ROOP.
Thanks ahead! π
Gradio "live" sharing is known to be easily attackable by hackers, please let the program start in share=False mode (maybe just add --share argument if you want to use it) so the program could be used offline
η¨GPUηζΆεδΈη΄ζη€ΊθΏδΈͺοΌCould not locate zlibwapi.dll. Please make sure it is in your library path! ηΆεε°±θͺε·±ζ₯ιιεΊδΊ
Hello,
I tried the GPU installation instructions on Windows, but within a venv. It complained about the lack of torch libraries, so I reused the roop repo's GPU installation steps for refacer (not all items might have been necessary for refacer):
Refacer initially starts with an aggressive speed and estimate (6 minutes at 54it/s) , but seconds later changes to use a far slower speed (1 hour at 5.2it/s). By comparison, the CPU-only refacer configuration almost triples the execution time.
By contrast, the similar roop codebase - when configured for GPU use - currently requires less than 15 minutes from start to finish.
I noticed that GPU monitors from ASUS and the built-in from WIndows 10 show a max of ~35% utilization with low VRAM allocation while refacer is processing a video. Those same monitors show >90% GPU utilization and far higher memory usage while processing the same video.
Not sure if refacer code is intended to be less taxing on the GPU because of its unique processing logic, if this might be a potential symptom of using venv or if it's possibly a bug situation, but I wanted to report in case it offers a helpful user perspective.
Please add image support. It is possible to select image, but when I reface I got video with one frame.
both use same port. how can i change the port number. also it would be good if refacer detects if that port is already in use. and changes it to another port.
thanks
Thank you for this project,
Colab works like 4-6 it /s but even i use 4090 GPU, it's only doing 1 it on 5-6 secs.
I am sure i am missing something to make it use GPU.
I already installed requirements-GPU one but no speed increases
Hello,
I encountered an error with your application. When I select an input image and an output image, and click on the "REFACE" button, I receive the following error: module 'ffmpeg' has no attribute 'probe'
Also, I have installed the necessary dependencies for both CPU and GPU, and my graphics card (GeForce GTX 980) is compatible. However, I'm still experiencing this error:
"Trying FFMPEG h264_nvenc encoder
FFMPEG h264_nvenc encoder doesn't work -> Disabled"
Thanks for your help.
Please add support for DirectML, it would give acceleration for AMD Windows-based cards.
installed with tutorial, but when run app.py it seems like this:
Traceback (most recent call last):
File "D:\work\a\verify\refacer\app.py", line 17, in
refacer = Refacer(force_cpu=args.force_cpu,colab_performance=args.colab_performance)
File "D:\work\a\verify\refacer\refacer.py", line 32, in init
self.__check_encoders()
File "D:\work\a\verify\refacer\refacer.py", line 230, in __check_encoders
commandout = subprocess.run(command, check=True, capture_output=True).stdout
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 501, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 966, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1435, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
after I launch the program in the browser and choose a video an a picture, it does some processing and gives me the error below:
Extracting frames: 99%|βββββββββββββββββββββββββββββββββββββββ| 273/277 [00:00<00:00, 334.97it/s]
Processing frames: 100%|ββββββββββββββββββββββββββββββββββββββββ| 273/273 [03:09<00:00, 1.44it/s]
Merging audio with the refaced video...
Traceback (most recent call last):
File "/Users/mac/anaconda3/lib/python3.10/site-packages/gradio/routes.py", line 427, in run_predict
output = await app.get_blocks().process_api(
File "/Users/mac/anaconda3/lib/python3.10/site-packages/gradio/blocks.py", line 1323, in process_api
result = await self.call_function(
File "/Users/mac/anaconda3/lib/python3.10/site-packages/gradio/blocks.py", line 1051, in call_function
prediction = await anyio.to_thread.run_sync(
File "/Users/mac/anaconda3/lib/python3.10/site-packages/anyio/to_thread.py", line 28, in run_sync
return await get_asynclib().run_sync_in_worker_thread(func, *args, cancellable=cancellable,
File "/Users/mac/anaconda3/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 818, in run_sync_in_worker_thread
return await future
File "/Users/mac/anaconda3/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 754, in run
result = context.run(func, *args)
File "/Users/mac/develop/refacer/app.py", line 64, in run
return refacer.reface(video_path,faces)
File "/Users/mac/develop/refacer/refacer.py", line 222, in reface
return self.__convert_video(video_path,output_video_path)
File "/Users/mac/develop/refacer/refacer.py", line 126, in __convert_video
out.run(overwrite_output=True,quiet=True)
File "/Users/mac/anaconda3/lib/python3.10/site-packages/ffmpeg/_run.py", line 325, in run
raise Error('ffmpeg', out, err)
ffmpeg._run.Error: ffmpeg error (see stderr output for detail)
after installing i tryed to open link http://127.0.0.1:7680 in web-brouser. it shows "Unable to access the site". OC WIN10
This error pops up after muxing the frames and job completion. This doesn't seem to be affecting anything as app still works and does swapping repeatedly.
Exception in callback _ProactorBasePipeTransport._call_connection_lost(None)
handle: <Handle _ProactorBasePipeTransport._call_connection_lost(None)>
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\asyncio\events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "C:\Program Files\Python310\lib\asyncio\proactor_events.py", line 162, in _call_connection_lost
self._sock.shutdown(socket.SHUT_RDWR)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
Exception in callback _ProactorBasePipeTransport._call_connection_lost(None)
handle: <Handle _ProactorBasePipeTransport._call_connection_lost(None)>
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\asyncio\events.py", line 80, in _run
Command line would be useful or GUI like in roop for those who has problems running WebUI for example and maybe it's even already supported but there are no documentation for it as far as I know.
Everything fine, but when I try to make it work this error appears:
Something went wrong
ffmpeg error (see stderr output for detail)
What should I do to get throught this?
Hello,
The new memory management, working on smaller portions of the overall frame count at a time, has been very effective for me - thank you!
I did notice that my Temp directory was getting rather large recently, as it affected swap file size expansion, and it appears that Refacer is writing temporary files to a "gradio" folder in the Windows TEMP folder for videos upon which it works. I manually cleaned up gigabytes of files after discovering this, so wondered if Refacer might clear its temp folder upon startup as a consideration.
Hi!
Is it possible to solve high RAM consumption issue by splitting the video into parts, for example, 30 seconds each, processing them one by one and then combining them back together? Ffmpeg makes it quite easy to implement such a thing.
I tried implementing something similar with Roop and it worked.
installed everything that was needed, but when you run python app.py you get an error
the file app.py is in the folder refacer and all rights are granted to it
D:\reface\refacer>python app.py Traceback (most recent call last): File "D:\reface\refacer\app.py", line 11, in <module> refacer = Refacer(force_cpu=args.force_cpu) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\reface\refacer\refacer.py", line 30, in __init__ self.__check_encoders() File "D:\reface\refacer\refacer.py", line 195, in __check_encoders commandout = subprocess.run(command, check=True, capture_output=True).stdout ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jecer\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 548, in run with Popen(*popenargs, **kwargs) as process: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jecer\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1024, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Users\jecer\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1493, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [WinError 2] Cannot find specified file
It would be great if you could add render speed information in frames per second to the console. It would be visual, and it would also allow you to compare the performance of different devices
When I try to use large video of something like 1GB+ it gives me error in UI and logs as
Something went wrong Received empty file data.
self._sock.shutdown(socket.SHUT_RDWR)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
After the latest tensorrt update it crashes with the following errors:
gradio message: OpenCV(4.7.0) π error: (-5:Bad argument) in function 'warpAffine' > Overload resolution failed: > - M is not a numpy array, neither a scalar > - Expected Ptrcv::UMat for argument 'M'
Console message: Total frames: 1204
Extracting frames: 100%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 1204/1204 [00:00<00:00, 1585.98it/s]
Processing frames: 2%|ββ | 26/1204 [00:01<01:18, 15.05it/s]
Traceback (most recent call last):
File "K:\AI-APPS\refacer\venv\lib\site-packages\gradio\routes.py", line 427, in run_predict
output = await app.get_blocks().process_api(
File "K:\AI-APPS\refacer\venv\lib\site-packages\gradio\blocks.py", line 1323, in process_api
result = await self.call_function(
File "K:\AI-APPS\refacer\venv\lib\site-packages\gradio\blocks.py", line 1051, in call_function
prediction = await anyio.to_thread.run_sync(
File "K:\AI-APPS\refacer\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "K:\AI-APPS\refacer\venv\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "K:\AI-APPS\refacer\venv\lib\site-packages\anyio_backends_asyncio.py", line 807, in run
result = context.run(func, *args)
File "K:\AI-APPS\refacer\app.py", line 30, in run
return refacer.reface(video_path,faces)
File "K:\AI-APPS\refacer\refacer.py", line 171, in reface
results = list(tqdm(executor.map(self.__process_faces, frames), total=len(frames),desc="Processing frames"))
File "K:\AI-APPS\refacer\venv\lib\site-packages\tqdm\std.py", line 1178, in iter
for obj in iterable:
File "C:\Users\elias\AppData\Local\Programs\Python\Python310\lib\concurrent\futures_base.py", line 621, in result_iterator
yield _result_or_cancel(fs.pop())
File "C:\Users\elias\AppData\Local\Programs\Python\Python310\lib\concurrent\futures_base.py", line 319, in _result_or_cancel
return fut.result(timeout)
File "C:\Users\elias\AppData\Local\Programs\Python\Python310\lib\concurrent\futures_base.py", line 458, in result
return self.__get_result()
File "C:\Users\elias\AppData\Local\Programs\Python\Python310\lib\concurrent\futures_base.py", line 403, in __get_result
raise self._exception
File "C:\Users\elias\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "K:\AI-APPS\refacer\refacer.py", line 130, in __process_faces
faces = self.__get_faces(frame)
File "K:\AI-APPS\refacer\refacer.py", line 125, in __get_faces
face.embedding = self.rec_app.get(frame, kps)
File "K:\AI-APPS\refacer./recognition\arcface_onnx.py", line 65, in get
aimg = face_align.norm_crop(img, landmark=kps, image_size=self.input_size[0])
File "K:\AI-APPS\refacer./recognition\face_align.py", line 72, in norm_crop
warped = cv2.warpAffine(img, M, (image_size, image_size), borderValue=0.0)
cv2.error: OpenCV(4.7.0) π error: (-5:Bad argument) in function 'warpAffine'
Overload resolution failed:
- M is not a numpy array, neither a scalar
- Expected Ptrcv::UMat for argument 'M'
Windows 10
nvidia 3060 12GB
Python 3.10.9
Latest Tensorrt
Downloaded the onnx file from the loop
Successfully installed
There was no response after typing the command Python app. py
Manual alt c stop
$ python app.py
Trying FFMPEG h264_nvenc encoder
FFMPEG h264_nvenc encoder doesn't work -> Disabled.
Trying FFMPEG libx264 encoder
FFMPEG libx264 encoder works
Video codec for FFMPEG: libx264
CPU mode with providers ['CPUExecutionProvider']
inswapper-shape: [1, 3, 128, 128]
Running on local URL: http://127.0.0.1:7860
To create a public link, set share=True
in launch()
.
Keyboard interruption in main thread... closing server.
It seems like there's nothing wrong with the environment
Hi!
It may be good to add pipeline to image processing - for example, to use upscaler/face restorer after img making.
As an example, you can use this stuff: https://github.com/janvarev/chain-img-processor - there are framework, where pipeline stages adjusted as a separate plugins.
I've already implemented codeformer upscale/face restore, so it may be good to implement it in this project too.
There are two options to implement it:
This was happening in a similar manner yesterday, but as of the main branch at commit 63d501c , I am getting this error when attempting to run Refacer on a 380MB MP4 (h264):
Trying FFMPEG h264_nvenc encoder
FFMPEG h264_nvenc encoder works
Video codec for FFMPEG: h264_nvenc
CUDA mode with providers ['CUDAExecutionProvider', 'CPUExecutionProvider']
inswapper-shape: [1, 3, 128, 128]
Running on local URL: http://127.0.0.1:7860
To create a public link, set share=True
in launch()
.
Total frames: 52567
Extracting frames: 21%|ββββββββββββ | 11276/52567 [00:20<01:14, 557.87it/s]
Traceback (most recent call last):
File "D:\refacer-main\venv\lib\site-packages\gradio\routes.py", line 427, in run_predict
output = await app.get_blocks().process_api(
File "D:\refacer-main\venv\lib\site-packages\gradio\blocks.py", line 1323, in process_api
result = await self.call_function(
File "D:\refacer-main\venv\lib\site-packages\gradio\blocks.py", line 1051, in call_function
prediction = await anyio.to_thread.run_sync(
File "D:\refacer-main\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "D:\refacer-main\venv\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "D:\refacer-main\venv\lib\site-packages\anyio_backends_asyncio.py", line 807, in run
result = context.run(func, *args)
File "D:\refacer-main\app.py", line 31, in run
return refacer.reface(video_path,faces)
File "D:\refacer-main\refacer.py", line 196, in reface
flag, frame = cap.read()
cv2.error: OpenCV(4.7.0) D:\a\opencv-python\opencv-python\opencv\modules\core\src\alloc.cpp:73: error: (-4:Insufficient memory) Failed to allocate 2764800 bytes in function 'cv::OutOfMemoryError'
Although I have configured to use GPU (3090 with 24GB), the system RAM shot up from 17GB used to over 53GB (out of 64GB total) and I did not see GPU memory being allocated in the monitor.
As mentioned, I have experienced an out of memory error since the new (faster) codebase was pushed in the past day or so. While some files can process fine, I notice that smaller files are still hit-or-miss, so I can't supply a definite criteria of when this might occur.
Traceback (most recent call last):
File "/content/refacer/app.py", line 70, in
with gr.Blocks() as demo:
File "/usr/local/lib/python3.10/dist-packages/gradio/blocks.py", line 1478, in exit
self.app = routes.App.create_app(self)
File "/usr/local/lib/python3.10/dist-packages/gradio/routes.py", line 220, in create_app
def login(form_data: OAuth2PasswordRequestForm = Depends()):
File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 706, in decorator
self.add_api_route(
File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 645, in add_api_route
route = route_class(
File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 491, in init
self.dependant = get_dependant(path=self.path_format, call=self.endpoint)
File "/usr/local/lib/python3.10/dist-packages/fastapi/dependencies/utils.py", line 268, in get_dependant
sub_dependant = get_param_sub_dependant(
File "/usr/local/lib/python3.10/dist-packages/fastapi/dependencies/utils.py", line 111, in get_param_sub_dependant
return get_sub_dependant(
File "/usr/local/lib/python3.10/dist-packages/fastapi/dependencies/utils.py", line 147, in get_sub_dependant
sub_dependant = get_dependant(
File "/usr/local/lib/python3.10/dist-packages/fastapi/dependencies/utils.py", line 289, in get_dependant
add_param_to_fields(field=param_field, dependant=dependant)
File "/usr/local/lib/python3.10/dist-packages/fastapi/dependencies/utils.py", line 462, in add_param_to_fields
if field_info.in_ == params.ParamTypes.path:
AttributeError: 'FieldInfo' object has no attribute 'in_'
Use something like https://github.com/gaomingqi/Track-Anything to get face from video.
site-packages\gradio\frpc_windows_amd64_v0.2 can be used by intruders to damage computer or personal data.
HEUR:NetTool.Win64.FRP.gen
Any way to resolve this?
when i install refacer after roop. then roop dont work anymore. then i installed roop again. when i do this refacer dont work anymore:
i think it has something to do with cuda environment variables. here is the error i get:
`
PS C:\tools\refacer\refacer> python .\app.py
Trying FFMPEG h264_nvenc encoder
FFMPEG h264_nvenc encoder works
Video codec for FFMPEG: h264_nvenc
CUDA mode with providers ['CUDAExecutionProvider', 'CPUExecutionProvider']
EP Error D:\a_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:636 onnxruntime::python::CreateExecutionProviderInstance CUDA_PATH is set but CUDA wasn't able to be loaded. Please install the correct version of CUDA and cuDNN as mentioned in the GPU requirements page (https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#requirements), make sure they're in the PATH, and that your GPU is supported.
when using ['CUDAExecutionProvider', 'CPUExecutionProvider']
Falling back to ['CUDAExecutionProvider', 'CPUExecutionProvider'] and retrying.
Traceback (most recent call last):
File "C:\Users\youba\AppData\Local\Programs\Python\Python310\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 383, in init
self._create_inference_session(providers, provider_options, disabled_optimizers)
File "C:\Users\youba\AppData\Local\Programs\Python\Python310\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 435, in _create_inference_session
sess.initialize_session(providers, provider_options, disabled_optimizers)
RuntimeError: D:\a_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:636 onnxruntime::python::CreateExecutionProviderInstance CUDA_PATH is set but CUDA wasn't able to be loaded. Please install the correct version of CUDA and cuDNN as mentioned in the GPU requirements page (https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#requirements), make sure they're in the PATH, and that your GPU is supported.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\tools\refacer\refacer\app.py", line 17, in
refacer = Refacer(force_cpu=args.force_cpu,colab_performance=args.colab_performance)
File "C:\tools\refacer\refacer\refacer.py", line 35, in init
self.__init_apps()
File "C:\tools\refacer\refacer\refacer.py", line 84, in __init_apps
sess_face = rt.InferenceSession(model_path, self.sess_options, providers=self.providers)
File "C:\Users\youba\AppData\Local\Programs\Python\Python310\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 394, in init
raise fallback_error from e
File "C:\Users\youba\AppData\Local\Programs\Python\Python310\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 389, in init
self._create_inference_session(self._fallback_providers, None)
File "C:\Users\youba\AppData\Local\Programs\Python\Python310\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 435, in _create_inference_session
sess.initialize_session(providers, provider_options, disabled_optimizers)
RuntimeError: D:\a_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:636 onnxruntime::python::CreateExecutionProviderInstance CUDA_PATH is set but CUDA wasn't able to be loaded. Please install the correct version of CUDA and cuDNN as mentioned in the GPU requirements page (https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#requirements), make sure they're in the PATH, and that your GPU is supported.
PS C:\tools\refacer\refacer>
`
newest version of cuda cudnn etc. is installed. and works properly in other aplications. only roop and refacer together makes problems.
please help
Traceback (most recent call last):
File "/home/*/Desktop/refacer/app.py", line 17, in <module>
refacer = Refacer(force_cpu=args.force_cpu,colab_performance=args.colab_performance)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/*/Desktop/refacer/refacer.py", line 32, in __init__
self.__check_encoders()
File "/home/*/Desktop/refacer/refacer.py", line 230, in __check_encoders
commandout = subprocess.run(command, check=True, capture_output=True).stdout
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 548, in run
with Popen(*popenargs, **kwargs) as process:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 1024, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.11/subprocess.py", line 1901, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg'
I got CUDA 12.1 installed on win11
I'm running as well roop with venv.
I'm running as well A111 with venv also.
For refacer, i run "pip install -r requirements-GPU.txt" successfuly also in a venv.
but when launching, i got this error related to CUDA, it doesn't find it. I'm puzzled because i didn't do anything special for roop and A1111.
(venv-refacer) C:\Users\xxx\IA\faceswap\refacer>python app.py
Trying FFMPEG h264_nvenc encoder
FFMPEG h264_nvenc encoder works
Video codec for FFMPEG: h264_nvenc
CUDA mode with providers ['CUDAExecutionProvider', 'CPUExecutionProvider']
EP Error D:\a\_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:636 onnxruntime::python::CreateExecutionProviderInstance CUDA_PATH is set but CUDA wasn't able to be loaded. Please install the correct version of CUDA and cuDNN as mentioned in the GPU requirements page (https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#requirements), make sure they're in the PATH, and that your GPU is supported.
when using ['CUDAExecutionProvider', 'CPUExecutionProvider']
Falling back to ['CUDAExecutionProvider', 'CPUExecutionProvider'] and retrying.
Traceback (most recent call last):
File "C:\Users\xxx\IA\faceswap\venv-refacer\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 383, in __init__
self._create_inference_session(providers, provider_options, disabled_optimizers)
File "C:\Users\xxx\IA\faceswap\venv-refacer\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 435, in _create_inference_session
sess.initialize_session(providers, provider_options, disabled_optimizers)
RuntimeError: D:\a\_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:636 onnxruntime::python::CreateExecutionProviderInstance CUDA_PATH is set but CUDA wasn't able to be loaded. Please install the correct version of CUDA and cuDNN as mentioned in the GPU requirements page (https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#requirements), make sure they're in the PATH, and that your GPU is supported.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\xxx\IA\faceswap\refacer\app.py", line 17, in <module>
refacer = Refacer(force_cpu=args.force_cpu,colab_performance=args.colab_performance)
File "C:\Users\xxx\IA\faceswap\refacer\refacer.py", line 35, in __init__
self.__init_apps()
File "C:\Users\xxx\IA\faceswap\refacer\refacer.py", line 84, in __init_apps
sess_face = rt.InferenceSession(model_path, self.sess_options, providers=self.providers)
File "C:\Users\xxx\IA\faceswap\venv-refacer\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 394, in __init__
raise fallback_error from e
File "C:\Users\xxx\IA\faceswap\venv-refacer\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 389, in __init__
self._create_inference_session(self._fallback_providers, None)
File "C:\Users\xxx\IA\faceswap\venv-refacer\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 435, in _create_inference_session
sess.initialize_session(providers, provider_options, disabled_optimizers)
RuntimeError: D:\a\_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:636 onnxruntime::python::CreateExecutionProviderInstance CUDA_PATH is set but CUDA wasn't able to be loaded. Please install the correct version of CUDA and cuDNN as mentioned in the GPU requirements page (https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#requirements), make sure they're in the PATH, and that your GPU is supported.
CUDA is available:
>>> import onnxruntime
>>> print(onnxruntime.get_available_providers())
['TensorrtExecutionProvider', 'CUDAExecutionProvider', 'CPUExecutionProvider']
>>>
any clue is welcome.
thanks
Hello,
The prior out of memory fix - which seemed to break up refacing actions into smaller segments of the larger video being processed - seems no longer in place, as recent builds attempt to process the entire video once again.
This is the result for an 185MB h264 MP4 video, 3840 x 2160 at 60fps:
Trying FFMPEG h264_nvenc encoder
FFMPEG h264_nvenc encoder works
Video codec for FFMPEG: h264_nvenc
CUDA mode with providers ['CUDAExecutionProvider', 'CPUExecutionProvider']
inswapper-shape: [1, 3, 128, 128]
Running on local URL: http://127.0.0.1:7860To create a public link, set
share=True
inlaunch()
.
Total frames: 3711
Extracting frames: 24%|βββββββββββββββ | 877/3711 [00:15<00:49, 56.98it/s]
Traceback (most recent call last):
File "D:\refacer-main\venv\lib\site-packages\gradio\routes.py", line 427, in run_predict
output = await app.get_blocks().process_api(
File "D:\refacer-main\venv\lib\site-packages\gradio\blocks.py", line 1323, in process_api
result = await self.call_function(
File "D:\refacer-main\venv\lib\site-packages\gradio\blocks.py", line 1051, in call_function
prediction = await anyio.to_thread.run_sync(
File "D:\refacer-main\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "D:\refacer-main\venv\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "D:\refacer-main\venv\lib\site-packages\anyio_backends_asyncio.py", line 807, in run
result = context.run(func, *args)
File "D:\refacer-main\app.py", line 64, in run
return refacer.reface(video_path,faces)
File "D:\refacer-main\refacer.py", line 205, in reface
flag, frame = cap.read()
cv2.error: OpenCV(4.7.0) D:\a\opencv-python\opencv-python\opencv\modules\core\src\alloc.cpp:73: error: (-4:Insufficient memory) Failed to allocate 24883200 bytes in function 'cv::OutOfMemoryError'
Running on a relatively untaxed 64GB Windows 10 Pro system, with refacer installed to use the GPU (RTX-3090 24GB. although system RAM gets allocated, regardless.) I did a fresh install of the last few days of commits and all have the same symptom for me.
Currently the end result quality of the video is much lower.
I compared to ROOP which the default video quality result is great.
It will be great to have LOSSLESS or value to change from 0 (low) to 100 (highest) quality?
del
OS: Ubuntu 22.04.2 LTS
Video: link
Command: python3 app.py
Video codec for FFMPEG: h264_nvenc
CPU mode with providers ['CPUExecutionProvider']
Output:
Total frames: 159
Extracting frames: 100%|ββββββββββββββββββββ| 159/159 [00:00<00:00, 1319.79it/s]
Processing frames: 100%|ββββββββββββββββββββββ| 159/159 [02:02<00:00, 1.29it/s]
Merging audio with the refaced video...
Traceback (most recent call last):
File "/home/serejajar/.local/lib/python3.10/site-packages/gradio/routes.py", line 427, in run_predict
output = await app.get_blocks().process_api(
File "/home/serejajar/.local/lib/python3.10/site-packages/gradio/blocks.py", line 1323, in process_api
result = await self.call_function(
File "/home/serejajar/.local/lib/python3.10/site-packages/gradio/blocks.py", line 1051, in call_function
prediction = await anyio.to_thread.run_sync(
File "/home/serejajar/.local/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "/home/serejajar/.local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "/home/serejajar/.local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
result = context.run(func, *args)
File "/home/serejajar/Documents/my/refacer/app.py", line 30, in run
return refacer.reface(video_path,faces)
File "/home/serejajar/Documents/my/refacer/refacer.py", line 189, in reface
return self.__convert_video(video_path,output_video_path)
File "/home/serejajar/Documents/my/refacer/refacer.py", line 113, in __convert_video
out.run(overwrite_output=True,quiet=True)
File "/home/serejajar/.local/lib/python3.10/site-packages/ffmpeg/_run.py", line 325, in run
raise Error('ffmpeg', out, err)
ffmpeg._run.Error: ffmpeg error (see stderr output for detail)
Hi! Is there such a configuration or command-line setting? Refacer always runs in CPU mode. I've installed NVidia drivers for my RTX3090 and I have roop running well on GPU mode. Thanks!!!
C:\Python\REFACE\refacer>python app.py
Trying FFMPEG h264_nvenc encoder
FFMPEG h264_nvenc encoder works
Video codec for FFMPEG: h264_nvenc
CPU mode with providers ['CPUExecutionProvider']
Traceback (most recent call last):
File "C:\Python\REFACE\refacer\app.py", line 12, in
refacer = Refacer(force_cpu=args.force_cpu,colab_performance=args.colab_performance)
File "C:\Python\REFACE\refacer\refacer.py", line 35, in init
self.__init_apps()
File "C:\Python\REFACE\refacer\refacer.py", line 95, in init_apps
self.face_swapper = INSwapper(model_path,sess_swap)
File "C:\Users\RMuratuly\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\insightface\model_zoo\inswapper.py", line 16, in init
model = onnx.load(self.model_file)
File "C:\Users\RMuratuly\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\onnx_init.py", line 170, in load_model
model = load_model_from_string(s, format=format)
File "C:\Users\RMuratuly\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\onnx_init.py", line 212, in load_model_from_string
return deserialize(s, ModelProto())
File "C:\Users\RMuratuly\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\onnx_init.py", line 143, in _deserialize
decoded = typing.cast(Optional[int], proto.ParseFromString(s))
google.protobuf.message.DecodeError: Error parsing message
1.uploaded face to replace
2. uploaded new face
3. No face detected line 122
When it fails with multiple faces used it would be good to know which one has not been recognised.
How can I increase the number of faces?
Hi,
I had the previous June 3rd version and its working perfectly and faster even it wont use all the resource of GPU. After the today's update its not using any GPU at all and using 100 percent of CPU and ram and its extremely slow. Hope you guys can fix that or let me know is it wrong in my installation. And thank you so much for making a amazing project.
Thanks & Best Regards
Allen
Now it takes awefully longer time to load and provide the link to UI. Evrything seems frozen and unresponsive.. To reconfirm, I did a fresh install but the result was no different. Attacching a video and environment path setup..
Gtx 1650ti 4gb..
It ran buttery smooth before the update.
Both CPU & GPU get multiple errors, from cuda installs to scikit-image refacer\lib\site-packages\onnxruntime\capi\onnxruntime_providers_cuda.dll" How did I install? Made a conda env called it refacer then I git cloned inside it and installed requirements. So Env/Refacer/refacer
Hi.. this is not about any issues.. but a question..
With the latest commits, the app loads and runs smooth and faster than ever.. just asking if more can be done with the leftover vram as I can see 2 gb is still free on my 4 gb card.... Something like multi frame processing with more gpu multithreading.
1 validation error for PredictBody
event_id
Field required [type=missing, input_value={'data': [[{'data': 'data...on_hash': 'r9p16srjhgg'}, input_type=dict]
PS D:\Programs\RefacerAI\refacer> python app.py
Traceback (most recent call last):
File "D:\Programs\RefacerAI\refacer\app.py", line 17, in
refacer = Refacer(force_cpu=args.force_cpu,colab_performance=args.colab_performance)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Programs\RefacerAI\refacer\refacer.py", line 32, in init
self.__check_encoders()
File "D:\Programs\RefacerAI\refacer\refacer.py", line 230, in __check_encoders
commandout = subprocess.run(command, check=True, capture_output=True).stdout
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1264.0_x64__qbz5n2kfra8p0\Lib\subprocess.py", line 548, in run
with Popen(*popenargs, **kwargs) as process:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1264.0_x64__qbz5n2kfra8p0\Lib\subprocess.py", line 1026, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1264.0_x64__qbz5n2kfra8p0\Lib\subprocess.py", line 1538, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified
PS D:\refacer> python app.py
Traceback (most recent call last):
File "D:\refacer\app.py", line 11, in
refacer = Refacer(force_cpu=args.force_cpu)
File "D:\refacer\refacer.py", line 30, in init
self.__check_encoders()
File "D:\refacer\refacer.py", line 195, in __check_encoders
commandout = subprocess.run(command, check=True, capture_output=True).stdout
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 503, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 971, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1440, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] ΠΠ΅ ΡΠ΄Π°Π΅ΡΡΡ Π½Π°ΠΉΡΠΈ ΡΠΊΠ°Π·Π°Π½Π½ΡΠΉ ΡΠ°ΠΉΠ»
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.