neuralchen / SimSwap

An arbitrary face-swapping framework on images and videos with one single trained model!
Other
4.55k stars 895 forks source link

New User- Getting this error(?) while trying to run. Any help is greatly appreciated #272

Open acetony01 opened 2 years ago

acetony01 commented 2 years ago

G:\DFL\Anaconda\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.parallel.data_parallel.DataParallel' has changed. Tried to save a patch, but couldn't create a writable file DataParallel.patch. Make sure it doesn't exist and your working directory is writable. warnings.warn(msg, SourceChangeWarning) G:\DFL\Anaconda\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.conv.Conv2d' has changed. Tried to save a patch, but couldn't create a writable file Conv2d.patch. Make sure it doesn't exist and your working directory is writable. warnings.warn(msg, SourceChangeWarning) G:\DFL\Anaconda\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.batchnorm.BatchNorm2d' has changed. Tried to save a patch, but couldn't create a writable file BatchNorm2d.patch. Make sure it doesn't exist and your working directory is writable. warnings.warn(msg, SourceChangeWarning) G:\DFL\Anaconda\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.activation.PReLU' has changed. Tried to save a patch, but couldn't create a writable file PReLU.patch. Make sure it doesn't exist and your working directory is writable. warnings.warn(msg, SourceChangeWarning) G:\DFL\Anaconda\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.pooling.MaxPool2d' has changed. Tried to save a patch, but couldn't create a writable file MaxPool2d.patch. Make sure it doesn't exist and your working directory is writable. warnings.warn(msg, SourceChangeWarning) G:\DFL\Anaconda\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.container.Sequential' has changed. Tried to save a patch, but couldn't create a writable file Sequential.patch. Make sure it doesn't exist and your working directory is writable. warnings.warn(msg, SourceChangeWarning) G:\DFL\Anaconda\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.pooling.AdaptiveAvgPool2d' has changed. Tried to save a patch, but couldn't create a writable file AdaptiveAvgPool2d.patch. Make sure it doesn't exist and your working directory is writable. warnings.warn(msg, SourceChangeWarning) G:\DFL\Anaconda\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.linear.Linear' has changed. Tried to save a patch, but couldn't create a writable file Linear.patch. Make sure it doesn't exist and your working directory is writable. warnings.warn(msg, SourceChangeWarning) G:\DFL\Anaconda\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.activation.Sigmoid' has changed. Tried to save a patch, but couldn't create a writable file Sigmoid.patch. Make sure it doesn't exist and your working directory is writable. warnings.warn(msg, SourceChangeWarning) G:\DFL\Anaconda\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.dropout.Dropout' has changed. Tried to save a patch, but couldn't create a writable file Dropout.patch. Make sure it doesn't exist and your working directory is writable. warnings.warn(msg, SourceChangeWarning) G:\DFL\Anaconda\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.batchnorm.BatchNorm1d' has changed. Tried to save a patch, but couldn't create a writable file BatchNorm1d.patch. Make sure it doesn't exist and your working directory is writable. warnings.warn(msg, SourceChangeWarning) Traceback (most recent call last): File "test_wholeimage_swapsingle.py", line 55, in app = Face_detect_crop(name='antelope', root='./insightface_func/models') File "G:\DFL\Simswap\insightface_func\face_detect_crop_single.py", line 40, in init model = model_zoo.get_model(onnx_file) File "G:\DFL\Anaconda\envs\simswap\lib\site-packages\insightface\model_zoo\model_zoo.py", line 56, in get_model model = router.get_model() File "G:\DFL\Anaconda\envs\simswap\lib\site-packages\insightface\model_zoo\model_zoo.py", line 23, in get_model session = onnxruntime.InferenceSession(self.onnx_file, None) File "G:\DFL\Anaconda\envs\simswap\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 335, in init self._create_inference_session(providers, provider_options, disabled_optimizers) File "G:\DFL\Anaconda\envs\simswap\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 364, in _create_inference_session "onnxruntime.InferenceSession(..., providers={}, ...)".format(available_providers)) ValueError: This ORT build has ['TensorrtExecutionProvider', 'CUDAExecutionProvider', 'CPUExecutionProvider'] enabled. Since ORT 1.9, you are required to explicitly set the providers parameter when instantiating InferenceSession. For example, onnxruntime.InferenceSession(..., providers=['TensorrtExecutionProvider', 'CUDAExecutionProvider', 'CPUExecutionProvider'], ...)

netrunner-exe commented 2 years ago

Try pip uninstall -y onnxruntime-gpu and pip install onnxruntime-gpu==1.9.0

Fibonacci134 commented 2 years ago

Hey, you're using Onnxruntime-gpu version 1.9 or above. You need to set the execution provider. You may do this in the model zoo file located in your conda environment, or in your testvideoswapsingle.py file. I suggest making changes in the model zoo file. I believe i have uploaded a altered one on my github. Let us know if ykur issue is solved or close it please.

acetony01 commented 2 years ago

Hey, you're using Onnxruntime-gpu version 1.9 or above. You need to set the execution provider. You may do this in the model zoo file located in your conda environment, or in your testvideoswapsingle.py file. I suggest making changes in the model zoo file. I believe i have uploaded a altered one on my github. Let us know if ykur issue is solved or close it please.

Haven't had the chance to test it out yet. Will check if it solves the issue as soon as I can