{ "cells": [ { "cell_type": "code", "execution_count": 6, "metadata": { "ExecuteTime": { "end_time": "2018-01-19T02:39:09.387985Z", "start_time": "2018-01-19T02:39:09.291235Z" }, "collapsed": true }, "outputs": [], "source": [ "import os\n", "os.environ['CUDA_VISIBLE_DEVICES']=\"\"\n", "os.environ[\"PYTHONPATH\"]='.'" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "ExecuteTime": { "end_time": "2018-01-19T02:39:09.542108Z", "start_time": "2018-01-19T02:39:09.390592Z" } }, "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": 8, "metadata": { "ExecuteTime": { "end_time": "2018-01-19T02:39:09.722311Z", "start_time": "2018-01-19T02:39:09.552596Z" }, "scrolled": true }, "outputs": [ { "data": { "text/plain": [ "['ddpg/train.py',\n", " '--logdir',\n", " './outputs/logs_ddpg',\n", " '--num-threads',\n", " '1',\n", " '--reward-scale',\n", " '1',\n", " '--actor-layers',\n", " '64-64-64',\n", " '--actor-layer-norm',\n", " '--actor-parameters-noise',\n", " '--actor-lr',\n", " '0.001',\n", " '--actor-lr-end',\n", " '0.000001',\n", " '--dynamics-lr',\n", " '0.0001',\n", " '--dynamics-lr-end',\n", " '0.0000001',\n", " '--critic-layers',\n", " '64-32',\n", " '--critic-layer-norm',\n", " '--critic-lr',\n", " '0.002',\n", " '--critic-lr-end',\n", " '0.000001',\n", " '--initial-epsilon',\n", " '0.5',\n", " '--final-epsilon',\n", " '0.001',\n", " '--tau',\n", " '0.0001']" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "os.sys.argv=\"ddpg/train.py --logdir ./outputs/logs_ddpg \\\n", "--num-threads 1 \\\n", "--reward-scale 1 \\\n", "--actor-layers 64-64-64 --actor-layer-norm --actor-parameters-noise --actor-lr 0.001 --actor-lr-end 0.000001 \\\n", "--dynamics-lr 0.0001 --dynamics-lr-end 0.0000001 \\\n", "--critic-layers 64-32 --critic-layer-norm --critic-lr 0.002 --critic-lr-end 0.000001 \\\n", "--initial-epsilon 0.5 --final-epsilon 0.001 --tau 0.0001\".split(\" \")\n", "os.sys.argv" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "ExecuteTime": { "end_time": "2018-01-19T02:39:09.829347Z", "start_time": "2018-01-19T02:39:09.724292Z" }, "collapsed": true }, "outputs": [], "source": [ "from ddpg.train import *" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "ExecuteTime": { "end_time": "2018-01-19T02:39:18.905244Z", "start_time": "2018-01-19T02:39:09.834586Z" }, "scrolled": true }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "[2018-01-19 10:39:09,999] 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", " (linear_2): NoisyLinear (64 -> 64)\n", " (layer_norm_2): LayerNorm (\n", " )\n", " (act_2): 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", " (linear_2): NoisyLinear (64 -> 64)\n", " (layer_norm_2): LayerNorm (\n", " )\n", " (act_2): ReLU ()\n", " )\n", " )\n", " )\n", " (policy_net): LinearNet (\n", " (net): Sequential (\n", " (linear_0): Linear (64 -> 1)\n", " (act_0): ELU (alpha=1.0)\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", " (linear_2): NoisyLinear (64 -> 64)\n", " (layer_norm_2): LayerNorm (\n", " )\n", " (act_2): 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", " (linear_2): NoisyLinear (64 -> 64)\n", " (layer_norm_2): LayerNorm (\n", " )\n", " (act_2): ReLU ()\n", " )\n", " )\n", " )\n", " (value_net): LinearNet (\n", " (net): Sequential (\n", " (linear_0): Linear (65 -> 64)\n", " (layer_norm_0): LayerNorm (\n", " )\n", " (act_0): ReLU ()\n", " )\n", " )\n", " (value_net2): Linear (64 -> 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" }, "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": { "ExecuteTime": { "start_time": "2018-01-18T08:39:00.929Z" }, "collapsed": true }, "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 }