neuralchen / SimSwap

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

How to setup dependencies for github... this is what worked for me on 18/7/2023 #433

Open nghiap opened 1 year ago

nghiap commented 1 year ago

(simswap) C:\SimSwap-main>cd\
(simswap) C:\SimSwap-main>cd simswap-main
(simswap) C:\SimSwap-main>conda create -n simswap python=3.8
(simswap) C:\SimSwap-main>conda activate simswap
(simswap) C:\SimSwap-main>set CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=ON"
(simswap) C:\SimSwap-main>conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
(simswap) C:\SimSwap-main>conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=10.2 -c pytorch (simswap) C:\SimSwap-main>pip install --ignore-installed imageio (simswap) C:\SimSwap-main>conda install cudatoolkit -c pytorch (simswap) C:\SimSwap-main>pip install "numpy<1.24" (simswap) C:\SimSwap-main>pip install insightface==0.2.1 onnxruntime moviepy

joaoesp commented 1 year ago

did you use anaconda or miniconda? its so frustrating to try and make this work, just errors after errors...

nghiap commented 1 year ago

I used anaconda 3. I have old inspiron 5000, Nvidia graphics gtx1065. If you have different graphic card may need to do different install steps for torch install.

joaoesp commented 1 year ago

I have a Geforce GTX 1070 and couldnt get it running with cuda 12.2. Im just trying to run it on CPU now, getting it to run on GPU is a nightmare, I had it running on CPU before and I tried to install the packages to run it on GPU and it broke everything. Trying to get it running again...

nghiap commented 1 year ago

Hi Joaoesp, if you still have problem when you have followed my steps above, then check and make sure you have correct version of CUDA and CUDNN as mentioned in the GPU requirements that suits your GTX card before following the steps I posted.

Also look at this page to see what commands to use for the pytorch version you will install, if you want to use different version https://pytorch.org/get-started/previous-versions/

there you will also see what cudatoolkit version you need and from there get the right version of CUDA and CUDNN ready before you start the conda enviroment and installation of simswap requirepment.

joaoesp commented 1 year ago

GPU: 4060 8gb Cuda: 11.8

its stuck on ---- END ---- doesnt move forward, have to close the window.

I tried: #120 but then it gives me:

-------------- End ---------------- (142, 366, 4) Traceback (most recent call last): File "test_wholeimage_swapsingle.py", line 51, in model = create_model(opt) File "C:\Users\Joaoesp\Documents\SimSwap\SimSwap-main\models\models.py", line 18, in create_model model.initialize(opt) File "C:\Users\Joaoesp\Documents\SimSwap\SimSwap-main\models\fs_model.py", line 67, in initialize netArc_checkpoint = torch.load(netArc_checkpoint) File "C:\Users\Joaoesp\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py", line 592, in load return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args) File "C:\Users\Joaoesp\anaconda3\envs\simswap\lib\site-packages\torch\serialization.py", line 851, in _load result = unpickler.load() ModuleNotFoundError: No module named 'models.arcface_models'

nghiap commented 1 year ago

I think you should start a new conda environment and follow the steps I pasted at the beginning. Make sure you have the necessary model in checkpoint and download the archface file like they stated in the SimSwap Github. If you are going with pytorch-cuda=11.8, then make sure your NVidia toolset & Cudnn are of suitable version that works with cuda 11.8.

joaoesp commented 1 year ago

I did follow your steps, I downloaded the cudnn for 11.x cuda, torch.cuda.is_available returns true and device_count returns 1. I am still getting the problem stated above. Thank you for helping.

joaoesp commented 1 year ago

I re-downloaded the repository and it worked! Ty so much for your help!

nghiap commented 1 year ago

That's great! Congratulations.

From: joaoesp @.> Sent: Friday, August 11, 2023 10:54 PM To: neuralchen/SimSwap @.> Cc: nghiap @.>; Author @.> Subject: Re: [neuralchen/SimSwap] How to setup dependencies for github... this is what worked for me on 18/7/2023 (Issue #433)

I re-downloaded the repository and it worked! Ty so much for your help!

- Reply to this email directly, view it on GitHubhttps://github.com/neuralchen/SimSwap/issues/433#issuecomment-1674561798, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFBHH34GGYTOH7LQ6JO2J7DXUYFOFANCNFSM6AAAAAA2OFCLFI. You are receiving this because you authored the thread.Message ID: @.**@.>>