提交 c5a8c2ba 编写于 作者: H Hongsheng Zeng 提交者: Bo Zhou

fix paddle version bug; refine scripts (#186)

上级 7173368e
......@@ -6,7 +6,7 @@ The **PARL** team gets the first place in NeurIPS reinforcement learning competi
## Dependencies
- python3.6
- [paddlepaddle==1.5.2](https://github.com/PaddlePaddle/Paddle)
- [paddlepaddle==1.5.1](https://github.com/PaddlePaddle/Paddle)
- [parl>=1.2.1](https://github.com/PaddlePaddle/PARL)
- [osim-rl==3.0.11](https://github.com/stanfordnmbl/osim-rl)
......
......@@ -22,9 +22,10 @@ import numpy as np
from actor import Actor
from opensim_model import OpenSimModel
from opensim_agent import OpenSimAgent
from parl.utils import logger, ReplayMemory, tensorboard
from parl.utils import logger, ReplayMemory, tensorboard, get_gpu_count
from parl.utils.window_stat import WindowStat
from parl.remote.client import get_global_client
from parl.utils import machine_info
from shutil import copy2
ACT_DIM = 22
......@@ -62,6 +63,15 @@ class ActorState(object):
class Evaluator(object):
def __init__(self, args):
if machine_info.is_gpu_available():
assert get_gpu_count() == 1, 'Only support training in single GPU,\
Please set environment variable: `export CUDA_VISIBLE_DEVICES=[GPU_ID_TO_USE]` .'
else:
cpu_num = os.environ.get('CPU_NUM')
assert cpu_num is not None and cpu_num == '1', 'Only support training in single CPU,\
Please set environment variable: `export CPU_NUM=1`.'
model = OpenSimModel(OBS_DIM, VEL_DIM, ACT_DIM)
algorithm = parl.algorithms.DDPG(
model,
......
......@@ -20,7 +20,7 @@ def get_args():
parser.add_argument(
'--cluster_address',
default='localhost:8081',
default='localhost:8010',
type=str,
help='cluster address of xparl.')
parser.add_argument(
......
# use which GPU
export CUDA_VISIBLE_DEVICES=0
python evaluate.py --actor_num 160 \
--difficulty 1 \
--penalty_coeff 3.0 \
......
# use which GPU
export CUDA_VISIBLE_DEVICES=0
python evaluate.py --actor_num 160 \
--difficulty 2 \
--penalty_coeff 5.0 \
......
# use which GPU
export CUDA_VISIBLE_DEVICES=0
python evaluate.py --actor_num 160 \
--difficulty 3 \
--vel_penalty_coeff 3.0 \
......
# use which GPU
export CUDA_VISIBLE_DEVICES=0
python evaluate.py --actor_num 160 \
--difficulty 3 \
--vel_penalty_coeff 3.0 \
......
......@@ -4,6 +4,9 @@ if [ $# != 1 ]; then
exit 0
fi
# use which GPU
export CUDA_VISIBLE_DEVICES=0
python train.py --actor_num 300 \
--difficulty 1 \
--penalty_coeff 3.0 \
......
......@@ -3,6 +3,9 @@ if [ $# != 1 ]; then
exit 0
fi
# use which GPU
export CUDA_VISIBLE_DEVICES=0
python train.py --actor_num 300 \
--difficulty 2 \
--penalty_coeff 5.0 \
......
......@@ -3,6 +3,9 @@ if [ $# != 1 ]; then
exit 0
fi
# use which GPU
export CUDA_VISIBLE_DEVICES=0
python train.py --actor_num 300 \
--difficulty 3 \
--vel_penalty_coeff 3.0 \
......
......@@ -3,6 +3,9 @@ if [ $# != 1 ]; then
exit 0
fi
# use which GPU
export CUDA_VISIBLE_DEVICES=0
python train.py --actor_num 300 \
--difficulty 3 \
--vel_penalty_coeff 3.0 \
......
......@@ -22,9 +22,10 @@ import numpy as np
from actor import Actor
from opensim_model import OpenSimModel
from opensim_agent import OpenSimAgent
from parl.utils import logger, ReplayMemory, tensorboard
from parl.utils import logger, ReplayMemory, tensorboard, get_gpu_count
from parl.utils.window_stat import WindowStat
from parl.remote.client import get_global_client
from parl.utils import machine_info
ACT_DIM = 22
VEL_DIM = 19
......@@ -68,6 +69,15 @@ class ActorState(object):
class Learner(object):
def __init__(self, args):
if machine_info.is_gpu_available():
assert get_gpu_count() == 1, 'Only support training in single GPU,\
Please set environment variable: `export CUDA_VISIBLE_DEVICES=[GPU_ID_TO_USE]` .'
else:
cpu_num = os.environ.get('CPU_NUM')
assert cpu_num is not None and cpu_num == '1', 'Only support training in single CPU,\
Please set environment variable: `export CPU_NUM=1`.'
model = OpenSimModel(OBS_DIM, VEL_DIM, ACT_DIM)
algorithm = parl.algorithms.DDPG(
model,
......
......@@ -20,7 +20,7 @@ def get_args():
parser.add_argument(
'--cluster_address',
default='localhost:8081',
default='localhost:8010',
type=str,
help='cluster address of xparl.')
parser.add_argument(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册