alievk / avatarify-python

Avatars for Zoom, Skype and other video-conferencing apps.
Other
16.16k stars 3.87k forks source link

Tutorial: How to install on RTX 3XXX and higher. #572

Open Echolink50 opened 1 year ago

Echolink50 commented 1 year ago

Seems the install procedure is difficult for most and the people who know how have the most vague and short answers. I can't say this will work for everyone but this is what worked for me. My install is on Xeon E3 1240 V5, 16GB Ram, RTX 3060 TI 8GB, Windows 10. If you have a 1xxx or 2xxx series card I think you can just use the avatarify desktop install which is a simple .exe file.

First, make sure you have at least 10GB free space on your C drive AND the drive you are installing to if it's not the C drive. These github repos start downloading and extracting GBs of files only God knows where. Make sure you have a steady internet connection. Also make sure your computer meets the minimum requirements. Don't ask why it doesn't work on your 586 with voodoo gpu.

Watch this video and follow it except for the changes I mention: https://www.youtube.com/watch?v=lym9ANVb120

Go here and scroll to the section with Windows install instructions: https://github.com/alievk/avatarify-python/tree/master/docs The same video is at the top.

Follow the instructions. Make a fresh start to prevent any previous attempts at install from complicating things.

  1. Install miniconda 3.8 where ever you want (mine is on the F: drive and this is where the env and huge lib files will be but it may also put some files on the C drive in appdata so I recommend using the C drive to avoid complications).

  2. Install git

  3. Create a folder somewhere that you want to install Avatarify. (like C:\Documents\Avatarify) Go to said folder and right click in the address bar and copy as text.

  4. Run Miniconda as Admin (just incase it wants to put files somewhere it needs privledges)

Click in Miniconda and type the drive where the folder you created in step 3 is located like this "F:" without the quotes. Your prompt should change to that drive letter. If your folder is on the C drive you don't have to type "C:" cause you are already on it. Now type "cd" then spacebar and paste the folder address you copied in step 3 and hit enter. Your prompt should change to indicate you are now in the folder you created.

  1. Paste this into the prompt "git clone https://github.com/alievk/avatarify-python.git" without the quotes. That should copy the files into the folder.

  2. Paste this into the prompt "cd avatarify-python" without the quotes. CD means change directory so now you should be into the folder with the files.

  3. Now open a file explorer and go to the folder you just git cloned. You should have some files there that need to be changed. Right click on the file and edit in notepad. These are the files that need to be changed and the changes I made. Edit requirements.txt in the main folder. Edit install_windows.bat which is in the scripts folder within the main folder. Make sure to save the changes and close the notepads. I used cudatoolkit 11.1 initially. Newer versions may work. Don't change run_windows.bat

Avatarify_Install_Instructions

install_windows.bat

@echo off

REM Check prerequisites
call conda --version >nul 2>&1 && ( echo conda found ) || ( echo conda not found. Please refer to the README and install Miniconda. && exit /B 1)
REM call git --version >nul 2>&1 && ( echo git found ) || ( echo git not found. Please refer to the README and install Git. && exit /B 1)

call scripts/settings_windows.bat

call conda create -y -n %CONDA_ENV_NAME% python=3.7
call conda activate %CONDA_ENV_NAME%

call mamba install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c nvidia -c conda-forge
call conda install -y scikit-image python-blosc -c conda-forge
call conda install -y -c anaconda git

REM ###FOMM###
call rmdir fomm /s /q
call git clone https://github.com/alievk/first-order-model.git fomm

call pip install -r requirements.txt

requirements.txt

opencv-python>=4.2.0.34
face-alignment==1.3.3
pyzmq==20.0.0
msgpack-numpy==0.4.7.1
pyyaml==5.4
requests==2.25.1
pyfakewebcam==0.1.0
  1. Go back to miniconda and make sure your prompt is still in the main folder. Run "conda install -c conda-forge mamba" without the quotes. Got this bit from Donvickins aswell as the modified script.

  2. Finally run "scripts\install_windows.bat" without the quotes. If it doesn't run make sure miniconda is in the right folder.

  3. Watch for everything to install. cuda is a 3GB download so it could take a while. Hit y whenever prompted. If your internet cuts out during the download like mine did run "scripts\install_windows.bat" again until it finishes. Let environment solving run. It took about 15 minutes for me. Hours seems excessive and maybe something didn't get installed properly.

  4. Download network weights and place vox-adv-cpk.pth.tar file in the avatarify-python directory (don't unpack it)

  5. Run "run_windows.bat" without the quotes. Make sure you have a camera attached. If it works, great, you're done. Now, for me I got an error here about cuda toolkit. I think its because my internet connection cut out during the cuda download/install. After the error I ran "conda install cudatoolkit" without the quotes which installed cuda toolkit 11.3. This worked but you can also specify a version. It probably has to be above 11.1 for RTX 3xxx cards.

That should be about it. I tried to write this as beginner friendly as possible. If this works for you please post a reply and confirm. Hope this helps.

Oluwashawn commented 1 year ago

those getting stuck at "solving environment" do this to fix it, while editing the "install_windows.bat" file, go to this line "call conda create -y -n %CONDA_ENV_NAME% python=3.7" and change the python version to the exact version installed on your pc i.e. if your python version is 3.10 then change the "3.7" to 3.10 etc...…if you are not sure of your python version you can run a separate miniconda tab and run "python -V" and you will see your python version.

yungpalizawa commented 1 year ago

How do I switch to NVIDIA GPU for more FPS? Avatarify has been using the CPU only which produces less than 3 FPS.

JohanAR commented 1 year ago

@yungpalizawa it should use the GPU if you have all the dependencies installed and working. AFAIK it is CUDA that uses the best device it can find, so if it doesn't use your GPU you can look for resources about troubleshooting that.

yungpalizawa commented 1 year ago

@yungpalizawa it should use the GPU if you have all the dependencies installed and working. AFAIK it is CUDA that uses the best device it can find, so if it doesn't use your GPU you can look for resources about troubleshooting that.

Thank you. I got it fixed later, it was using pytorch but the cpu version. I had to uninstall and then redownload the pytorch-GPU version. Now I get at least 27 FPS.

JohanAR commented 1 year ago

@yungpalizawa awesome! Avatarify-python isn't actively maintained, but if you know what to change in the install scripts to fix this then you could submit a PR if you want to.

charliekodes commented 1 year ago

I am having a lot of trouble installing Nvidia on my laptop after installing the script, I am at the stage of running the windows bag and it says I need Nvidia, I downloaded the exe but it keeps saying installation failed due to other installations are ongoing but am not installing anything

yungpalizawa commented 1 year ago

I am having a lot of trouble installing Nvidia on my laptop after installing the script, I am at the stage of running the windows bag and it says I need Nvidia, I downloaded the exe but it keeps saying installation failed due to other installations are ongoing but am not installing anything

Can you share your system's specifications?

theofrizon commented 1 year ago

how did you go about changing it from cpu to gpu. am having same issue on my 3060 graphics and 20series graphics card. exact same issue. everything else works.

Oluwashawn commented 1 year ago

you have to uninstall the current pytorch by runnning this (in your avatarify environment.....cd avatarify-python....etc)

pip uninstall torch

after install pytorch with cuda using this

pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116

CharlesFranklin12 commented 11 months ago

Seems the install procedure is difficult for most and the people who know how have the most vague and short answers. I can't say this will work for everyone but this is what worked for me. My install is on Xeon E3 1240 V5, 16GB Ram, RTX 3060 TI 8GB, Windows 10. If you have a 1xxx or 2xxx series card I think you can just use the avatarify desktop install which is a simple .exe file.

First, make sure you have at least 10GB free space on your C drive AND the drive you are installing to if it's not the C drive. These github repos start downloading and extracting GBs of files only God knows where. Make sure you have a steady internet connection. Also make sure your computer meets the minimum requirements. Don't ask why it doesn't work on your 586 with voodoo gpu.

Watch this video and follow it except for the changes I mention: https://www.youtube.com/watch?v=lym9ANVb120

Go here and scroll to the section with Windows install instructions: https://github.com/alievk/avatarify-python/tree/master/docs The same video is at the top.

Follow the instructions. Make a fresh start to prevent any previous attempts at install from complicating things.

  1. Install miniconda 3.8 where ever you want (mine is on the F: drive and this is where the env and huge lib files will be but it may also put some files on the C drive in appdata so I recommend using the C drive to avoid complications).
  2. Install git
  3. Create a folder somewhere that you want to install Avatarify. (like C:\Documents\Avatarify) Go to said folder and right click in the address bar and copy as text.
  4. Run Miniconda as Admin (just incase it wants to put files somewhere it needs privledges)

Click in Miniconda and type the drive where the folder you created in step 3 is located like this "F:" without the quotes. Your prompt should change to that drive letter. If your folder is on the C drive you don't have to type "C:" cause you are already on it. Now type "cd" then spacebar and paste the folder address you copied in step 3 and hit enter. Your prompt should change to indicate you are now in the folder you created.

  1. Paste this into the prompt "git clone https://github.com/alievk/avatarify-python.git" without the quotes. That should copy the files into the folder.
  2. Paste this into the prompt "cd avatarify-python" without the quotes. CD means change directory so now you should be into the folder with the files.
  3. Now open a file explorer and go to the folder you just git cloned. You should have some files there that need to be changed. Right click on the file and edit in notepad. These are the files that need to be changed and the changes I made. Edit requirements.txt in the main folder. Edit install_windows.bat which is in the scripts folder within the main folder. Make sure to save the changes and close the notepads. I used cudatoolkit 11.1 initially. Newer versions may work. Don't change run_windows.bat

Avatarify_Install_Instructions

install_windows.bat

@echo off

REM Check prerequisites
call conda --version >nul 2>&1 && ( echo conda found ) || ( echo conda not found. Please refer to the README and install Miniconda. && exit /B 1)
REM call git --version >nul 2>&1 && ( echo git found ) || ( echo git not found. Please refer to the README and install Git. && exit /B 1)

call scripts/settings_windows.bat

call conda create -y -n %CONDA_ENV_NAME% python=3.7
call conda activate %CONDA_ENV_NAME%

call mamba install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c nvidia -c conda-forge
call conda install -y scikit-image python-blosc -c conda-forge
call conda install -y -c anaconda git

REM ###FOMM###
call rmdir fomm /s /q
call git clone https://github.com/alievk/first-order-model.git fomm

call pip install -r requirements.txt

requirements.txt

opencv-python>=4.2.0.34
face-alignment==1.3.3
pyzmq==20.0.0
msgpack-numpy==0.4.7.1
pyyaml==5.4
requests==2.25.1
pyfakewebcam==0.1.0
  1. Go back to miniconda and make sure your prompt is still in the main folder. Run "conda install -c conda-forge mamba" without the quotes. Got this bit from Donvickins aswell as the modified script.
  2. Finally run "scripts\install_windows.bat" without the quotes. If it doesn't run make sure miniconda is in the right folder.
  3. Watch for everything to install. cuda is a 3GB download so it could take a while. Hit y whenever prompted. If your internet cuts out during the download like mine did run "scripts\install_windows.bat" again until it finishes. Let environment solving run. It took about 15 minutes for me. Hours seems excessive and maybe something didn't get installed properly.
  4. Download network weights and place vox-adv-cpk.pth.tar file in the avatarify-python directory (don't unpack it)
  5. Run "run_windows.bat" without the quotes. Make sure you have a camera attached. If it works, great, you're done. Now, for me I got an error here about cuda toolkit. I think its because my internet connection cut out during the cuda download/install. After the error I ran "conda install cudatoolkit" without the quotes which installed cuda toolkit 11.3. This worked but you can also specify a version. It probably has to be above 11.1 for RTX 3xxx cards.

That should be about it. I tried to write this as beginner friendly as possible. If this works for you please post a reply and confirm. Hope this helps.

This is the error message I get when I run_windows.bat. pls help

1686239325.718170] Loading Predictor

Traceback (most recent call last): File "afy/cam fomm.py", line 218, in **predictor_args File "C:\Users\nzeme\avatarify-python\afy\predictor_local.py", line 49, in init self.fa face alignment.FaceAlignment (face_alignment. LandmarksType._2D, Flip input=True, device=self.device) File "C:\Users\nzeme\miniconda3/envs\avatarify\lib\enum.py", line 354, in getattr raise AttributeError(name) from None AttributeError: 2D

CharlesFranklin12 commented 11 months ago

you have to uninstall the current pytorch by runnning this (in your avatarify environment.....cd avatarify-python....etc)

pip uninstall torch

after install pytorch with cuda using this

pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116

The error message I get when I run_windows.bat

1686239325.718170] Loading Predictor

Traceback (most recent call last): File "afy/cam fomm.py", line 218, in **predictor_args File "C:\Users\nzeme\avatarify-python\afy\predictor_local.py", line 49, in init self.fa face alignment.FaceAlignment (face_alignment. LandmarksType._2D, Flip input=True, device=self.device) File "C:\Users\nzeme\miniconda3/envs\avatarify\lib\enum.py", line 354, in getattr raise AttributeError(name) from None AttributeError: 2D

MICKYGEM commented 11 months ago

Check my video on YouTube or send message to WhatsApp

On Sun, 30 Jul 2023 at 10:43 AM, CharlesFranklin12 @.***> wrote:

you have to uninstall the current pytorch by runnning this (in your avatarify environment.....cd avatarify-python....etc)

pip uninstall torch

after install pytorch with cuda using this

pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116

The error message I get when I run_windows.bat

1686239325.718170] Loading Predictor

Traceback (most recent call last): File "afy/cam fomm.py", line 218, in **predictor_args File "C:\Users\nzeme\avatarify-python\afy\predictor_local.py", line 49, in init self.fa face alignment.FaceAlignment (face_alignment. LandmarksType._2D, Flip input=True, device=self.device) File "C:\Users\nzeme\miniconda3/envs\avatarify\lib\enum.py", line 354, in getattr raise AttributeError(name) from None AttributeError: 2D

— Reply to this email directly, view it on GitHub https://github.com/alievk/avatarify-python/issues/572#issuecomment-1657093148, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKL6YJ3A6FFBJP3MC3JNSP3XSYUEFANCNFSM6AAAAAAXE7LASY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- MICKYGEM💎

engrmarcel commented 10 months ago

Check my video on YouTube or send message to WhatsApp On Sun, 30 Jul 2023 at 10:43 AM, CharlesFranklin12 @.*> wrote: you have to uninstall the current pytorch by runnning this (in your avatarify environment.....cd avatarify-python....etc) pip uninstall torch after install pytorch with cuda using this pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116 The error message I get when I run_windows.bat 1686239325.718170] Loading Predictor Traceback (most recent call last): File "afy/cam fomm.py", line 218, in *predictor_args File "C:\Users\nzeme\avatarify-python\afy\predictor_local.py", line 49, in init self.fa face alignment.FaceAlignment (face_alignment. LandmarksType._2D, Flip input=True, device=self.device) File "C:\Users\nzeme\miniconda3/envs\avatarify\lib\enum.py", line 354, in getattr raise AttributeError(name) from None AttributeError: 2D — Reply to this email directly, view it on GitHub <#572 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKL6YJ3A6FFBJP3MC3JNSP3XSYUEFANCNFSM6AAAAAAXE7LASY . You are receiving this because you are subscribed to this thread.Message ID: @.> -- MICKYGEM💎

i am having same issue. Where is the video link?

prom123456 commented 10 months ago

Seems the install procedure is difficult for most and the people who know how have the most vague and short answers. I can't say this will work for everyone but this is what worked for me. My install is on Xeon E3 1240 V5, 16GB Ram, RTX 3060 TI 8GB, Windows 10. If you have a 1xxx or 2xxx series card I think you can just use the avatarify desktop install which is a simple .exe file.

First, make sure you have at least 10GB free space on your C drive AND the drive you are installing to if it's not the C drive. These github repos start downloading and extracting GBs of files only God knows where. Make sure you have a steady internet connection. Also make sure your computer meets the minimum requirements. Don't ask why it doesn't work on your 586 with voodoo gpu.

Watch this video and follow it except for the changes I mention: https://www.youtube.com/watch?v=lym9ANVb120

Go here and scroll to the section with Windows install instructions: https://github.com/alievk/avatarify-python/tree/master/docs The same video is at the top.

Follow the instructions. Make a fresh start to prevent any previous attempts at install from complicating things.

  1. Install miniconda 3.8 where ever you want (mine is on the F: drive and this is where the env and huge lib files will be but it may also put some files on the C drive in appdata so I recommend using the C drive to avoid complications).
  2. Install git
  3. Create a folder somewhere that you want to install Avatarify. (like C:\Documents\Avatarify) Go to said folder and right click in the address bar and copy as text.
  4. Run Miniconda as Admin (just incase it wants to put files somewhere it needs privledges)

Click in Miniconda and type the drive where the folder you created in step 3 is located like this "F:" without the quotes. Your prompt should change to that drive letter. If your folder is on the C drive you don't have to type "C:" cause you are already on it. Now type "cd" then spacebar and paste the folder address you copied in step 3 and hit enter. Your prompt should change to indicate you are now in the folder you created.

  1. Paste this into the prompt "git clone https://github.com/alievk/avatarify-python.git" without the quotes. That should copy the files into the folder.
  2. Paste this into the prompt "cd avatarify-python" without the quotes. CD means change directory so now you should be into the folder with the files.
  3. Now open a file explorer and go to the folder you just git cloned. You should have some files there that need to be changed. Right click on the file and edit in notepad. These are the files that need to be changed and the changes I made. Edit requirements.txt in the main folder. Edit install_windows.bat which is in the scripts folder within the main folder. Make sure to save the changes and close the notepads. I used cudatoolkit 11.1 initially. Newer versions may work. Don't change run_windows.bat

Avatarify_Install_Instructions

install_windows.bat

@echo off

REM Check prerequisites
call conda --version >nul 2>&1 && ( echo conda found ) || ( echo conda not found. Please refer to the README and install Miniconda. && exit /B 1)
REM call git --version >nul 2>&1 && ( echo git found ) || ( echo git not found. Please refer to the README and install Git. && exit /B 1)

call scripts/settings_windows.bat

call conda create -y -n %CONDA_ENV_NAME% python=3.7
call conda activate %CONDA_ENV_NAME%

call mamba install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c nvidia -c conda-forge
call conda install -y scikit-image python-blosc -c conda-forge
call conda install -y -c anaconda git

REM ###FOMM###
call rmdir fomm /s /q
call git clone https://github.com/alievk/first-order-model.git fomm

call pip install -r requirements.txt

requirements.txt

opencv-python>=4.2.0.34
face-alignment==1.3.3
pyzmq==20.0.0
msgpack-numpy==0.4.7.1
pyyaml==5.4
requests==2.25.1
pyfakewebcam==0.1.0
  1. Go back to miniconda and make sure your prompt is still in the main folder. Run "conda install -c conda-forge mamba" without the quotes. Got this bit from Donvickins aswell as the modified script.
  2. Finally run "scripts\install_windows.bat" without the quotes. If it doesn't run make sure miniconda is in the right folder.
  3. Watch for everything to install. cuda is a 3GB download so it could take a while. Hit y whenever prompted. If your internet cuts out during the download like mine did run "scripts\install_windows.bat" again until it finishes. Let environment solving run. It took about 15 minutes for me. Hours seems excessive and maybe something didn't get installed properly.
  4. Download network weights and place vox-adv-cpk.pth.tar file in the avatarify-python directory (don't unpack it)
  5. Run "run_windows.bat" without the quotes. Make sure you have a camera attached. If it works, great, you're done. Now, for me I got an error here about cuda toolkit. I think its because my internet connection cut out during the cuda download/install. After the error I ran "conda install cudatoolkit" without the quotes which installed cuda toolkit 11.3. This worked but you can also specify a version. It probably has to be above 11.1 for RTX 3xxx cards.

That should be about it. I tried to write this as beginner friendly as possible. If this works for you please post a reply and confirm. Hope this helps.

this helped me

advaking1 commented 9 months ago

please help got this issue and did

pip uninstall torch

after install pytorch with cuda using this

pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116

but still gave same issue

SanPatrick01 commented 9 months ago

What issue ?

SanPatrick01 commented 9 months ago

Send pictures or video to my dm

advaking1 commented 9 months ago

Capture11

this is the issue

SanPatrick01 commented 9 months ago

Sent to WhatsApp

advaking1 commented 9 months ago

i dont have ur whatsapp

SanPatrick01 commented 9 months ago

‪+234 811 513 3627‬

Aut85 commented 4 months ago

have the same problem please i need helps

Aut85 commented 4 months ago

![Uploading Screenshot 2024-02-11 030146.png…]()

Aut85 commented 4 months ago

Screenshot 2024-02-11 030146

SanPatrick01 commented 4 months ago

What problem

SanPatrick01 commented 4 months ago

Downlaod anydesk and send pic or video to my whatsappp

‪+234 811 513 3627‬

innodollars commented 3 weeks ago

@yungpalizawa it should use the GPU if you have all the dependencies installed and working. AFAIK it is CUDA that uses the best device it can find, so if it doesn't use your GPU you can look for resources about troubleshooting that.

Thank you. I got it fixed later, it was using pytorch but the cpu version. I had to uninstall and then redownload the pytorch-GPU version. Now I get at least 27 FPS.

please i need help i have rtx 4060 yet am stuck at 3 fps

Oluwashawn commented 3 weeks ago

@yungpalizawa it should use the GPU if you have all the dependencies installed and working. AFAIK it is CUDA that uses the best device it can find, so if it doesn't use your GPU you can look for resources about troubleshooting that.

Thank you. I got it fixed later, it was using pytorch but the cpu version. I had to uninstall and then redownload the pytorch-GPU version. Now I get at least 27 FPS.

please i need help i have rtx 4060 yet am stuck at 3 fps

You're stick at 3 fps because it is using CPU pytorch , here's how to fix it

Uninstall pytorch using this code in your avatarify

After you type "CD avatarify"

Type "pip uninstall pytorch"

Then accept , once it is done uninstalling the pytorch you will install a GPU pytorch using this code

"pip install torch -f https://download.pytorch.org/whl/torch_stable.html"

It will download about 3.9gb of data be patient and after which your avatar should run with the gpu @ 22 to 30fps depending on your GPU

If you get any L***"".lib has been initialized error after installing the gpu pytorch, hit me up on Whatsapp +2348140718484

Nene020 commented 3 weeks ago

Nvidia 30 and 40 series Dm on telegram @King_Gabos