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/taxi/checkpoint_30/checkpoint-30 \ | |
| - config "{\"env\": \"Taxi-v3\"}" \ | |
| - 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, 500)] 0 | |
| _____________________________________________________________________________ | |
| fc_1 (Dense) (None, 256) 128256 observations[0][0] | |
| _____________________________________________________________________________ | |
| fc_value_1 (Dense) (None, 256) 128256 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
| policy = agent.get_policy() | |
| model = policy.model | |
| print(model.base_model.summary()) |
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
| tensorboard - logdir=$HOME/ray_results/ |
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 = 30 | |
| 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 = "Taxi-v3" | |
| 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
| import shutil | |
| CHECKPOINT_ROOT = "tmp/ppo/taxi" | |
| 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
| print("Dashboard URL: http://{}".format(ray.get_webui_url())) |
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
| import ray | |
| import ray.rllib.agents.ppo as ppo | |
| ray.shutdown() | |
| ray.init(ignore_reinit_error=True) |
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
| pip install ray[rllib] | |
| pip install gym | |
| pip install tensorflow |