Skip to content

Commit

Permalink
Merge pull request #51 from larsll/dev
Browse files Browse the repository at this point in the history
Version 3.1
  • Loading branch information
larsll authored Feb 3, 2021
2 parents 5acf121 + 9e4a8d7 commit d789d47
Show file tree
Hide file tree
Showing 22 changed files with 228 additions and 320 deletions.
16 changes: 14 additions & 2 deletions bin/activate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ function dr-update-env {

if [[ "${DR_DOCKER_STYLE,,}" == "swarm" ]];
then
export DR_ROBOMAKER_PORT=$(expr 8080 + $DR_RUN_ID)
export DR_ROBOMAKER_TRAIN_PORT=$(expr 8080 + $DR_RUN_ID)
export DR_ROBOMAKER_EVAL_PORT=$(expr 8180 + $DR_RUN_ID)
export DR_ROBOMAKER_GUI_PORT=$(expr 5900 + $DR_RUN_ID)
else
export DR_ROBOMAKER_PORT="8080-8100"
export DR_ROBOMAKER_TRAIN_PORT="8080-8100"
export DR_ROBOMAKER_EVAL_PORT="8080-8100"
export DR_ROBOMAKER_GUI_PORT="5901-5920"
fi

Expand Down Expand Up @@ -88,17 +90,27 @@ fi
if [[ "${DR_CLOUD,,}" == "azure" ]];
then
export DR_LOCAL_S3_ENDPOINT_URL="http://localhost:9000"
export DR_MINIO_URL="http://minio:9000"
DR_LOCAL_PROFILE_ENDPOINT_URL="--profile $DR_LOCAL_S3_PROFILE --endpoint-url $DR_LOCAL_S3_ENDPOINT_URL"
DR_TRAIN_COMPOSE_FILE="$DR_DOCKER_FILE_SEP $DIR/docker/docker-compose-training.yml $DR_DOCKER_FILE_SEP $DIR/docker/docker-compose-endpoint.yml"
DR_EVAL_COMPOSE_FILE="$DR_DOCKER_FILE_SEP $DIR/docker/docker-compose-eval.yml $DR_DOCKER_FILE_SEP $DIR/docker/docker-compose-endpoint.yml"
DR_MINIO_COMPOSE_FILE="$DR_DOCKER_FILE_SEP $DIR/docker/docker-compose-azure.yml"
elif [[ "${DR_CLOUD,,}" == "local" ]];
then
export DR_LOCAL_S3_ENDPOINT_URL="http://localhost:9000"
export DR_MINIO_URL="http://minio:9000"
DR_LOCAL_PROFILE_ENDPOINT_URL="--profile $DR_LOCAL_S3_PROFILE --endpoint-url $DR_LOCAL_S3_ENDPOINT_URL"
DR_TRAIN_COMPOSE_FILE="$DR_DOCKER_FILE_SEP $DIR/docker/docker-compose-training.yml $DR_DOCKER_FILE_SEP $DIR/docker/docker-compose-endpoint.yml"
DR_EVAL_COMPOSE_FILE="$DR_DOCKER_FILE_SEP $DIR/docker/docker-compose-eval.yml $DR_DOCKER_FILE_SEP $DIR/docker/docker-compose-endpoint.yml"
DR_MINIO_COMPOSE_FILE="$DR_DOCKER_FILE_SEP $DIR/docker/docker-compose-local.yml"
elif [[ "${DR_CLOUD,,}" == "remote" ]];
then
export DR_LOCAL_S3_ENDPOINT_URL="$DR_REMOTE_MINIO_URL"
export DR_MINIO_URL="$DR_REMOTE_MINIO_URL"
DR_LOCAL_PROFILE_ENDPOINT_URL="--profile $DR_LOCAL_S3_PROFILE --endpoint-url $DR_LOCAL_S3_ENDPOINT_URL"
DR_TRAIN_COMPOSE_FILE="$DR_DOCKER_FILE_SEP $DIR/docker/docker-compose-training.yml $DR_DOCKER_FILE_SEP $DIR/docker/docker-compose-endpoint.yml"
DR_EVAL_COMPOSE_FILE="$DR_DOCKER_FILE_SEP $DIR/docker/docker-compose-eval.yml $DR_DOCKER_FILE_SEP $DIR/docker/docker-compose-endpoint.yml"
DR_MINIO_COMPOSE_FILE=""
else
DR_LOCAL_PROFILE_ENDPOINT_URL=""
DR_TRAIN_COMPOSE_FILE="$DR_DOCKER_FILE_SEP $DIR/docker/docker-compose-training.yml"
Expand Down
6 changes: 6 additions & 0 deletions bin/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ elif [[ "${OPT_CLOUD}" == "azure" ]]; then
sed -i "s/<LOCAL_PROFILE>/azure/g" $INSTALL_DIR/system.env
sed -i "s/<AWS_DR_BUCKET>/not-defined/g" $INSTALL_DIR/system.env
echo "Please run 'aws configure --profile azure' to set the credentials"
elif [[ "${OPT_CLOUD}" == "remote" ]]; then
AWS_REGION="us-east-1"
sed -i "s/<LOCAL_PROFILE>/minio/g" $INSTALL_DIR/system.env
sed -i "s/<AWS_DR_BUCKET>/not-defined/g" $INSTALL_DIR/system.env
echo "Please run 'aws configure --profile minio' to set the credentials"
echo "Please define DR_REMOTE_MINIO_URL in system.env to point to remote minio instance."
else
AWS_REGION="us-east-1"
sed -i "s/<LOCAL_PROFILE>/minio/g" $INSTALL_DIR/system.env
Expand Down
26 changes: 2 additions & 24 deletions bin/scripts_wrapper.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
#!/bin/bash

function dr-upload-custom-files {
if [[ "${DR_CLOUD,,}" == "azure" || "${DR_CLOUD,,}" == "local" ]];
then
if [[ "${DR_DOCKER_STYLE,,}" == "swarm" ]];
then
docker stack deploy $DR_MINIO_COMPOSE_FILE s3
else
docker-compose $DR_MINIO_COMPOSE_FILE -p s3 --log-level ERROR up -d
fi
fi
eval CUSTOM_TARGET=$(echo s3://$DR_LOCAL_S3_BUCKET/$DR_LOCAL_S3_CUSTOM_FILES_PREFIX/)
echo "Uploading files to $CUSTOM_TARGET"
aws $DR_LOCAL_PROFILE_ENDPOINT_URL s3 sync $DIR/custom_files/ $CUSTOM_TARGET
Expand Down Expand Up @@ -40,15 +31,6 @@ function dr-increment-upload-model {
}

function dr-download-custom-files {
if [[ "${DR_CLOUD,,}" == "azure" || "${DR_CLOUD,,}" == "local" ]];
then
if [[ "${DR_DOCKER_STYLE,,}" == "swarm" ]];
then
docker stack deploy $DR_MINIO_COMPOSE_FILE s3
else
docker-compose $DR_MINIO_COMPOSE_FILE -p s3 --log-level ERROR up -d
fi
fi
eval CUSTOM_TARGET=$(echo s3://$DR_LOCAL_S3_BUCKET/$DR_LOCAL_S3_CUSTOM_FILES_PREFIX/)
echo "Downloading files from $CUSTOM_TARGET"
aws $DR_LOCAL_PROFILE_ENDPOINT_URL s3 sync $CUSTOM_TARGET $DIR/custom_files/
Expand Down Expand Up @@ -78,19 +60,15 @@ function dr-stop-evaluation {


function dr-start-tournament {
dr-update-env
$DIR/scripts/tournament/start.sh "$@"
}

function dr-stop-tournament {
ROBOMAKER_COMMAND="" bash -c "cd $DIR/scripts/tournament && ./stop.sh"
echo "Tournaments are no longer supported. Use Head-to-Model evaluation instead."
}


function dr-start-loganalysis {
ROBOMAKER_COMMAND="" bash -c "cd $DIR/scripts/log-analysis && ./start.sh"
}


function dr-stop-loganalysis {
eval LOG_ANALYSIS_ID=$(docker ps | awk ' /loganalysis/ { print $1 }')
if [ -n "$LOG_ANALYSIS_ID" ]; then
Expand Down
8 changes: 4 additions & 4 deletions defaults/dependencies.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"master_version": "3.0",
"master_version": "3.1",
"containers": {
"rl_coach": "3.0.5",
"robomaker": "3.0.6",
"sagemaker": "3.0.2"
"rl_coach": "3.1.0",
"robomaker": "3.1.0",
"sagemaker": "3.1.0"
}
}
3 changes: 2 additions & 1 deletion defaults/hyperparameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
"num_epochs": 10,
"stack_size": 1,
"term_cond_avg_score": 350.0,
"term_cond_max_episodes": 1000
"term_cond_max_episodes": 1000,
"sac_alpha": 0.2
}
2 changes: 2 additions & 0 deletions defaults/model_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@
],
"sensor": ["FRONT_FACING_CAMERA"],
"neural_network": "DEEP_CONVOLUTIONAL_NETWORK_SHALLOW",
"training_algorithm": "clipped_ppo",
"action_space_type": "discrete",
"version": "3"
}
24 changes: 0 additions & 24 deletions defaults/sample-tournament.json

This file was deleted.

27 changes: 16 additions & 11 deletions defaults/template-run.env
Original file line number Diff line number Diff line change
@@ -1,37 +1,42 @@
DR_RUN_ID=0
DR_WORLD_NAME=reInvent2019_track
DR_RACE_TYPE=TIME_TRIAL
DR_CAR_COLOR=Red
DR_CAR_NAME=FastCar
DR_CAR_BODY_SHELL_TYPE=deepracer
DR_CAR_COLOR=Red
DR_DISPLAY_NAME=$DR_CAR_NAME
DR_RACER_NAME=racer1
DR_RACER_NAME=$DR_CAR_NAME
DR_ENABLE_DOMAIN_RANDOMIZATION=False
DR_UPLOAD_S3_PREFIX=DeepRacer-SageMaker-RoboMaker-comm-prefix
DR_EVAL_NUMBER_OF_TRIALS=5
DR_EVAL_IS_CONTINUOUS=False
DR_EVAL_NUMBER_OF_TRIALS=3
DR_EVAL_IS_CONTINUOUS=True
DR_EVAL_OFF_TRACK_PENALTY=5.0
DR_EVAL_COLLISION_PENALTY=5.0
DR_EVAL_SAVE_MP4=False
DR_EVAL_OPP_S3_MODEL_PREFIX=rl-deepracer-sagemaker
DR_EVAL_OPP_CAR_BODY_SHELL_TYPE=deepracer
DR_EVAL_OPP_CAR_NAME=FasterCar
DR_EVAL_OPP_DISPLAY_NAME=$DR_EVAL_OPP_CAR_NAME
DR_EVAL_OPP_RACER_NAME=$DR_EVAL_OPP_CAR_NAME
#DR_EVAL_RTF=1.0
DR_TRAIN_CHANGE_START_POSITION=True
DR_TRAIN_ALTERNATE_DRIVING_DIRECTION=False
DR_TRAIN_START_POSITION_OFFSET=0.0
DR_TRAIN_ROUND_ROBIN_ADVANCE_DIST=0.05
DR_TRAIN_MULTI_CONFIG=False
DR_TRAIN_MIN_EVAL_TRIALS=5
#DR_TRAIN_RTF=1.0
DR_LOCAL_S3_MODEL_PREFIX=rl-deepracer-sagemaker
DR_LOCAL_S3_PRETRAINED=False
DR_LOCAL_S3_PRETRAINED_PREFIX=rl-sagemaker-pretrained
DR_LOCAL_S3_PRETRAINED_CHECKPOINT=last
DR_LOCAL_S3_MODEL_PREFIX=rl-deepracer-sagemaker
DR_LOCAL_S3_BUCKET=bucket
DR_LOCAL_S3_CUSTOM_FILES_PREFIX=custom_files
DR_LOCAL_S3_TRAINING_PARAMS_FILE=training-params.yaml
DR_LOCAL_S3_EVAL_PARAMS_FILE=eval-params.yaml
DR_LOCAL_S3_TOURNAMENT_PARAMS_FILE=tournament-params.yaml
DR_LOCAL_S3_TOURNAMENT_JSON_FILE=tournament.json
DR_LOCAL_S3_TRAINING_PARAMS_FILE=training_params.yaml
DR_LOCAL_S3_EVAL_PARAMS_FILE=evaluation_params.yaml
DR_LOCAL_S3_MODEL_METADATA_KEY=$DR_LOCAL_S3_CUSTOM_FILES_PREFIX/model_metadata.json
DR_LOCAL_S3_HYPERPARAMETERS_KEY=$DR_LOCAL_S3_CUSTOM_FILES_PREFIX/hyperparameters.json
DR_LOCAL_S3_REWARD_KEY=$DR_LOCAL_S3_CUSTOM_FILES_PREFIX/reward_function.py
DR_LOCAL_S3_METRICS_PREFIX=$DR_LOCAL_S3_MODEL_PREFIX/metrics
DR_UPLOAD_S3_PREFIX=$DR_LOCAL_S3_MODEL_PREFIX
DR_OA_NUMBER_OF_OBSTACLES=6
DR_OA_MIN_DISTANCE_BETWEEN_OBSTACLES=2.0
DR_OA_RANDOMIZE_OBSTACLE_LOCATIONS=False
Expand Down
2 changes: 2 additions & 0 deletions defaults/template-system.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ DR_CLOUD=<CLOUD_REPLACE>
DR_AWS_APP_REGION=<REGION_REPLACE>
DR_UPLOAD_S3_PROFILE=default
DR_UPLOAD_S3_BUCKET=<AWS_DR_BUCKET>
DR_LOCAL_S3_BUCKET=bucket
DR_LOCAL_S3_PROFILE=<LOCAL_PROFILE>
DR_GUI_ENABLE=False
DR_KINESIS_STREAM_NAME=None
Expand All @@ -15,4 +16,5 @@ DR_CLOUD_WATCH_ENABLE=False
DR_DOCKER_STYLE=swarm
DR_HOST_X=False
DR_WEBVIEWER_PORT=8100
# DR_REMOTE_MINIO_URL=http://mynas:9000
# CUDA_VISIBLE_DEVICES=0
4 changes: 2 additions & 2 deletions docker/docker-compose-endpoint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: '3.7'
services:
rl_coach:
environment:
- S3_ENDPOINT_URL=http://minio:9000
- S3_ENDPOINT_URL=${DR_MINIO_URL}
robomaker:
environment:
- S3_ENDPOINT_URL=http://minio:9000
- S3_ENDPOINT_URL=${DR_MINIO_URL}
3 changes: 2 additions & 1 deletion docker/docker-compose-eval.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
image: awsdeepracercommunity/deepracer-robomaker:${DR_ROBOMAKER_IMAGE}
command: ["${ROBOMAKER_COMMAND}"]
ports:
- "${DR_ROBOMAKER_PORT}:8080"
- "${DR_ROBOMAKER_EVAL_PORT}:8080"
environment:
- DISPLAY_N=:0
- CUDA_VISIBLE_DEVICES
Expand All @@ -27,3 +27,4 @@ services:
- ENABLE_KINESIS=${DR_KINESIS_STREAM_ENABLE}
- ENABLE_GUI=${DR_GUI_ENABLE}
- ROLLOUT_IDX=0
- RTF_OVERRIDE=${DR_EVAL_RTF}
3 changes: 2 additions & 1 deletion docker/docker-compose-training.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ services:
image: awsdeepracercommunity/deepracer-robomaker:${DR_ROBOMAKER_IMAGE}
command: ["${ROBOMAKER_COMMAND}"]
ports:
- "${DR_ROBOMAKER_PORT}:8080"
- "${DR_ROBOMAKER_TRAIN_PORT}:8080"
- "${DR_ROBOMAKER_GUI_PORT}:5900"
environment:
- DISPLAY_N=:0
Expand All @@ -39,3 +39,4 @@ services:
- ENABLE_GUI=${DR_GUI_ENABLE}
- CUDA_VISIBLE_DEVICES
- MULTI_CONFIG
- RTF_OVERRIDE=${DR_TRAIN_RTF}
26 changes: 26 additions & 0 deletions docs/head-to-head.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Head-to-Head Race (Beta)

It is possible to run a head-to-head race, similar to the races in the brackets
run by AWS in the Virtual Circuits to determine the winner of the head-to-bot races.

This replaces the "Tournament Mode".

## Introduction

The concept is that you have two models racing each other, one Purple and one Orange Car. One car
is powered by our primary configured model, and the second car is powered by the model in `DR_EVAL_OPP_S3_MODEL_PREFIX`

## Configuration

### run.env

Configure `run.env` with the following parameters:
* `DR_RACE_TYPE` should be `HEAD_TO_MODEL`.
* `DR_EVAL_OPP_S3_MODEL_PREFIX` will be the S3 prefix for the secondary model.
* `DR_EVAL_OPP_CAR_NAME` is the display name of this model.

Metrics, Traces and Videos will be stored in each models' prefix.

## Run

Run the race with `dr-start-evaluation`; one race will be run.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ DRfC supports a wide set of features to ensure that you can focus on creating th
* [GPU Accelerated OpenGL for Robomaker](opengl.md)
* [Having multiple GPUs in one Computer](multi_gpu.md)
* [Installing on Windows](windows.md)
* [Run a Head-to-Head Tournament](tournament.md)
* [Run a Head-to-Head Race](head-to-head.md)

# Support

Expand Down
36 changes: 0 additions & 36 deletions docs/tournament.md

This file was deleted.

Loading

0 comments on commit d789d47

Please sign in to comment.