foivospar / Arc2Face

[ECCV 2024🔥] Arc2Face: A Foundation Model of Human Faces
https://arc2face.github.io/
MIT License
492 stars 32 forks source link

how to fix this #8

Open zachysaur opened 3 months ago

zachysaur commented 3 months ago

(venv) (base) F:\arc\Arc2Face-hf-main>python app.py Traceback (most recent call last): File "F:\arc\Arc2Face-hf-main\app.py", line 19, in import spaces File "F:\arc\Arc2Face-hf-main\venv\lib\site-packages\spaces__init__.py", line 10, in from .zero.decorator import GPU File "F:\arc\Arc2Face-hf-main\venv\lib\site-packages\spaces\zero\decorator.py", line 21, in from .wrappers import regular_function_wrapper File "F:\arc\Arc2Face-hf-main\venv\lib\site-packages\spaces\zero\wrappers.py", line 14, in from multiprocessing.context import ForkProcess ImportError: cannot import name 'ForkProcess' from 'multiprocessing.context' (C:\Users\ggrov\AppData\Local\Programs\Python\Python310\lib\multiprocessing\context.py)

(venv) (base) F:\arc\Arc2Face-hf-main>

foivospar commented 3 months ago

Not sure about the error, but it seems you are running the Spaces version of the demo (which is designed to run on Spaces GPUs). Please, try the local one from this repo, or maybe remove lines 19 (import spaces) and 93 (@spaces.GPU).

zachysaur commented 3 months ago

ok i will try

zachysaur commented 3 months ago

(arc2face) F:\arc\Arc2Face-main>python gradio_demo/app.py 2024-03-30 15:25:56.5737578 [E:onnxruntime:Default, provider_bridge_ort.cc:1548 onnxruntime::TryGetProviderInfo_CUDA] D:\a_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1209 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\onnxruntime\capi\onnxruntime_providers_cuda.dll"

EP Error EP Error D:\a_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:857 onnxruntime::python::CreateExecutionProviderInstance CUDA_PATH is set but CUDA wasnt able to be loaded. Please install the correct version of CUDA andcuDNN 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.


2024-03-30 15:26:02.4856961 [E:onnxruntime:Default, provider_bridge_ort.cc:1548 onnxruntime::TryGetProviderInfo_CUDA] D:\a_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1209 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\onnxruntime\capi\onnxruntime_providers_cuda.dll"

Traceback (most recent call last): File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 419, in init self._create_inference_session(providers, provider_options, disabled_optimizers) File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 483, in _create_inference_session sess.initialize_session(providers, provider_options, disabled_optimizers) RuntimeError: D:\a_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:857 onnxruntime::python::CreateExecutionProviderInstance CUDA_PATH is set but CUDA wasnt able to be loaded. Please install the correct version of CUDA andcuDNN 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 "F:\arc\Arc2Face-main\gradio_demo\app.py", line 29, in app = FaceAnalysis(name='antelopev2', root='./', providers=['CUDAExecutionProvider', 'CPUExecutionProvider']) File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\insightface\app\face_analysis.py", line 31, in init model = model_zoo.get_model(onnx_file, kwargs) File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\insightface\model_zoo\model_zoo.py", line 96, in get_model model = router.get_model(providers=providers, provider_options=provider_options) File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\insightface\model_zoo\model_zoo.py", line 40, in get_model session = PickableInferenceSession(self.onnx_file, kwargs) File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\insightface\model_zoo\model_zoo.py", line 25, in init super().init(model_path, **kwargs) File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 432, in init raise fallback_error from e File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 427, in init self._create_inference_session(self._fallback_providers, None) File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 483, in _create_inference_session sess.initialize_session(providers, provider_options, disabled_optimizers) RuntimeError: D:\a_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:857 onnxruntime::python::CreateExecutionProviderInstance CUDA_PATH is set but CUDA wasnt able to be loaded. Please install the correct version of CUDA andcuDNN 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.

(arc2face) F:\arc\Arc2Face-main>

lattas commented 3 months ago

Please follow the instructions in the error message to install the correct CUDA requirements and the required paths. I think should fix the error.

Or you can avoid it by running face detection in CPU mode (as in the Spaces demo).

zachysaur commented 3 months ago

how i can avoid it?

foivospar commented 3 months ago

You can try app = FaceAnalysis(name='antelopev2', root='./', providers=['CPUExecutionProvider']) instead of the following: https://github.com/foivospar/Arc2Face/blob/ee43ca64f735f229bbacde46010022d9c850594a/gradio_demo/app.py#L29

zachysaur commented 3 months ago

Running on local URL: http://127.0.0.1:7860

To create a public link, set share=True in launch(). C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\insightface\utils\transform.py:68: FutureWarning: rcond parameter will change to the default of machine precision times max(M, N) where M and N are the input matrix dimensions. To use the future default and silence this warning we advise to pass rcond=None, to keep using the old, explicitly pass rcond=-1. P = np.linalg.lstsq(X_homo, Y)[0].T # Affine matrix. 3 x 4 Traceback (most recent call last): File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\gradio\queueing.py", line 456, in call_prediction output = await route_utils.call_process_api( File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\gradio\route_utils.py", line 232, in call_process_api output = await app.get_blocks().process_api( File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\gradio\blocks.py", line 1522, in process_api result = await self.call_function( File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\gradio\blocks.py", line 1144, in call_function prediction = await anyio.to_thread.run_sync( File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\anyio\to_thread.py", line 56, in run_sync return await get_async_backend().run_sync_in_worker_thread( File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\anyio_backends_asyncio.py", line 2144, in run_sync_in_worker_thread return await future File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\anyio_backends_asyncio.py", line 851, in run result = context.run(func, args) File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\gradio\utils.py", line 674, in wrapper response = f(args, kwargs) File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\gradio\utils.py", line 674, in wrapper response = f(*args, *kwargs) File "F:\Arcface\Arc2Face-main\gradio_demo\app.py", line 98, in generate_image id_emb = project_face_embs(pipeline, id_emb) # pass throught the encoder File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context return func(args, kwargs) File "F:\Arcface\Arc2Face-main.\arc2face\utils.py", line 25, in project_face_embs prompt_embeds = pipeline.text_encoder( File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl return forward_call(*args, kwargs) File "F:\Arcface\Arc2Face-main.\arc2face\models.py", line 50, in forward encoder_outputs = self.text_model.encoder( File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl return forward_call(*args, *kwargs) File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\transformers\models\clip\modeling_clip.py", line 656, in forward layer_outputs = encoder_layer( File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl return forward_call(args, kwargs) File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\transformers\models\clip\modeling_clip.py", line 385, in forward hidden_states = self.layer_norm1(hidden_states) File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl return forward_call(*args, kwargs) File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\torch\nn\modules\normalization.py", line 190, in forward return F.layer_norm( File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\torch\nn\functional.py", line 2515, in layer_norm return torch.layer_norm(input, normalized_shape, weight, bias, eps, torch.backends.cudnn.enabled) RuntimeError: "LayerNormKernelImpl" not implemented for 'Half' Traceback (most recent call last): File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\gradio\queueing.py", line 456, in call_prediction output = await route_utils.call_process_api( File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\gradio\route_utils.py", line 232, in call_process_api output = await app.get_blocks().process_api( File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\gradio\blocks.py", line 1522, in process_api result = await self.call_function( File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\gradio\blocks.py", line 1144, in call_function prediction = await anyio.to_thread.run_sync( File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\anyio\to_thread.py", line 56, in run_sync return await get_async_backend().run_sync_in_worker_thread( File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\anyio_backends_asyncio.py", line 2144, in run_sync_in_worker_thread return await future File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\anyio_backends_asyncio.py", line 851, in run result = context.run(func, args) File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\gradio\utils.py", line 674, in wrapper response = f(args, kwargs) File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\gradio\utils.py", line 674, in wrapper response = f(*args, kwargs) File "F:\Arcface\Arc2Face-main\gradio_demo\app.py", line 98, in generate_image id_emb = project_face_embs(pipeline, id_emb) # pass throught the encoder File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context return func(*args, *kwargs) File "F:\Arcface\Arc2Face-main.\arc2face\utils.py", line 25, in project_face_embs prompt_embeds = pipeline.text_encoder( File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl return forward_call(args, kwargs) File "F:\Arcface\Arc2Face-main.\arc2face\models.py", line 50, in forward encoder_outputs = self.text_model.encoder( File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl return forward_call(*args, kwargs) File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\transformers\models\clip\modeling_clip.py", line 656, in forward layer_outputs = encoder_layer( File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl return forward_call(*args, *kwargs) File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\transformers\models\clip\modeling_clip.py", line 385, in forward hidden_states = self.layer_norm1(hidden_states) File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl return forward_call(args, kwargs) File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\torch\nn\modules\normalization.py", line 190, in forward return F.layer_norm( File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\torch\nn\functional.py", line 2515, in layer_norm return torch.layer_norm(input, normalized_shape, weight, bias, eps, torch.backends.cudnn.enabled) RuntimeError: "LayerNormKernelImpl" not implemented for 'Half'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\gradio\queueing.py", line 501, in process_events response = await self.call_prediction(awake_events, batch) File "C:\Users\ggrov\anaconda3\envs\arc2face\lib\site-packages\gradio\queueing.py", line 465, in call_prediction raise Exception(str(error) if show_error else None) from error Exception: None

zachysaur commented 3 months ago

i change float16 to float32 it working

zachysaur commented 3 months ago

(base) C:\Windows\system32>nvcc --version nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2023 NVIDIA Corporation Built on Wed_Nov_22_10:30:42_Pacific_Standard_Time_2023 Cuda compilation tools, release 12.3, V12.3.107 Build cuda_12.3.r12.3/compiler.33567101_0

(base) C:\Windows\system32> what i need to do exactly to have cuda working

zachysaur commented 3 months ago

nevermind i fixed this thank you for helping