A guide to using the local DeepRacer console
After discovering the beauty of running the DeepRacer locally and writing this article on getting started, I decided to try to improve the interface and make something that is equivalent to, if not better, than the official AWS console that you find when you log in to the AWS DeepRacer console. One of the major issues with running the DeepRacer locally is that there is no version tracking or profile system. This makes going through your thirty different DeepRacer models very cumbersome and time-consuming. So to speed things up, my colleagues and I at ARCC designed a graphical user interface (GUI) that pulls together the best work of the DeepRacer community into one intuitive and effective package. With the GUI, you will find all your models, training files, parameters, utilities, and log analysis in one place.
The DeepRacer local repository with GUI can be found at https://github.com/ARCC-RACE/deepracer-for-dummies.
To get things set up I still recommend following this article and making sure everything works before using the GUI on top of it. The GUI is basically a layer on top of Alex Schultz’s deepracer-for-dummies repository. If the basic functionality of training the DeepRacer locally on Alex’s repo does not work, then it will not work with the GUI! But with that said, you should be able to debug problems and leverage community help in the same way as with Alex’s repo. Just be careful not to mess with file locations or formatting since that will screw up the automated parts of the GUI.
Once you have local DeepRacer running you should be able to get things going with the GUI by simply running
path-to-deepracer-for-dummies/build-gui-Desktop-Release/gui in a terminal window and it should boot right up (see the bottom of the article for a quick guide on building the file and making edits to port to your platform if there is an issue). If it doesn’t run, install the following packages:
sudo apt-get install libqtwebkit5 and
sudo apt-get install libqt5xml5 .
The first thing that you will want to do if you have not done it already, is hit the init button to get the repo and dependencies ready for running the local deepracer. In the log text box, you will be notified when everything is set up or if there is a problem. This button is also helpful if something breaks and your DeepRacer will not train. In this situation, hitting that init button can sometimes help and solve the issue. If not also try hitting the delete model button. If you are concerned about losing your model, no worries, as I will talk about using the profiles system which can prevent that from happening!
Before you click the start button to begin training, you will find the DeepRacer community wiki page (contributors needed!) where you can browse for help or get tips and tricks for training your model.
Once you have to init your repository you should refresh the GUI, which will load in the current reward function, hyperparameters, action space, and track solution. You can edit any of these in the GUI. See the wiki to learn more about hyperparameters, action spaces, or reward functions. The wiki will also have a list of tracks that you can use. Once you edit some values in the GUI, you need to make sure to click the save button to save everything into the files that the local DeepRacer model will actually use for training.
Go ahead and click that start button! You should see everything start and the status printed out to the GUI’s log. If you go to the terminal that you started the GUI in you can see all the standard output that you would normally get from Alex’s repo, a more in-depth log, vnc viewer, and the memory manager. If you wish to use the memory manager to prevent your hard drive from getting filled up with model checkpoints then go ahead and enter your password so it can run with root permissions and accomplish what it needs to. By default, the memory manager will cap the checkpoint and model files to 3GB.
Once everything starts up the DeepRacer wiki page will change over to the log-analysis tool developed by breadcentric. (Note that the repository with the GUI uses repositories forked from Alex Shultz and breadcentric to make sure they remain compatible with the GUI. You can find the forked repositories that you will be using with the GUI here). You can learn more about the log analysis tool here. If the log analysis tool does not open, make sure that you have jupyter installed on your machine
sudo apt-get install jupyter.
Now for a quick run-through of all the main buttons. The goal is that you never need to leave the GUI when training your DeepRacer locally.
- Start: Does the same thing as the start.sh script in Alex Shultz’s repo. This will start your local DeepRacer training with the last saved set of parameters and values.
- Stop: Does the same thing as the stop.sh script in Alex Shultz’s repo. This will stop your local DeepRacer training. Note that when you close the GUI training will also be stopped.
- Save: Saves the settings in the GUI to the files that are used for training. Make sure you do this before starting or else the training session will not actually be using the hyperparameters/reward function/actions space/ track that you see in the console.
- Restart: This is cool! What this button does is allow you to tweak some values in the GUI, save them, and in the click of a button: stop training, save the model to the pre-trained directory so it can be the base for the new model that it is about to train, set the rl_coach (sagemaker) to use a pre-trained model, and then restart training with the model that was originally training but with a new values that you set for it. This allows you to quickly iterate through hyperparameters, reward functions, and even action spaces (although be careful to not change the number of possible actions).
- Pretrained: This toggles the usage of a pre-trained model. If you press it and your rl_coach is set to use the pre-trained model then it changes it to not use a pre-trained model or vice-versa.
- Refresh: This will update the GUI with what is in the files that will be used for training. If you have not saved your latest changes in the GUI then they will be overwritten.
- Upload: This will upload the model that is currently in the pre-trained directory. It will walk you through filling out the S3 bucket and prefix parameters that are required to upload your model to AWS and then submit it to the league. Note: Make sure that there are no leading or trailing spaces when entering in the name of the S3 bucket or prefix.
- Delete: This will delete the current model that is/was being trained. This can be helpful in conjunction with the init button if things start not working.
To make sure the upload is working properly you can check the terminal output in the new tab created in the same terminal window that you launched the application. Your output should contain a line like the following line with the correct target bucket and prefix.
upload: checkpoint/110_Step-467025.ckpt.data-00000-of-00001 to s3://aws-deepracer-118aeaa2-e67e-4bdc-b5e4-b59e78168bec/DeepRacer-SageMaker-RoboMaker-comm-631475372343–20190807170326-fcd28d80–13f6–4264-a66e-e8ab03cc8148/model/110_Step-467025.ckpt.data-00000-of-00001
Those buttons provide the base functionality for the GUI but not the main selling point. If you go to the menu bar you will find a tab that reads profiles (as of writing this file and edit do not do anything). This allows to name, save, and load various profiles with there own unique settings for the track, hyperparameters, reward function, and action space. Each profile also is saved with its model so you can use it as pre-trained if you want (that is basically what loading a profile does). This allows you to store a variety of different models and keep track of them. It accomplishes this by saving to the
profiles file in the root of the repository with an XML file and a corresponding folder for each saved DeepRacer model. All the model's data is saved and can be restored by simply loading the profile. Since the profile’s model is loaded into the pre-trained directory you can easily start training where it left off. Note that if you save two models of the same name then the oldest one will be overwritten. Make sure that use pre-trained is on when trying to pick up training where it was left off.
If something goes wrong and your model stops working or sagemaker stops booting up correctly, the fastest “recovery” method I have found is to copy the profiles folder outside of the repo and the delete/reclone the repo. Once recloned, go ahead and replace the profiles folder with the one you copied and load it back into the GUI to save your configurations.
That is an overview of the core features of the local DeepRacer console. My hope is that the community will contribute to it to help grow it’s the feature set even more overtime to make the experience of locally training a DeepRacer more streamlined.
If you need to build the GUI for a different platform than the release version in the repository is not built for OR you get
segmentationfault errors, then run
qmake gui.pro and
make commands in a terminal in the
gui folder. If you want to go further and edit the code, it is recommended that you install qt-creator with qt 5.9.5 using
sudo apt-get install qtcreator along with libqt5svg5*
sudo apt-get install libqt5svg5*. Note that this is not the most updated version of QT, migration to 5.13 is on the to-do list. The project file to use with qt is simply named
If you have any problems with the GUI make sure to add a bug issue on GitHub so that we can fix it as soon as possible.
For some more community support, also join the DeepRacer slack.