This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rllib rollout \ | |
| tmp/ppo/cart/checkpoint_40/checkpoint-40 \ | |
| - config "{\"env\": \"CartPole-v1\"}" \ | |
| - run PPO \ | |
| - steps 2000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| __________________________________________________________________________________________________ | |
| Layer (type) Output Shape Param # Connected to | |
| ================================================================================================== | |
| observations (InputLayer) [(None, 4)] 0 | |
| __________________________________________________________________________________________________ | |
| fc_1 (Dense) (None, 256) 1280 observations[0][0] | |
| __________________________________________________________________________________________________ | |
| fc_value_1 (Dense) (None, 256) 1280 observations[0][0] | |
| __________________________________________________________________________________________________ | |
| fc_2 (Dense) (None, 256) 65792 fc_1[0][0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| N_ITER = 40 | |
| s = "{:3d} reward {:6.2f}/{:6.2f}/{:6.2f} len {:6.2f} saved {}" | |
| for n in range(N_ITER): | |
| result = agent.train() | |
| file_name = agent.save(CHECKPOINT_ROOT) | |
| print(s.format( | |
| n + 1, | |
| result["episode_reward_min"], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT_ENV = "CartPole-v1" | |
| config = ppo.DEFAULT_CONFIG.copy() | |
| config["log_level"] = "WARN" | |
| agent = ppo.PPOTrainer(config, env=SELECT_ENV) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CHECKPOINT_ROOT = "tmp/ppo/cart" | |
| shutil.rmtree(CHECKPOINT_ROOT, ignore_errors=True, onerror=None) | |
| ray_results = os.getenv("HOME") + "/ray_results/" | |
| shutil.rmtree(ray_results, ignore_errors=True, onerror=None) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rllib rollout \ | |
| tmp/ppo/froz/checkpoint_10/checkpoint-10 \ | |
| - config "{\"env\": \"FrozenLake-v0\"}" \ | |
| - run PPO \ | |
| - steps 2000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| _____________________________________________________________________________ | |
| Layer (type) Output Shape Param # Connected to | |
| ============================================================================= | |
| observations (InputLayer) [(None, 16)] 0 | |
| _____________________________________________________________________________ | |
| fc_1 (Dense) (None, 256) 4352 observations[0][0] | |
| _____________________________________________________________________________ | |
| fc_value_1 (Dense) (None, 256) 4352 observations[0][0] | |
| _____________________________________________________________________________ | |
| fc_2 (Dense) (None, 256) 65792 fc_1[0][0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| N_ITER = 10 | |
| s = "{:3d} reward {:6.2f}/{:6.2f}/{:6.2f} len {:6.2f} saved {}" | |
| for n in range(N_ITER): | |
| result = agent.train() | |
| file_name = agent.save(CHECKPOINT_ROOT) | |
| print(s.format( | |
| n + 1, | |
| result["episode_reward_min"], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT_ENV = "FrozenLake-v0" | |
| config = ppo.DEFAULT_CONFIG.copy() | |
| config["log_level"] = "WARN" | |
| agent = ppo.PPOTrainer(config, env=SELECT_ENV) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CHECKPOINT_ROOT = "tmp/ppo/froz" | |
| shutil.rmtree(CHECKPOINT_ROOT, ignore_errors=True, onerror=None) | |
| ray_results = os.getenv("HOME") + "/ray_results/" | |
| shutil.rmtree(ray_results, ignore_errors=True, onerror=None) |