Skip to content

Instantly share code, notes, and snippets.

View rl9.txt
_____________________________________________________________________________
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] 
View rl8.py
policy = agent.get_policy()
model = policy.model
print(model.base_model.summary())
View rl7.sh
tensorboard - logdir=$HOME/ray_results/
View rl6.py
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"],
View rl5.py
SELECT_ENV = "Taxi-v3"
config = ppo.DEFAULT_CONFIG.copy()
config["log_level"] = "WARN"
agent = ppo.PPOTrainer(config, env=SELECT_ENV)
View rl4.py
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)
View rl3.py
print("Dashboard URL: http://{}".format(ray.get_webui_url()))
View rl2.py
import ray
import ray.rllib.agents.ppo as ppo
ray.shutdown()
ray.init(ignore_reinit_error=True)
View rl1.py
pip install ray[rllib]
pip install gym
pip install tensorflow
View geo36.py
images = []
for file_name in image_files:
images.append(imageio.imread(file_name))
gif_path = "movie.gif"
imageio.mimsave(gif_path, images, fps=2)