Voiced Greetings

Discuss modding questions and implementation details.
communityus
Posts: 41
Joined: Fri Apr 05, 2019 1:51 am

Re: Voiced Greetings

Post by communityus » Wed Feb 26, 2020 5:45 pm

MasonFace wrote:
Sun Feb 23, 2020 3:01 am
...
Let me know if you need help getting setup. It's a typical Python/Conda/Pytorch/Cuda/Tensorflow setup that's common with machine learning projects on GitHub... which means its a headache when any one of these volatile platforms updates its code and deprecates some method that one of the others depends on....
...
I know there was some Unity 3d platformer AI/ML - python / cuda goodness I wanted to try too. I also wanted to try AI upscaling and now this... I think for me it often becomes a matter of finding the standard practices of getting an environment like this setup. Thinking back to the AI upscaling thread and now this - you seem to run an environment well suited to trying new stuff. I think the biggest help for myself would be sharing a bit about your dev environment that we could walk away with some practical approaches to improving our own.

My assumption has always been that you use docker for most of these setups, but perhaps that isn't the case because I don't remember if AI upscaling had any docker stuff, At any rate, any pearls of wisdom on setting up a environment that can quickly try out new projects like this would be very helpful.

[update]
It looks like perhaps this is the dev env you use?
https://sites.google.com/view/aiupscali ... stallation

User avatar
MasonFace
Posts: 417
Joined: Tue Nov 27, 2018 7:28 pm
Location: Tennessee, USA
Contact:

Re: Voiced Greetings

Post by MasonFace » Wed Feb 26, 2020 9:40 pm

I also wanted to try AI upscaling and now this...
Take a look at my AI Upscaling Tutorial. I have in there somewhere some instructions on getting setup in a Windows 10 environment.
it often becomes a matter of finding the standard practices of getting an environment like this setup.
Unfortunately, that's part of the problem. There is no standard that I'm aware of. I haven't actually used Docker as you mentioned, but I think that would be the closest to standardization as there is. The only reason I haven't tried it out is because at one point it required Window 10 Enterprise edition, and I only have Home edition. I just checked the Docker Hub website and I don't see anything about that requirement now. I may try giving it another shot sometime. I also haven't really ever used Anaconda, even though I have it installed...

From my understanding, Docker and Anaconda help to simplify a lot of the ML environment setup, but I've been lucky in getting some of the GitHub AI/ML projects running on my PC without them. All this is also supposed to be easier in Linux, and maybe it is, but I tried with Ubuntu and didn't have much success, so I switched back to Win10.

So anyway, my instructions assume that you are using Windows 10 and have an mid-to-high tier Nvidia graphics card (I have a GeForce GTX1060 6GB and it works just fine).

I pretty much just followed the instructions in the Quick Start section of the Project page, but I'll add some helpful hints.

You can also follow my ESRGAN installation instructions here for more information. It will be a lot of the same steps, but some variables may be different.

Hint: You may want to look ahead at some of the downloads and get them started now. Some of them are pretty big (> 1GB). Cuda is 2.6GB, the pretrained models are about 350 MB, and the LibriSpeed dataset is really big too but I don't remember how big it is exactly although it is optional.

Step 1: Install Cuda 10 (This is omitted from the GitHub project page for some reason. Cuda is what allows the GPU to do all the computationally expensive machine learning "tensor" equations on the GPU which is MUCH faster than doing it on the CPU)

Install Cuda 10 for Windows 10 here.

The installer is a whopping 2.6GB for the Cuda toolkit. Just use the default settings and it should work okay. It will insist on installing video card drivers along with it. It's supposed to be loaded with the latest drivers, so it shouldn't harm anything.

Step 2: Install Python 3.7 for Windows (Python is the language that shoe-strings all the ML code together)

Here is the link to download Python 3.7.6 (Windows Executable).

HINT: When installing, one of the first prompts will have a toggle box somewhere to "add python to system path" or "add python to environment variables". Make sure it is selected!

Image
The above image is from my ESRGAN installation tutorial using Python 3.6, so it
may look a little different from 3.7 but the concept is the same.



By default it should also install "PIP" along with it which allows you to install lost of other packages using the command prompt (terminal) very easily.

Step 3: Install PyTorch (A machine learning library)

Open a command prompt (link here for help) and paste the following command:
pip install torch===1.4.0 torchvision===0.5.0 -f https://download.pytorch.org/whl/torch_stable.html
then press enter to run the command. If successful, it should say that it's downloading and installing.

This is the version of PyTorch for Windows using Cuda 10, installed via PIP for Python.

Step 4: Clone the project GitHub project.

You can just download the ZIP and extract the whole project to somewhere on your computer.

Step 5: Install other package requirements (There's a bunch of other little programs that this GitHub project relies on. Instead of installing them one-by-one manually, you can just load up a txt file that lists all the packages it needs and installs them all for you in a batch.)

Using your command prompt (again, they call this a "terminal" for some reason) navigate to where you extracted the GitHub project.

For example, if you extracted the project to a directory on your hard drive "C:\ML Projects\Real-Time-Voice-Cloning, then enter the following commands:
C: (then press enter)
cd "C:\ML Projects\Real-Time-Voice-Cloning"
The "cd" is a change directory command.

If successful, it should put you in the directory that you extracted the project to.

Now when you run python commands, it will be in context to this project directory.

So now you can use the command:
pip install -r requirements.txt
If successful, it should install a bunch of packages.

I had it tell me that a package didn't install, but it all still worked anyhow... I got lucky.

Step 6: Download the pretrained models (the models are the trained "weights" between neurons that give the ML algorithm that "thinky" behavior)

Download link here from either Google Drive or MEGA. The MEGA link is probably faster depending on where you live.

Extract it into your project folder. It has the same path structure, so the models should just fit into the right directory in there.

Step 7: (Optional) Download the LibriSpeech dataset. You can load these voices into the toolbox instead of recording your own voice.

Download here.

Extract the contents of the compressed file anywhere in your project folder, just take note of what folder you extracted it to... that will be the <datasets_root> folder that you need to use when you launch the toolbox in order to get them loaded into the program.

Step 8: Test your configuration (the last stretch!)

In terminal, type the following command (assuming that you're still navigated in your project root folder):
python demo_cli.py
If successful, then you're good to go!

Step 9: Run the toolbox and have some fun.

In terminal, run the following command:
python demo_toolbox.py
or if you have the LibriSpeech dataset downloaded, use:
python demo_toolbox.py -d <datasets_root>
where <datasets_root> is the directory where you extracted it.


Hope that all helps.
Last edited by MasonFace on Thu Feb 27, 2020 1:46 pm, edited 2 times in total.

communityus
Posts: 41
Joined: Fri Apr 05, 2019 1:51 am

Re: Voiced Greetings

Post by communityus » Thu Feb 27, 2020 3:09 am

Awesome write up, thank you.

Everything makes sense...I think I hit my first "snag":
which means its a headache when any one of these volatile platforms updates its code and deprecates some method that one of the others depends on....

Code: Select all

ImportError: Could not find 'cudart64_100.dll'. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Download and install CUDA 10.0 from this URL: https://developer.nvidia.com/cuda-90-download-archive
From what research I have done so far, I guess the present CUDA 10, still for some reason uses cuda_9.0.176 so the dlls that the old CUDA 10 gave us back in Sep. 2018 are now gone and we need to grab the Sep. 2018 Cuda 10. Trying that now.
MasonFace wrote:
Wed Feb 26, 2020 9:40 pm
Install Cuda 10 for Windows 10 here.
Link above is for Cuda 10 but nvidia still calls it cuda_9.0.176.

And ofc the dll we get with that is cudart64_90.dll and this library expects cudart64_100.dll

Just word to the wise at this point I think I can sort this error out.

For kicks I did just try duplicating the cudart64_90.dll and renaming it cudart64_100.dll it passed the check but next error up is ...

Code: Select all

Could not find 'cudnn64_7.dll'
So likely best to just try the Sep. 2018 - where some of the research on this error has taken me and hope for the best.
https://developer.nvidia.com/cudnn?

communityus
Posts: 41
Joined: Fri Apr 05, 2019 1:51 am

Re: Voiced Greetings

Post by communityus » Thu Feb 27, 2020 6:18 am

Okay...now cooking with gravy.

Way back when I first started playing with python, I wanted to go the visual studio route and plus wanted to stay in Unity comfort zone so I think I followed this on venv (python virtual environments) I install the wrong versions of stuff all the time and often don't document it as I go so messing up a venv was safer for me as I used to just mess up my main env and have to reinstall the OS all the time. this was ok on Linux but on this ML stuff - windows is easier IMHO. So venv

https://github.com/Unity-Technologies/m ... ronment.md

Just pasting my steps below incase someone else wants to join in the fun and has problems. Now we have two approaches.

Code: Select all

G:\AI\python>python -m pipenv --python 3.7
Successfully created virtual environment!
Virtualenv location:
C:\Users\<user>\.virtualenvs\<your random name>

Code: Select all

cd C:\Users\<user>\.virtualenvs\<your random name>
call scripts\activate.bat
cd to where you want to put your git repo

Code: Select all

git clone https://github.com/CorentinJ/Real-Time-Voice-Cloning.git
cd Real-Time-Voice-Cloning
I had played around with trying to get the AI upscaling working in same venv as this, but if AI upscale still involves needing CUDA v9 then perhaps best to have 2x venv's.
Then I found installing the requirements using:

Code: Select all

pip install -r requirements.txt
first! was one key. I was trying to install some of the stuff I needed for AI upscaling and I think I got my package numbers crossed.

So yeah the CUDA v10 download from Sep. 2018 seems to work. following the steps in this order. Then only needed...

torch, but knowing the version issue I wanted to just go for the version that the dev was using when working on this pack. Plus he said somewhere that it is using a lot of old torch code so that seemed important.

Code: Select all

pip install torch==1.0.1 torchvision==0.2.2 -f https://download.pytorch.org/whl/cu100/torch_stable.html
now I can run my test and get it to find the GPU and now just looks like need to drop my training models in a way they want:
FileNotFoundError: [Errno 2] No such file or directory: 'encoder\\saved_models\\pretrained.pt'

I think just knowing someone else is there to sanity check helps give enough confidence to go throw it :-) Thanks again!

User avatar
MasonFace
Posts: 417
Joined: Tue Nov 27, 2018 7:28 pm
Location: Tennessee, USA
Contact:

Re: Voiced Greetings

Post by MasonFace » Thu Feb 27, 2020 1:43 pm

Link above is for Cuda 10 but nvidia still calls it cuda_9.0.176.

And ofc the dll we get with that is cudart64_90.dll and this library expects cudart64_100.dll
Doh! It looks like I gave you the wrong link somehow! I've fixed it in my previous post... sorry about that!

Great write-up on setting up the venv! I think I may try to follow in your footsteps!

And I'm glad that you've made progress getting the Real-Time-Voice-Cloning project running. Sounds like you'll have it running shortly; probably just extracted the models into the wrong directory or something and should be an easy fix.

communityus
Posts: 41
Joined: Fri Apr 05, 2019 1:51 am

Re: Voiced Greetings

Post by communityus » Thu Feb 27, 2020 6:30 pm

Yup! Got it working last night. Playing around a lot. You'll likely see me pop up in AI upscaling thread too. When I have some good results I'll post 'em.

Post Reply