sm_86 is not compatible and code error #360

Open
opened 2022-12-11 17:50:17 +01:00 by HMSMohamed · 5 comments
HMSMohamed commented 2022-12-11 17:50:17 +01:00 (Migrated from github.com)

Hi,
I value your support to help me fix the issue I am having to be able to try the Simswap
Here is what I tried

  1. Following the as is preparation I get “RTX 4080 with CUDA capability sm_86 is not compatible with the current PyTorch installation” to fix it I tried updating the CUDA.
    After multiple tried and way I used the below line instead of the similar preparation installation line “conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch -c conda-forge”

Now I am getting the below error, which I need your help with (I tried deleting the .patch files with no different

“C:\Users#########\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.parallel.data_parallel.DataParallel' has changed. Saved a reverse patch to DataParallel.patch. Run patch -p0 < DataParallel.patch to revert your changes.
warnings.warn(msg, SourceChangeWarning)
C:\Users#########\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.conv.Conv2d' has changed. Saved a reverse patch to Conv2d.patch. Run patch -p0 < Conv2d.patch to revert your changes.
warnings.warn(msg, SourceChangeWarning)
C:\Users#########\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.batchnorm.BatchNorm2d' has changed. Saved a reverse patch to BatchNorm2d.patch. Run patch -p0 < BatchNorm2d.patch to revert your changes.
warnings.warn(msg, SourceChangeWarning)
C:\Users#########\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.activation.PReLU' has changed. Saved a reverse patch to PReLU.patch. Run patch -p0 < PReLU.patch to revert your changes.
warnings.warn(msg, SourceChangeWarning)
C:\Users#########\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.pooling.MaxPool2d' has changed. Saved a reverse patch to MaxPool2d.patch. Run patch -p0 < MaxPool2d.patch to revert your changes.
warnings.warn(msg, SourceChangeWarning)
C:\Users#########\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.container.Sequential' has changed. Saved a reverse patch to Sequential.patch. Run patch -p0 < Sequential.patch to revert your changes.
warnings.warn(msg, SourceChangeWarning)
C:\Users#########\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.pooling.AdaptiveAvgPool2d' has changed. Saved a reverse patch to AdaptiveAvgPool2d.patch. Run patch -p0 < AdaptiveAvgPool2d.patch to revert your changes.
warnings.warn(msg, SourceChangeWarning)
C:\Users#########\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.linear.Linear' has changed. Saved a reverse patch to Linear.patch. Run patch -p0 < Linear.patch to revert your changes.
warnings.warn(msg, SourceChangeWarning)
C:\Users#########\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.activation.Sigmoid' has changed. Saved a reverse patch to Sigmoid.patch. Run patch -p0 < Sigmoid.patch to revert your changes.
warnings.warn(msg, SourceChangeWarning)
C:\Users#########\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.dropout.Dropout' has changed. Saved a reverse patch to Dropout.patch. Run patch -p0 < Dropout.patch to revert your changes.
warnings.warn(msg, SourceChangeWarning)
C:\Users#########\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.batchnorm.BatchNorm1d' has changed. Saved a reverse patch to BatchNorm1d.patch. Run patch -p0 < BatchNorm1d.patch to revert your changes.
warnings.warn(msg, SourceChangeWarning)
C:\Users#########\anaconda3\envs\simswap\lib\site-packages\torch\nn\functional.py:3455: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details.
"See the documentation of nn.Upsample for details.".format(mode)”

Hi, I value your support to help me fix the issue I am having to be able to try the Simswap Here is what I tried 1) Following the as is preparation I get “RTX 4080 with CUDA capability sm_86 is not compatible with the current PyTorch installation” to fix it I tried updating the CUDA. After multiple tried and way I used the below line instead of the similar preparation installation line “conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch -c conda-forge” Now I am getting the below error, which I need your help with (I tried deleting the .patch files with no different “C:\Users\#########\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.parallel.data_parallel.DataParallel' has changed. Saved a reverse patch to DataParallel.patch. Run `patch -p0 < DataParallel.patch` to revert your changes. warnings.warn(msg, SourceChangeWarning) C:\Users\#########\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.conv.Conv2d' has changed. Saved a reverse patch to Conv2d.patch. Run `patch -p0 < Conv2d.patch` to revert your changes. warnings.warn(msg, SourceChangeWarning) C:\Users\#########\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.batchnorm.BatchNorm2d' has changed. Saved a reverse patch to BatchNorm2d.patch. Run `patch -p0 < BatchNorm2d.patch` to revert your changes. warnings.warn(msg, SourceChangeWarning) C:\Users\#########\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.activation.PReLU' has changed. Saved a reverse patch to PReLU.patch. Run `patch -p0 < PReLU.patch` to revert your changes. warnings.warn(msg, SourceChangeWarning) C:\Users\#########\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.pooling.MaxPool2d' has changed. Saved a reverse patch to MaxPool2d.patch. Run `patch -p0 < MaxPool2d.patch` to revert your changes. warnings.warn(msg, SourceChangeWarning) C:\Users\#########\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.container.Sequential' has changed. Saved a reverse patch to Sequential.patch. Run `patch -p0 < Sequential.patch` to revert your changes. warnings.warn(msg, SourceChangeWarning) C:\Users\#########\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.pooling.AdaptiveAvgPool2d' has changed. Saved a reverse patch to AdaptiveAvgPool2d.patch. Run `patch -p0 < AdaptiveAvgPool2d.patch` to revert your changes. warnings.warn(msg, SourceChangeWarning) C:\Users\#########\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.linear.Linear' has changed. Saved a reverse patch to Linear.patch. Run `patch -p0 < Linear.patch` to revert your changes. warnings.warn(msg, SourceChangeWarning) C:\Users\#########\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.activation.Sigmoid' has changed. Saved a reverse patch to Sigmoid.patch. Run `patch -p0 < Sigmoid.patch` to revert your changes. warnings.warn(msg, SourceChangeWarning) C:\Users\#########\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.dropout.Dropout' has changed. Saved a reverse patch to Dropout.patch. Run `patch -p0 < Dropout.patch` to revert your changes. warnings.warn(msg, SourceChangeWarning) C:\Users\#########\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.batchnorm.BatchNorm1d' has changed. Saved a reverse patch to BatchNorm1d.patch. Run `patch -p0 < BatchNorm1d.patch` to revert your changes. warnings.warn(msg, SourceChangeWarning) C:\Users\#########\anaconda3\envs\simswap\lib\site-packages\torch\nn\functional.py:3455: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details. "See the documentation of nn.Upsample for details.".format(mode)”
HMSMohamed commented 2022-12-13 06:12:44 +01:00 (Migrated from github.com)

when trying the sample run listed under usage wither I am getting the above error or the below one, please help
"Traceback (most recent call last):
File "test_video_swapmulti.py", line 58, in
app = Face_detect_crop(name='antelope', root='./insightface_func/models')
File "C:\SimSwap\insightface_func\face_detect_crop_multi.py", line 47, in init
assert 'detection' in self.models
AssertionError
"

when trying the sample run listed under usage wither I am getting the above error or the below one, please help "Traceback (most recent call last): File "test_video_swapmulti.py", line 58, in <module> app = Face_detect_crop(name='antelope', root='./insightface_func/models') File "C:\SimSwap\insightface_func\face_detect_crop_multi.py", line 47, in __init__ assert 'detection' in self.models AssertionError "
nanafy commented 2023-04-18 05:22:49 +02:00 (Migrated from github.com)

Same issue

Same issue
LindiaC commented 2023-12-11 09:58:42 +01:00 (Migrated from github.com)

tested on RTX4070 with torch 2.1.1+cu121 torchaudio 2.1.1+cu121 torchvision 0.16.1+cu121 and the training process just worked fine.
At first I tried to follow the advised virtual environment and it just can't work. At last I did it in my base env and worked, such a big relief. So you can just ignore the environment requirements maybe. But pay attention that the version of timm is restricted, higher versions will result in error.

tested on RTX4070 with torch 2.1.1+cu121 torchaudio 2.1.1+cu121 torchvision 0.16.1+cu121 and the training process just worked fine. At first I tried to follow the advised virtual environment and it just can't work. At last I did it in my base env and worked, such a big relief. So you can just ignore the environment requirements maybe. But pay attention that the version of timm is restricted, higher versions will result in error.
chud37 commented 2023-12-18 00:01:44 +01:00 (Migrated from github.com)

@LindiaC Can you paste your complete install code for me here, I am also using a 4070 and I cannot get it to install. Everything was fine on my 1070 card but for some reason the 4070 i'm having issues.

Here's what I've put together so far:

Download and install cuda 12.1 from https://developer.nvidia.com/cuda-12-1-0-download-archive?target_os=Windows&target_arch=x86_64&target_version=11&target_type=exe_network

And then run:
conda create -n simswap python=3.8
conda activate simswap

But instead of:
conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=10.2 -c pytorch

I ran:
pip3 install torch==2.1.1+cu121 torchvision==0.16.1+cu121 torchaudio==2.1.1+cu121 -f https://download.pytorch.org/whl/torch_stable.html

Which all went through fine. Then when I come to actually swap a video:

Traceback (most recent call last):
File "test_video_swapsingle.py", line 55, in
model = create_model(opt)
File "S:\code\python\models\models.py", line 18, in create_model
model.initialize(opt)
File "S:\code\python\models\fs_model.py", line 67, in initialize
netArc_checkpoint = torch.load(netArc_checkpoint) if torch.cuda.is_available() else torch.load(netArc_checkpoint, map_location=torch.device('cpu'))
File "C:\Users\chud3\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py", line 1028, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "C:\Users\chud3\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py", line 1256, in _legacy_load
result = unpickler.load()
File "C:\Users\chud3\anaconda3\envs\simswap\lib\site-packages\torch\optim\sgd.py", line 29, in setstate
super().setstate(state)
File "C:\Users\chud3\anaconda3\envs\simswap\lib\site-packages\torch\optim\optimizer.py", line 295, in setstate
self.defaults.setdefault('differentiable', False)
AttributeError: 'SGD' object has no attribute 'defaults'

ChatGPT suggests this is something to do with the checkpoints, as they may be different with a different pytorch version.
Any suggestions as to what Is going wrong here?

@LindiaC Can you paste your complete install code for me here, I am also using a 4070 and I cannot get it to install. Everything was fine on my 1070 card but for some reason the 4070 i'm having issues. Here's what I've put together so far: Download and install cuda 12.1 from https://developer.nvidia.com/cuda-12-1-0-download-archive?target_os=Windows&target_arch=x86_64&target_version=11&target_type=exe_network And then run: conda create -n simswap python=3.8 conda activate simswap But instead of: conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=10.2 -c pytorch I ran: pip3 install torch==2.1.1+cu121 torchvision==0.16.1+cu121 torchaudio==2.1.1+cu121 -f https://download.pytorch.org/whl/torch_stable.html Which all went through fine. Then when I come to actually swap a video: Traceback (most recent call last): File "test_video_swapsingle.py", line 55, in <module> model = create_model(opt) File "S:\code\python\models\models.py", line 18, in create_model model.initialize(opt) File "S:\code\python\models\fs_model.py", line 67, in initialize netArc_checkpoint = torch.load(netArc_checkpoint) if torch.cuda.is_available() else torch.load(netArc_checkpoint, map_location=torch.device('cpu')) File "C:\Users\chud3\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py", line 1028, in load return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args) File "C:\Users\chud3\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py", line 1256, in _legacy_load result = unpickler.load() File "C:\Users\chud3\anaconda3\envs\simswap\lib\site-packages\torch\optim\sgd.py", line 29, in __setstate__ super().__setstate__(state) File "C:\Users\chud3\anaconda3\envs\simswap\lib\site-packages\torch\optim\optimizer.py", line 295, in __setstate__ self.defaults.setdefault('differentiable', False) AttributeError: 'SGD' object has no attribute 'defaults' ChatGPT suggests this is something to do with the checkpoints, as they may be different with a different pytorch version. Any suggestions as to what Is going wrong here?
LindiaC commented 2023-12-18 03:26:52 +01:00 (Migrated from github.com)

@chud37 Glad to help, I used
python 3.11.5
torch 2.1.1+cu121 torchaudio 2.1.1+cu121 torchvision 0.16.1+cu121
insightface 0.2.1
opencv-python 4.8.1.78
pillow 10.1.0
numpy 1.24.3
moviepy 1.0.3
timm 0.5.4
imageio 2.26.0
Moreover, for this specific problem, I found previous closed issue here. It says that arcface_checkpoint.tar has been updated this April.

@chud37 Glad to help, I used **python 3.11.5** torch 2.1.1+cu121 torchaudio 2.1.1+cu121 torchvision 0.16.1+cu121 insightface 0.2.1 opencv-python 4.8.1.78 pillow 10.1.0 numpy 1.24.3 moviepy 1.0.3 timm 0.5.4 imageio 2.26.0 Moreover, for this specific problem, I found previous closed issue [here](https://github.com/neuralchen/SimSwap/issues/354). It says that arcface_checkpoint.tar has been updated this April.
Sign in to join this conversation.