From 7cc0f5984ad04a7226d2959ac86716212f93c851 Mon Sep 17 00:00:00 2001 From: sp Date: Sat, 30 Dec 2023 13:14:07 +0100 Subject: [PATCH] debugging --- examples/shields/rl/callbacks.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/shields/rl/callbacks.py b/examples/shields/rl/callbacks.py index 4d304e9..5aefd23 100644 --- a/examples/shields/rl/callbacks.py +++ b/examples/shields/rl/callbacks.py @@ -28,15 +28,17 @@ class ShieldInfoCallback(DefaultCallbacks): class MyCallbacks(DefaultCallbacks): def on_algorithm_init(self, algorithm: Algorithm, **kwargs): - file_writer = tf.summary.create_file_writer(algorithm.logdir) + file_writer = tf.summary.FileWriter(algorithm.logdir) with file_writer.as_default(): tf.summary.text("first_text", "testing", step=0) file_writer.flush() def on_episode_start(self, *, worker: RolloutWorker, base_env: BaseEnv, policies: Dict[PolicyID, Policy], episode, env_index, **kwargs) -> None: - file_writer = tf.summary.create_file_writer(worker.io_context.log_dir) + file_writer = tf.summary.FileWriter(worker.io_context.log_dir) with file_writer.as_default(): tf.summary.text("first_text_from_episode_start", "testing_in_episode", step=0) + with open(f"{worker.io_context.log_dir}/testing.txt", "a") as file: + file.write("first_text_from_episode_start\n") file_writer.flush() # print(F"Epsiode started Environment: {base_env.get_sub_environments()}") env = base_env.get_sub_environments()[0]