Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

87 lines (73 sloc) 4.23 KB

All steps are based on:

Credit goes to them for doing all of the hard work!

Bold lines are terminal commands

Preparation

  1. In a terminal window, redirect to ~/ if need be
  2. If Homebrew isn't installed:
  1. brew install minio/stable/minio
  2. Install VNCViewer
  3. Install Docker
  4. Run Docker. In Docker's Preferences, under the Advanced tab, you may need to up the resources.
  5. git clone --recurse-submodules https://github.com/crr0004/deepracer.git

Minio Setup

  1. In Finder, navigate to your cloned repo. It should be at ~/deepracer
  • Navigate to folder rl_coach
  • Using any code or text editor, open env.sh
  • On lines 3 and 4, replace minio and miniokey with your AWS access key and password
  • On line 12, replace "$(hostname -i)" with your actual IP address (ie: 192.168.1.xxx)
  • On line 14, replace "readlink" with "greadlink" and save the file
  1. cd deepracer/rl_coach
  2. brew install coreutils
  3. . ./env.sh
  4. minio server data
  5. In a web browser, navigate to your Minio server (http://127.0.0.1:9000) and login using "minio" and "miniokey"
  6. Create a bucket called "bucket"
  7. In Finder, navigate to ~/deepracer/rl_coach/data. There should now be a bucket folder. Within the bucket folder, create a new folder called "custom_files". Place your reward.py file in /custom_files. This should automatically upload to your Minio bucket.

Sagemaker Setup

  1. From Terminal, open a new shell (command+T)
  2. cd .. to return to ~/deepracer
  3. python3 -m venv sagemaker_venv
  4. . sagemaker_venv/bin/activate
  5. pip install PyYAML==3.11
  6. pip install urllib3==1.21.1
  7. pip install -U sagemaker-python-sdk/ awscli ipython pandas
  8. docker pull crr0004/sagemaker-rl-tensorflow:console
  9. docker tag crr0004/sagemaker-rl-tensorflow:console 520713654638.dkr.ecr.us-east-1.amazonaws.com/sagemaker-rl-tensorflow:coach0.11-cpu-py3
  10. mkdir -p ~/.sagemaker && cp config.yaml ~/.sagemaker
  11. cd rl_coach
  12. export LOCAL_ENV_VAR_JSON_PATH=$(greadlink -f ./env_vars.json)
  13. mkdir ~/robo
  14. mkdir ~/robo/container
  15. In ~/deepracer/rl_coach, open rl_deepracer_coach_robomaker.py in an editor.
  • Make sure that your endpoint_url (line 27) is the url to your minio server (ie: 192.168.1.xxx:9000)
  • For CPU training, make sure instance_type (line 92) is "local" and image_name (line 108) is "crr0004/sagemaker-rl-tensorflow:console"
  • Save the file
  1. ipython rl_deepracer_coach_robomaker.py

Robomaker Setup

  1. From Terminal, open a new shell (command+T)
  2. cd .. to return to ~/deepracer
  3. . sagemaker_venv/bin/activate
  4. cd rl_coach
  5. . ./env.sh
  6. docker pull crr0004/deepracer_robomaker:console
  7. cd ..
  8. In ~/deepracer, open robomaker.env in an editor.
  • Again, make sure that your S3_ENDPOINT_URL is the url to your minio server (ie: 192.168.1.xxx:9000)
  • Save the file
  1. docker run --rm --name dr --env-file ./robomaker.env --network sagemaker-local -p 8080:5900 -it crr0004/deepracer_robomaker:console

Watch the training

  1. Open VNC Viewer
  2. Connect to 127.0.0.1:8080
  3. Hope everything worked out and training starts after everything is loaded.

NOTES

  • You should have three Terminal windows open during training
    1. Minio Server
    2. Training Episodes/Policy Training logs
    3. Step logs
  • The terminal with the step logs will repeat a message until the policy training is complete.
  • These steps are for CPU training. CPU training will slow down during the policy training. Each policy training session after a training iteration will get progressively slower.
  • After setting up, you can follow these steps to train a new model.
  • Please let me know if something needs revising, I've missed a step, or something isn't clear!
You can’t perform that action at this time.