mirror of
https://github.com/wassname/Run-Skeleton-Run.git
synced 2026-07-07 22:19:40 +08:00
332 lines
8.0 KiB
Plaintext
332 lines
8.0 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"metadata": {
|
|
"ExecuteTime": {
|
|
"end_time": "2018-01-18T08:48:06.489049Z",
|
|
"start_time": "2018-01-18T08:48:06.486256Z"
|
|
}
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"import os\n",
|
|
"os.environ['CUDA_VISIBLE_DEVICES']=\"\"\n",
|
|
"os.environ[\"PYTHONPATH\"]='.'"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"metadata": {
|
|
"ExecuteTime": {
|
|
"end_time": "2018-01-18T08:48:06.842630Z",
|
|
"start_time": "2018-01-18T08:48:06.490286Z"
|
|
}
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"Populating the interactive namespace from numpy and matplotlib\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"%pylab --no-import-all inline\n",
|
|
"%reload_ext autoreload\n",
|
|
"%autoreload 2"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 3,
|
|
"metadata": {
|
|
"ExecuteTime": {
|
|
"end_time": "2018-01-18T08:48:06.881370Z",
|
|
"start_time": "2018-01-18T08:48:06.844048Z"
|
|
},
|
|
"scrolled": true
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"['ddpg/train.py',\n",
|
|
" '--logdir',\n",
|
|
" './outputs/logs_ddpg',\n",
|
|
" '--num-threads',\n",
|
|
" '1',\n",
|
|
" '--ddpg-wrapper',\n",
|
|
" '--skip-frames',\n",
|
|
" '5',\n",
|
|
" '--fail-reward',\n",
|
|
" '-0.2',\n",
|
|
" '--reward-scale',\n",
|
|
" '1',\n",
|
|
" '--flip-state-action',\n",
|
|
" '--actor-layers',\n",
|
|
" '64-64',\n",
|
|
" '--actor-layer-norm',\n",
|
|
" '--actor-parameters-noise',\n",
|
|
" '--actor-lr',\n",
|
|
" '0.001',\n",
|
|
" '--actor-lr-end',\n",
|
|
" '0.00001',\n",
|
|
" '--critic-layers',\n",
|
|
" '64-32',\n",
|
|
" '--critic-layer-norm',\n",
|
|
" '--critic-lr',\n",
|
|
" '0.002',\n",
|
|
" '--critic-lr-end',\n",
|
|
" '0.00001',\n",
|
|
" '--initial-epsilon',\n",
|
|
" '0.5',\n",
|
|
" '--final-epsilon',\n",
|
|
" '0.001',\n",
|
|
" '--tau',\n",
|
|
" '0.0001']"
|
|
]
|
|
},
|
|
"execution_count": 3,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"os.sys.argv=\"ddpg/train.py --logdir ./outputs/logs_ddpg --num-threads 1 --ddpg-wrapper --skip-frames 5 --fail-reward -0.2 --reward-scale 1 --flip-state-action --actor-layers 64-64 --actor-layer-norm --actor-parameters-noise --actor-lr 0.001 --actor-lr-end 0.00001 --critic-layers 64-32 --critic-layer-norm --critic-lr 0.002 --critic-lr-end 0.00001 --initial-epsilon 0.5 --final-epsilon 0.001 --tau 0.0001\".split(\" \")\n",
|
|
"os.sys.argv"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 5,
|
|
"metadata": {
|
|
"ExecuteTime": {
|
|
"end_time": "2018-01-18T08:49:02.648421Z",
|
|
"start_time": "2018-01-18T08:49:02.573206Z"
|
|
}
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"from ddpg.train import *"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"ExecuteTime": {
|
|
"start_time": "2018-01-18T08:49:03.555Z"
|
|
},
|
|
"scrolled": true
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stderr",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"[2018-01-18 16:49:08,700] Making new env: Pendulum-v0\n",
|
|
"[2018-01-18 16:49:08,777] Making new env: Pendulum-v0\n",
|
|
"[2018-01-18 16:49:08,780] Making new env: Pendulum-v0\n"
|
|
]
|
|
},
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"Base (\n",
|
|
" (feature_net): LinearNet (\n",
|
|
" (net): Sequential (\n",
|
|
" (linear_0): NoisyLinear (3 -> 64)\n",
|
|
" (layer_norm_0): LayerNorm (\n",
|
|
" )\n",
|
|
" (act_0): ReLU ()\n",
|
|
" (linear_1): NoisyLinear (64 -> 64)\n",
|
|
" (layer_norm_1): LayerNorm (\n",
|
|
" )\n",
|
|
" (act_1): ReLU ()\n",
|
|
" )\n",
|
|
" )\n",
|
|
")\n",
|
|
"ActorHead (\n",
|
|
" (base): Base (\n",
|
|
" (feature_net): LinearNet (\n",
|
|
" (net): Sequential (\n",
|
|
" (linear_0): NoisyLinear (3 -> 64)\n",
|
|
" (layer_norm_0): LayerNorm (\n",
|
|
" )\n",
|
|
" (act_0): ReLU ()\n",
|
|
" (linear_1): NoisyLinear (64 -> 64)\n",
|
|
" (layer_norm_1): LayerNorm (\n",
|
|
" )\n",
|
|
" (act_1): ReLU ()\n",
|
|
" )\n",
|
|
" )\n",
|
|
" )\n",
|
|
" (policy_net): LinearNet (\n",
|
|
" (net): Sequential (\n",
|
|
" (linear_0): Linear (64 -> 1)\n",
|
|
" (act_0): Tanh ()\n",
|
|
" )\n",
|
|
" )\n",
|
|
")\n",
|
|
"CriticHead (\n",
|
|
" (base): Base (\n",
|
|
" (feature_net): LinearNet (\n",
|
|
" (net): Sequential (\n",
|
|
" (linear_0): NoisyLinear (3 -> 64)\n",
|
|
" (layer_norm_0): LayerNorm (\n",
|
|
" )\n",
|
|
" (act_0): ReLU ()\n",
|
|
" (linear_1): NoisyLinear (64 -> 64)\n",
|
|
" (layer_norm_1): LayerNorm (\n",
|
|
" )\n",
|
|
" (act_1): ReLU ()\n",
|
|
" )\n",
|
|
" )\n",
|
|
" )\n",
|
|
" (value_net): Linear (64 -> 1)\n",
|
|
")\n",
|
|
"DynamicsHead (\n",
|
|
" (base): Base (\n",
|
|
" (feature_net): LinearNet (\n",
|
|
" (net): Sequential (\n",
|
|
" (linear_0): NoisyLinear (3 -> 64)\n",
|
|
" (layer_norm_0): LayerNorm (\n",
|
|
" )\n",
|
|
" (act_0): ReLU ()\n",
|
|
" (linear_1): NoisyLinear (64 -> 64)\n",
|
|
" (layer_norm_1): LayerNorm (\n",
|
|
" )\n",
|
|
" (act_1): ReLU ()\n",
|
|
" )\n",
|
|
" )\n",
|
|
" )\n",
|
|
" (value_net): Linear (65 -> 3)\n",
|
|
")\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"os.environ['OMP_NUM_THREADS'] = '1'\n",
|
|
"torch.set_num_threads(1)\n",
|
|
"args = parse_args()\n",
|
|
"train(args,\n",
|
|
" create_model,\n",
|
|
" create_act_update_fns,\n",
|
|
" train_multi_thread,\n",
|
|
" train_single_thread,\n",
|
|
" play_single_thread)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"ExecuteTime": {
|
|
"start_time": "2018-01-18T08:39:00.927Z"
|
|
}
|
|
},
|
|
"outputs": [],
|
|
"source": []
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"ExecuteTime": {
|
|
"start_time": "2018-01-18T08:39:00.929Z"
|
|
}
|
|
},
|
|
"outputs": [],
|
|
"source": []
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"outputs": [],
|
|
"source": []
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "jupyter3",
|
|
"language": "python",
|
|
"name": "jupyter3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.6.0"
|
|
},
|
|
"toc": {
|
|
"colors": {
|
|
"hover_highlight": "#DAA520",
|
|
"navigate_num": "#000000",
|
|
"navigate_text": "#333333",
|
|
"running_highlight": "#FF0000",
|
|
"selected_highlight": "#FFD700",
|
|
"sidebar_border": "#EEEEEE",
|
|
"wrapper_background": "#FFFFFF"
|
|
},
|
|
"moveMenuLeft": true,
|
|
"nav_menu": {
|
|
"height": "12px",
|
|
"width": "252px"
|
|
},
|
|
"navigate_menu": true,
|
|
"number_sections": true,
|
|
"sideBar": true,
|
|
"threshold": 4,
|
|
"toc_cell": false,
|
|
"toc_section_display": "block",
|
|
"toc_window_display": false,
|
|
"widenNotebook": false
|
|
},
|
|
"varInspector": {
|
|
"cols": {
|
|
"lenName": 16,
|
|
"lenType": 16,
|
|
"lenVar": 40
|
|
},
|
|
"kernels_config": {
|
|
"python": {
|
|
"delete_cmd_postfix": "",
|
|
"delete_cmd_prefix": "del ",
|
|
"library": "var_list.py",
|
|
"varRefreshCmd": "print(var_dic_list())"
|
|
},
|
|
"r": {
|
|
"delete_cmd_postfix": ") ",
|
|
"delete_cmd_prefix": "rm(",
|
|
"library": "var_list.r",
|
|
"varRefreshCmd": "cat(var_dic_list()) "
|
|
}
|
|
},
|
|
"types_to_exclude": [
|
|
"module",
|
|
"function",
|
|
"builtin_function_or_method",
|
|
"instance",
|
|
"_Feature"
|
|
],
|
|
"window_display": false
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
}
|