Setting up ML Agents for Unity in 5 Minutes

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
before getting started with ML agents in unity make sure to install python 3.10.1 to your path environment variable selected in your Unity project open the package manager window and you should see the packages being used in your project if you haven't already installed the ml agents package select the unity registry and search for the ml agents package click install and wait for it to finish now open the root directory of your project and your file explorer this folder is called the same name of your Unity project and unless you change something it should contain the assets folder within it open up a command line terminal in this directory and if you don't know how to do that you can simply copy the path or address to your Unity project search for terminal in your operating system search bar and open it then type CD which sets the current directory and paste in your copied path or you can manually type it in if you know where it's located now let's check to make sure we have python installed and your computer detects it type in py and hit enter you should enter the python environment and see the python version appear make sure it shows python 3.0.0 if it shows another version you'll need to switch to python 3.10.1 it depends how you have it installed if neither of those commands work for you you can try restart your computer if you just installed python and if that still doesn't work for you you probably don't have your path variable set up correctly I'll leave a link in the description for that as well if you don't know how to fix it we now need to install a virtual environment which is basically just a folder where we will install all of our python libraries also known as dependencies that EML agents needs to use make sure to exit out of the Python environment and run the command py space- m space venv space venv and VV stands for virtual environment this will create the venv folder with a subfolder called scripts and inside there will be a file called activate we need to run this file to enter our virtual environment we run it by typing its path in the terminal and hitting enter and now we see we are inside the virtual environment when we install python packages it will install them in the venv folder before we we start installing any packages let's make sure we have the latest version of pip which is Python's package installer we do this by running the p-m PIP install D- upgrade pip command let it finish running and hopefully you should see a success message now we can install the ml agents library for python using the command pip install ml agents the ml agents package in unity uses python behind the scenes to handle the machine learning side of ml agents we need to install Python and all Associated packages in order to train our AI inside of unity after that's done we need to install a library called pytorch which is the machine learning library ml agents uses under the hood we do this by running pip install torch space torch Vision space torch audio torch vision and torch audio are pretty self-explanatory they enable your AI to see and hear things and be able to react to them that should be everything we need and we can test it by running ml agents dlearn d-el but you will probably see some errors most of the time it will be a dependency issue where you will simply need to install a missing package in my case I see an error for a package named protuff to fix it I can install the protuff package with the required version that it tells me I need so I run the command pip install protuff equals equals 3 20.3 after it installs I run the help command again and I see that it works if the help command works for you as well then you're done and you're ready to start using ml agents inside of unity however you might run into some other package issues some common ones are for the packaging library and the numpy library if you run into either of these you can simply pip install them and your problem should go away once it starts working I highly suggest you go and watch code monkey's videos on getting started with ML agents he has a bit of an outdated installation guide but his code examples still hold up and I personally learn a lot from them a link to his playlist will be in the description thanks for watching and if you have any problems or questions don't be shy to leave a comment I'll do my best to help and maybe others might be able to as well give this video a like if it helped and I'll see you in my next video
Info
Channel: Pingcode
Views: 4,732
Rating: undefined out of 5
Keywords: ML Agents, Unity, Tutorial, Guide, Walkthrough, C#, Python, Pytorch, protobuf, mlagents learn, AI, Artificial Intelligence
Id: v1d7SinTzEY
Channel Id: undefined
Length: 5min 41sec (341 seconds)
Published: Fri Mar 01 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.