Skip to content

How to start the training

Richard Fan edited this page Jan 8, 2020 · 15 revisions

Running this stack requires you to open multiple terminal windows. If you are using local machine, you are fine. If you are using SSH to access remote machine, I recommend you to use tmux to create multiple session

Learn more about tmux

This guide is for Ubuntu Linux. There may be some difference for other OS

Setup

  1. Clone the repository

    cd ~
    git clone https://github.com/richardfan1126/deepracer.git
    cd deepracer
    git checkout -b 2020_version origin/2020_version
    git submodule update --init --recursive
    
  2. Install Minio

    cd ~
    wget https://dl.min.io/server/minio/release/linux-amd64/minio
    chmod +x minio
    sudo mv minio /usr/local/bin/
    
  3. Setup virtualenv / Create required folders

    cd ~
    sudo apt update
    sudo apt install -y virtualenv python3
    virtualenv --python=python3 venv
    source ~/venv/bin/activate
    cd deepracer/
    pip install PyYAML==3.11
    pip install urllib3==1.21.1
    pip install -U sagemaker-python-sdk/ awscli ipython pandas
    cd ~
    mkdir ~/data
    deactivate
    
  4. Install Docker

    cd ~
    sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    sudo add-apt-repository -y "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
    sudo apt-get update
    sudo apt-get install -y docker-ce
    sudo usermod -aG docker $USER
    

    After installing, logout from the current user, or exit from SSH session and re-login

  5. Pull docker images

    docker pull richardfan1126/sagemaker-rl-tensorflow:console_v2.0
    docker pull richardfan1126/deepracer_robomaker:console_v2.0
    
  6. Setup Minio

    1. Open a new terminal window, or new tmux session if you are using SSH

      cd ~
      minio server data/
      

      Markdown the AccessKey and SecretKey shown, and exit from the current session (Make sure you are not terminating the session. Keep Minio running on background)

    2. Put AccessKey and SecretKey into config files

      • ~/deepracer/rl_coach/env.sh
      • ~/deepracer/robomaker.env
    3. Create a new bucket

      1. Open browser, and go to http://<machine_ip>:9000

      2. Use the AccessKey and SecretKey to login

      3. Click the button on the bottom right corner and click Create bucket

      4. Name the bucket bucket, then press Enter

      5. Close the browser, you don't need it anymore

    4. Copy pre-defined custom files into the bucket

      Go back to the terminal

      cp -r ~/deepracer/custom_files/ ~/data/bucket/
      

Customize training

Customize training

Run the training

  1. Start Minio (If you haven't started during setup)

    1. Open a new terminal window, or new tmux session if you are using SSH

      cd ~
      minio server data/
      
    2. Exit from the current session (Make sure you are not terminating the session. Keep Minio running on background)

  2. Start SageMaker

    1. Open a new terminal window, or new tmux session if you are using SSH

      source ~/venv/bin/activate
      cd ~/deepracer/rl_coach/
      source env.sh
      ipython rl_deepracer_coach_robomaker.py
      
    2. Exit from the current session (Make sure you are not terminating the session. Keep SageMaker running on background)

  3. Start RoboMaker

    1. Write machine IP into environment variable (Only for the first time)

      echo "S3_ENDPOINT_URL=http://$(hostname -I | cut -d' ' -f1):9000" >> ~/deepracer/robomaker.env
      
    2. Open a new terminal window, or new tmux session if you are using SSH

      source ~/venv/bin/activate
      cd ~/deepracer/
      docker run --rm --name dr --env-file ./robomaker.env -v $(pwd)/simulation/aws-robomaker-sample-application-deepracer/simulation_ws/src:/app/robomaker-deepracer/simulation_ws/src --network sagemaker-local -p 8080:5900 -it richardfan1126/deepracer_robomaker:console_v2.0
      
    3. Exit from the current session (Make sure you are not terminating the session. Keep RoboMaker running on background)