|
|
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Example usage of Tempestpy" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "vscode": { "languageId": "plaintext" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "pygame 2.6.1 (SDL 2.28.4, Python 3.10.12)\n", "Hello from the pygame community. https://www.pygame.org/contribute.html\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "2024-11-29 12:24:16.266841: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:485] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\n", "2024-11-29 12:24:16.283112: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:8454] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\n", "2024-11-29 12:24:16.287862: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1452] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\n", "2024-11-29 12:24:16.298829: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.\n", "To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.\n", "2024-11-29 12:24:18.626838: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT\n", "error: XDG_RUNTIME_DIR not set in the environment.\n" ] } ], "source": [ "from sb3_contrib import MaskablePPO\n", "from sb3_contrib.common.wrappers import ActionMasker\n", "from stable_baselines3.common.logger import Logger, CSVOutputFormat, TensorBoardOutputFormat, HumanOutputFormat\n", "\n", "import gymnasium as gym\n", "\n", "from minigrid.core.actions import Actions\n", "from minigrid.core.constants import TILE_PIXELS\n", "from minigrid.wrappers import RGBImgObsWrapper, ImgObsWrapper\n", "\n", "import tempfile, datetime, shutil\n", "\n", "import time\n", "import os\n", "\n", "from utils import MiniGridShieldHandler, create_log_dir, ShieldingConfig, MiniWrapper, expname, shield_needed, shielded_evaluation, create_shield_overlay_image\n", "from sb3utils import MiniGridSbShieldingWrapper, parse_sb3_arguments, ImageRecorderCallback, InfoCallback\n", "\n", "import os, sys\n", "from copy import deepcopy\n", "\n", "from PIL import Image" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "vscode": { "languageId": "plaintext" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Starting the training\n" ] }, { "data": { "image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCALAA2ADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDDooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKAPfNe8beHPC9zFba1qsNnNKnmIjqx3LnGeAe4rJ/wCFueAv+hktv++H/wDiaw/ifHrz6xZHSYtceL7P8506xhnXduPUvyD7CuEePxjHG0jw+LlRQSxOkWvAH40Aer/8Lc8Bf9DJbf8AfD//ABNdrXy/rd7d3XgnWfO1Oa/tLrRbW/h+0W0UTxMb5YyPkHoh796+oKAMDXvG3hzwvcxW2tarDZzSp5iI6sdy5xngHuKyf+FueAv+hktv++H/APiaw/ifHrz6xZHSYtceL7P8506xhnXduPUvyD7CuEePxjHG0jw+LlRQSxOkWvAH40Aer/8AC3PAX/QyW3/fD/8AxNdrXy/rd7d3XgnWfO1Oa/tLrRbW/h+0W0UTxMb5YyPkHoh796+oKAMDXvG3hzwvcxW2tarDZzSp5iI6sdy5xngHuKyf+FueAv8AoZLb/vh//iaw/ifHrz6xZHSYtceL7P8AOdOsYZ13bj1L8g+wrhHj8YxxtI8Pi5UUEsTpFrwB+NAHq/8AwtzwF/0Mlt/3w/8A8TXa18v63e3d14J1nztTmv7S60W1v4ftFtFE8TG+WMj5B6Ie/evqCgDA17xt4c8L3MVtrWqw2c0qeYiOrHcucZ4B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o4hpKpaMj1V0/9OhIpb54+fLlxosJmIAJmIAJmIAJmIAJ3BD4fzcJ/28CJmACJmACJmACJmACHQELRLcDEzABEzABEzABEzCBOwQsEO/g8IoJmIAJmIAJmIAJmIAFotuACZiACZiACZiACZjAHQIWiHdweMUETMAETMAETMAETMAC0W3ABEzABEzABEzABEzgDgELxDs4vGICJmACJmACJmACJmCB6DZgAiZgAiZgAiZgAiZwh4AF4h0cXjEBEzABEzABEzABE7BAdBswARMwARMwARMwARO4Q8AC8Q4Or5iACZiACZiACZiACVggug2YgAmYgAmYgAmYgAncIWCBeAeHV0zABEzABEzABEzABCwQ3QZMwARMwARMwARMwATuELBAvIPDKyZgAiZgAiZgAiZgAhaIbgMmYAImYAImYAImYAJ3CFgg3sHhFRMwARMwARMwARMwAQtEtwETMAETMAETMAETMIE7BCwQ7+DwigmYgAmYgAmYgAmYgAWi24AJmIAJmIAJmIAJmMAdAhaId3B4xQRMwARMwARMwARMwALRbcAETMAETMAETMAETOAOAQvEOzi8YgImYAImYAImYAImYIHoNmACJmACJmACJmACJnCHgAXiHRxeMQETMAETMAETMAETsEB0GzABEzABEzABEzABE7hDwALxDg6vmIAJmIAJmIAJmIAJWCC6DZiACZiACZiACZiACdwhYIF4B4dXTMAETMAETMAETMAELBDdBkzABEzABEzABEzABO4QsEC8g8MrJmACJmACJmACJmACf2qN4MOHD60PYf8mYAImcG4Efvnll6dPnz5+/LhS8G/fvn358uX58+ejNv+6GN3kDTMQ+MePsYMcpn7HvDt/FQRevXrVtByOIDbFa+cmYAImcGAC7969Qxe+ePHiyZMnb968QQX2D0AmmzDADGN26ds45zQJuH5Ps17O8KwsEM+w0l1kEzCBRRKQdLi6uvr+/TvhQ8rw/v37QiaGNGQTBphhzC6Wiadf5a7f06+jszpDC8Szqm4X1gRMYJEECunw22+/ff78+evXr69fv6Y8IRMVNZQ0ZBMGmGFsmXjite76PfEKOs/Tu3j58mXTkvsdxKZ47dwETGD1BHhMzBtpFBOdh5K4vLzMRSZk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+ANsgntk6suIlm4dYJE9iPgAXifty8lwmYgAnMRyBrAj5Sw4dR+Hl65qkQRMwyMZuxCQPMMGaXbFacN9+sfv9l8+T9qEyMaShjM51xKOmDE1zhMC/2X+fD1lxxB6/fXBdOm8B0AhaI01nZ0gRMwASOQIAP2ShqKOmgqaych2KHWSbKTNJQmgMzfQcny0RycjHe/rx5/bTL6MvEkIZMcOaVRP4VM53ZK0tDVnGFw7zYP1FVSedBPq3rN9eF0yYwncDFy5cvp1vvYfnhw4c99vIuJmACJmACIoCAYB4Ds0+ysCMHIRgTVpCD2pp/bQUpSeAwT1hmK1Oeybl+YfFfFwEZnadQn3L42PXn79cfNcwzcLvnxZ+6DyKy8EvNl4+6j2xrQRq+vtw8/ul6tfjP/gf4/OMHlBrWb1EHXl0XgVevXjUtkAViU7x2bgImYAIHJiCRp99cRjWyhEyMIyEN9e0bcog7YpPFZZhtkkBUZiHjsjS83evmh1UkE8kfkD7ZOqXtP8HYbLYC8U4On43civjD1G/h2qvrImCBuK76dGlMwARMYF8CWTro7UN52qrEa5mYpSFbw2xYJvYEohxKxj3/a/mBm+LEiSb+8t9a1LCwj1X7v0ZxVyAevn6DuBN "text/plain": [ "<PIL.Image.Image image mode=RGB size=864x704>" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\n", "\n", "Computing new shield\n", "LOG: Starting with explicit model creation...\n", "Elapsed time is 1.5311391353607178 seconds.\n", "LOG: Starting with model checking...\n", "Elapsed time is 0.0014214515686035156 seconds.\n", "Write to file shielding_files_20241129T122454_58hszne6/shield.\n", "LOG: Starting to translate shield...\n", "Elapsed time is 0.056265830993652344 seconds.\n", "\n", "\n", "Computing new shield\n", "LOG: Starting with explicit model creation...\n", "Elapsed time is 1.3646655082702637 seconds.\n", "LOG: Starting with model checking...\n", "Elapsed time is 0.0015163421630859375 seconds.\n", "LOG: Starting to translate shield...\n", "Write to file shielding_files_20241129T122456_wtrsvp2x/shield.\n", "Elapsed time is 0.05994606018066406 seconds.\n", "\n", "\n", "Computing new shield\n", "LOG: Starting with explicit model creation...\n", "Elapsed time is 1.5757696628570557 seconds.\n", "LOG: Starting with model checking...\n", "Elapsed time is 0.0013585090637207031 seconds.\n", " WARN (PreShield.cpp:50): No shielding action possible with absolute comparison for state with index 683\n", " WARN (PreShield.cpp:50): No shielding action possible with absolute comparison for state with index 1139\n", "Write to file shielding_files_20241129T122458_wavsk47p/shield.\n", " WARN (PreShield.cpp:50): No shielding action possible with absolute comparison for state with index 683\n", " WARN (PreShield.cpp:50): No shielding action possible with absolute comparison for state with index 1139\n", "LOG: Starting to translate shield...\n", "Elapsed time is 0.05765676498413086 seconds.\n", "\n", "\n", "Computing new shield\n", "LOG: Starting with explicit model creation...\n", "Elapsed time is 1.7896459102630615 seconds.\n", "LOG: Starting with model checking...\n", "Elapsed time is 0.0013873577117919922 seconds.\n", " WARN (PreShield.cpp:50): No shielding action possible with absolute comparison for state with index 610\n", " WARN (PreShield.cpp:50): No shielding action possible with absolute comparison for state with index 611\n", " WARN (PreShield.cpp:50): No shielding action possible with absolute comparison for state with index 635\n", "LOG: Starting to translate shield...\n", " WARN (PreShield.cpp:50): No shielding action possible with absolute comparison for state with index 659\n", " WARN (PreShield.cpp:50): No shielding action possible with absolute comparison for state with index 683\n", " WARN (PreShield.cpp:50): No shielding action possible with absolute comparison for state with index 1139\n", "Write to file shielding_files_20241129T122500_n10bceo8/shield.\n", " WARN (PreShield.cpp:50): No shielding action possible with absolute comparison for state with index 610\n", " WARN (PreShield.cpp:50): No shielding action possible with absolute comparison for state with index 611\n", " WARN (PreShield.cpp:50): No shielding action possible with absolute comparison for state with index 635\n", " WARN (PreShield.cpp:50): No shielding action possible with absolute comparison for state with index 659\n", " WARN (PreShield.cpp:50): No shielding action possible with absolute comparison for state with index 683\n", " WARN (PreShield.cpp:50): No shielding action possible with absolute comparison for state with index 1139\n", "Elapsed time is 0.057317256927490234 seconds.\n" ] }, { "data": { "image/png": "iVBORw0KGgoAA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9gvCdP4PsqI0Jv/r4bU/OCN5BVLmf77b5ucDPzPJ1534aXm+OBJVT182njE7qU0kKwLKf5gFkaqIvFqstf/K/WnRSDl8YJ4/WU6J84L+VGK+/EsnnO+ewL1M43w8jcWiVgbltvAn/rBTwLxwivGFqEuPXzxxern7723sv5pGhl1lj6Neknd1gqe0pFv3f+5/8vrxDrHx+3/1tG1qbRf3lRBmyhHjXTdsuR21lPHdfMrvfU3RlJ4dN0a/8bt7/rXeJ271ps8nduf21/0/uT1o+34tNgfri8nXgxKIVoMYiFjTFXMiZiIFwPfX6QyGEhr2iED6Hv37i0QsTYcCS8RobdnvPbPE/H5ZWriIl4qh2N+kYjdhwEmWUW8mlSH/8v058RLuSBiNUlMJOzf/X8aInhS9ZeImK4lJ166/k3inxOvvC59J9W/V7IHAbH+cU55nS0tHKNzj1vbf9v/Ie1/rIu72h8VAaNj6cNi21za64Jo/cbf9W99L4LbX3lKje3PeghM2f6WiJc8B6BIG4tpRMSIk8fhbiJe8nYRzned4oC6LxHDu/T6K4cep/ydMHQhkQjwfhheMAhFH4lE7Ij+lgJ/cC9FXGiI4EnXH4kYnsTaq5hI7jI5Dv6xnqAD4tVWl/Cwvj57EEBa1b/o7SI8r7OriNiU2z94+fqHHX9yD3YtoyJg67qgmVOsKRqbAM7613OBG3/XP7c/fA6bEduf6dofBl+0pXwQG2sWHgJIWCRixJPn7588WZhCpnwMpPm4bhxg805 "text/plain": [ "<PIL.Image.Image image mode=RGBA size=864x704>" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "The shield for shield_value = 0.9\n" ] }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAA2AAAALACAYAAAD1+RH+AAEAAElEQVR4Aez9z68d15XnCwYl4woGrsoGCRtkWhJzwho09YCiB6IkT1Qwql5PskZp+Q9oCnhAT5TixPU8VqkntGvSQAKsHvUoJU8S8OC9zDY8asn0gDSQ5Bskgc6kLNVlpZOE/EjAMCHr9v5EnO+56+y745w4cX7EuTe+CzgnIvavFfGNvdfe31g7dpy5du3aYWUxAkbACBgBI2AEjIARMAJGwAgYgY0j8NzGNViBETACRsAIGAEjYASMgBEwAkbACNQImIC5IhgBI2AEjIARMAJGwAgYASNgBLaEgAnYloC2GiNgBIyAETACRsAIGAEjYASMgAmY64ARMAJGwAgYASNgBIyAETACRmBLCJiAbQloqzECRsAIGAEjYASMgBEwAkbACJiAuQ4YASNgBIyAETACRsAIGAEjYAS2hIAJ2JaAthojYASMgBEwAkbACBgBI2AEjIAJmOuAETACRsAIGAEjYASMgBEwAkZgSwiYgG0JaKsxAkbACBgBI2AEjIARMAJGwAiYgLkOGAEjYASMgBEwAkbACBgBI2AEtoSACdiWgLYaI2AEjIARMAJGwAgYASNgBIyACZjrgBEwAkbACBgBI2AEjIARMAJGYEsImIBtCWirMQJGwAgYASNgBIyAETACRsAImIC5DhgBI2AEjIARMAJGwAgYASNgBLaEgAnYloC2GiNgBIyAETACRsAIGAEjYASMgAmY64ARMAJGwAgYASNgBIyAETACRmBLCJiAbQloqzECRsAIGAEjYASMgBEwAkbACJiAuQ4YASNgBIyAETACRsAIGAEjYAS2hIAJ2JaAthojYASMgBEwAkbACBgBI2AEjIAJmOuAETACRsAIGAEjYASMgBEwAkZgSwiYgG0JaKsxAkbACBgBI2AEjIARMAJGwAiYgLkOGAEjYASMgBEwAkbACBgBI2AEtoSACdiWgLYaI2AEjIARMAJGwAgYASNgBIyACZjrgBEwAkbACBgBI2AEjIARMAJGYEsImIBtCWirMQJGwAgYASNgBIyAETACRsAImIC5DhgBI2AEjIARMAJGwAgYASNgBLaEgAnYloC2GiNgBIyAETACRsAIGAEjYASMgAmY64ARMAJGwAgYASNgBIyAETACRmBLCJiAbQloqzECRsAIGAEjYASMgBEwAkbACJiAuQ4YASNgBIyAETACRsAIGAEjYAS2hIAJ2JaAthojYASMgBEwAkbACBgBI2AEjMDXhobg5s2bQ5+C9RsBI2AEjIAR2EkEPvroo+r111+vXn755U7n99vf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yxyv2v8to2tdab+2roLWUY4a6bJlye2sp47L5ld662+MpPDoujX+jdvf9a/xOnetN3k6tz+3v+j9yetH2/FpsT9cX068GJRCtBjEQsaYqpgTMREvBr6/SmUwkNa0QwbQ9+7dmyFibTgSXiJCb0947V8m4vPr1MRFvFQOx/wiEbsPA0yyiHg1qY7+5+nPiZdyQcRqkphI2L///zRE8KTqLxExXUtOvHT968Q/J155Xfpeqn8vZw8CYv3jnPI6W1o4Rucet7b/tv9D2v9YF7e1v1MEjI6lD4ttc2kvC6L1G3/Xv+W9CG5/5Sk1tj/LITBm+1siXvIcgCJtLKYRESNOHoe7iXjJ20U433WKA+q+RAzv0usvH3mc8nfC0IVEIsD7YXjBIBR9JBKxY/pbCnzvXoq40BDBk64/EjE8ibVXMZHcebIK/rGeoAPi1VaX8LC+PnkQQFrVv+jtIjyvs4uI2JjbP3j5+ocdf3IPti07RcCWdUEzp1hTNNYBnPUv5wI3/q5/bn/4HNYjtj/jtT8MvmhL+SA21iw8BJCwSMSIJ8/fP3kyM4VM+RhI83HdOMDmnZ5 "text/plain": [ "<PIL.Image.Image image mode=RGBA size=864x704>" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "The shield for shield_value = 0.95\n" ] }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAA2AAAALACAYAAAD1+RH+AAEAAElEQVR4Aez9T8wcx5XmjRYlg4QBsm2QsCDakugNe9H0AE0tREmzccMYz91Mr0b0bhZzSWCAuxhZ3LTHa0/3hlbP4gINcO7qriT1pgEO8H2aa4w3VxS9IA2M+C2aizb1Z8hpi4ZsETAsyOQXv8x66j0Vb2RVVtafzPfN5wBVmRkZESfzyYiT8eSJP0cuXbr0ZGIxAkbACBgBI2AEjIARMAJGwAgYga0j8NTWNViBETACRsAIGAEjYASMgBEwAkbACFQImIC5IBgBI2AEjIARMAJGwAgYASNgBHaEgAnYjoC2GiNgBIyAETACRsAIGAEjYASMgAmYy4ARMAJGwAg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U177bxPx+UWq4iJeyodjfpGI3YUBJllGvOpYe/+L9OfES6kgYhVJTCTsL/5/NRE8qPpLREz3khMv3f8m8c+JV16W/mUqf89nHwJi+eOa8jJbmjhG1x63tv+2/33a/1gWd7U/KALGi6ULi21yaa8KovUbf5e/1b0Irn/lLjW2P6shMGb7WyJe8hyAInUsxhER45w8Dh8k4iVvF+Gs6xQb1F2JGN6ll5/f8zjlY8LQhUQiwPgwvGAQii4Sidg+/Q0ZvnEnnThdE8GDrj8SMTyJlVcxkdxFsg7+sZygA+LVVJbwsL48/RBAXJW/6O0iPC+zy4jYmOs/ePn++21/8gx2LYMiYKu6oOlTrC4amwDO+ldzgRt/lz/XP3wOmxHbn/HaHxpf1KW8ERtLFh4CSFgkYpwnzX///PO5LmRKR0OaxXV "text/plain": [ "<PIL.Image.Image image mode=RGBA size=864x704>" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "The shield for shield_value = 0.99\n" ] }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAA2AAAALACAYAAAD1+RH+AAEAAElEQVR4Aez9Tcwcx5mmjRYlg4QB0jZIWBCtH3rDXjQ9QFML0dJs3DDGczZfr0b0bhZzSGCAsxhZ3LTHa0/3hpJncYAGOGd1VpZ604AGOJ/mGOPNEUUvSAMjfovmok2Jaupri4ZsEfAnQSZPXFl51/tUvJFVWVk/me+b9wNUZWZkRDyZd8bfHU/8HLl06dLjicUIGAEjYASMgBEwAkbACBgBI2AEto7AE1vXYAVGwAgYASNgBIyAETACRsAIGAEjUCFgAuaEYASMgBEwAkbACBgBI2AEjIAR2BECJmA7AtpqjIARMAJGwAgYASNgBIyAETACJmBOA0bACBgBI2AEjIARMAJGwAgYgR0hYAK2I6CtxggYASNgBIyAETACRsAIGAEjYALmNGAEjIARMAJGwAgYASNgBIyAEdgRAiZgOwLaaoyAETACRsAIGAEjYASMgBEwAiZgTgNGwAgYASNgBIyAETACRsAIGIEdIWACtiOgrcYIGAEjYASMgBEwAkbACBgBI2AC5jRgBIyAETACRsAIGAEjYASMgBHYEQImYDsC2mqMgBEwAkbACBgBI2AEjIARMAImYE4DRsAIGAEjYASMgBEwAkbACBiBHSFgArYjoK3GCBgBI2AEjIARMAJGwAgYASNgAuY0YASMgBEwAkbACBgBI2AEjIAR2BECJmA7AtpqjIARMAJGwAgYASNgBIyAETACJmBOA0bACBgBI2AEjIARMAJGwAgYgR0hYAK2I6CtxggYASNgBIyAETACRsAIGAEjYALmNGAEjIARMAJGwAgYASNgBIyAEdgRAiZgOwLaaoyAETACRsAIGAEjYASMgBEwAiZgTgNGwAgYASNgBIyAETACRsAIGIEdIWACtiOgrcYIGAEjYASMgBEwAkbACBgBI2AC5jRgBIyAETACRsAIGAEjYASMgBHYEQImYDsC2mqMgBEwAkbACBgBI2AEjIARMAImYE4DRsAIGAEjYASMgBEwAkbACBiBHSFgArYjoK3GCBgBI2AEjIARMAJGwAgYASNgAuY0YASMgBEwAkbACBgBI2AEjIAR2BECJmA7AtpqjIARMAJGwAgYASNgBIyAETACJmBOA0bACBgBI2AEjIARMAJGwAgYgR0hYAK2I6CtxggYASNgBIyAETACRsAIGAEjYALmNGAEjIARMAJGwAgYASNgBIyAEdgRAiZgOwLaaoyAETACRsAIGAEjYASMgBEwAl/pG4Jr1671/QjWbwSMgBEwAkZgkAi89dZbk+9+97uT5557rtXzffjhh5P33ntv8sorryz3/9yR5X627ePSthUsiP+/pXt961/weFu/9cyFSUosC9VsNf0t1OybRmC7CFy+fHm7CpbEbgvYEoB82wgYASNgBIzArhF4/fXXK9J18eLFyfPPPz957bXXJpCrJuEefvBLGAgbcTRKInWjFshXn9K3fr17QzrYevqTfh+NwEgRMAEb6Yf3axsBI2AEjMDwEFDD98qVK5N79+5V1i+e8o033igSsUi88INgMSMscRSJWGx092kBqp62h7++yU/f+nPIQ3rYSfrL9fvaCIwQAROwEX50v7IRMAJGwAgMC4FSw/fdd9+dXL9+ffLBBx9MfvSjH1UPHImYLF4iXvj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pYElIl6Kh2t+kYjdgQEmWUa8pr72/hfpz4mXQkHEKpKYSNhf/n+nRPCg6i8RMb1LTrz0/pvEPydeeVr61yn9URfGjoCY/nimPM2WFo7Rs8ej6z/Xf33WfzEt7up8UASMiqULi20yaa8KovUb/6b090FKTM+1TVCJsL21osWMqJ3+nP6a0t+ipOfyrzykaRFmpXt95r8S8ZLlgGflG0c/ImLck8Xh/US "text/plain": [ "<PIL.Image.Image image mode=RGBA size=864x704>" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "The shield for shield_value = 1.0\n", "Training with shield:\n" ] }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAA2AAAALACAYAAAD1+RH+AAEAAElEQVR4Aez9T8wcx5XmjRYlg4QBsm2QsCDakugNe9H0AE0tREmzccMYz91Mr0b0bhZzSWCAuxhZ3LTHa0/3hlbP4gINcO7qriT1pgEO8H2aa4w3VxS9IA2M+C2aizb1Z8hpi4ZsETAsyOQXv8x66j0Vb2RVVtafzPfN5wBVmRkZESfzyYiT8eSJP0cuXbr0ZGIxAkbACBgBI2AEjIARMAJGwAgYga0j8NTWNViBETACRsAIGAEjYASMgBEwAkbACFQImIC5IBgBI2AEjIARMAJGwAgYASNgBHaEgAnYjoC2GiNgBIyAETACRsAIGAEjYASMgAmYy4ARMAJGwAgYASNgBIyAETACRmBHCJiA7QhoqzECRsAIGAEjYASMgBEwAkbACJiAuQwYASNgBIyAETACRsAIGAEjYAR2hIAJ2I6AthojYASMgBEwAkbACBgBI2AEjIAJmMuAETACRsAIGAEjYASMgBEwAkZgRwiYgO0IaKsxAkbACBgBI2AEjIARMAJGwAiYgLkMGAEjYASMgBEwAkbACBgBI2AEdoSACdiOgLYaI2AEjIARMAJGwAgYASNgBIyACZjLgBEwAkbACBgBI2AEjIARMAJGYEcImIDtCGirMQJGwAgYASNgBIyAETACRsAImIC5DBgBI2AEjIARMAJGwAgYASNgBHaEgAnYjoC2GiNgBIyAETACRsAIG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TrC4amwDO+ldzgRt/lz/XP3wOmxHbn/HaHxpf1KW8ERtLFh4CSFgkYpwnzX///PO5LmRKR0OaxXV "text/plain": [ "<PIL.Image.Image image mode=RGBA size=864x704>" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Using cpu device\n", "Wrapping the env with a `Monitor` wrapper\n", "Wrapping the env in a DummyVecEnv.\n", "Wrapping the env in a VecTransposeImage.\n", "truncated: {'reached_goal': False, 'ran_into_lava': False, 'opened_door': False, 'picked_up': False}\n", "truncated: {'reached_goal': False, 'ran_into_lava': False, 'opened_door': False, 'picked_up': False}\n", "truncated: {'reached_goal': False, 'ran_into_lava': False, 'opened_door': False, 'picked_up': False}\n", "truncated: {'reached_goal': False, 'ran_into_lava': False, 'opened_door': False, 'picked_up': False}\n", "truncated: {'reached_goal': False, 'ran_into_lava': False, 'opened_door': False, 'picked_up': False}\n", "truncated: {'reached_goal': False, 'ran_into_lava': False, 'opened_door': False, 'picked_up': False}\n", "truncated: {'reached_goal': False, 'ran_into_lava': False, 'opened_door': False, 'picked_up': False}\n", "truncated: {'reached_goal': False, 'ran_into_lava': False, 'opened_door': False, 'picked_up': False}\n", "truncated: {'reached_goal': False, 'ran_into_lava': False, 'opened_door': False, 'picked_up': False}\n", "truncated: {'reached_goal': False, 'ran_into_lava': False, 'opened_door': False, 'picked_up': False}\n", "-----------------------------------\n", "| info/ | |\n", "| no_shield_action | 0 |\n", "| sum_opened_door | 0 |\n", "| sum_picked_up | 0 |\n", "| sum_ran_into_lava | 0 |\n", "| sum_reached_goal | 0 |\n", "| rollout/ | |\n", "| ep_len_mean | 200 |\n", "| ep_rew_mean | -2 |\n", "| time/ | |\n", "| fps | 63 |\n", "| iterations | 1 |\n", "| time_elapsed | 32 |\n", "| total_timesteps | 2048 |\n", "-----------------------------------\n" ] } ], "source": [ "GRID_TO_PRISM_BINARY=os.getenv(\"M2P_BINARY\")\n", "\n", "def mask_fn(env: gym.Env):\n", " return env.create_action_mask()\n", "\n", "def nomask_fn(env: gym.Env):\n", " return [1.0] * 7\n", "\n", "def main():\n", " #env = \"MiniGrid-LavaSlipperyCliff-16x13-Slip10-Time-v0\"\n", " env = \"MiniGrid-WindyCity2-v0\"\n", "\n", " formula = \"Pmax=? [G ! AgentIsOnLava]\"\n", " value_for_training = 0.99\n", " shield_comparison = \"absolute\"\n", " shielding = ShieldingConfig.Training\n", " \n", " logger = Logger(\"/tmp\", output_formats=[HumanOutputFormat(sys.stdout)])\n", " \n", " env = gym.make(env, render_mode=\"rgb_array\")\n", " image_env = RGBImgObsWrapper(env, TILE_PIXELS)\n", " env = RGBImgObsWrapper(env, 8)\n", " env = ImgObsWrapper(env)\n", " env = MiniWrapper(env)\n", "\n", " \n", " env.reset()\n", " Image.fromarray(env.render()).show()\n", " \n", " shield_handlers = dict()\n", " if shield_needed(shielding):\n", " for value in [0.9, 0.95, 0.99, 1.0]:\n", " shield_handler = MiniGridShieldHandler(GRID_TO_PRISM_BINARY, \"grid.txt\", \"grid.prism\", formula, shield_value=value, shield_comparison=shield_comparison, nocleanup=True, prism_file=None)\n", " env = MiniGridSbShieldingWrapper(env, shield_handler=shield_handler, create_shield_at_reset=False)\n", "\n", "\n", " shield_handlers[value] = shield_handler\n", " if shield_needed(shielding):\n", " for value in [0.9, 0.95, 0.99, 1.0]: \n", " create_shield_overlay_image(image_env, shield_handlers[value].create_shield())\n", " print(f\"The shield for shield_value = {value}\")\n", "\n", " if shielding == ShieldingConfig.Training:\n", " env = MiniGridSbShieldingWrapper(env, shield_handler=shield_handlers[value_for_training], create_shield_at_reset=False)\n", " env = ActionMasker(env, mask_fn)\n", " print(\"Training with shield:\")\n", " create_shield_overlay_image(image_env, shield_handlers[value_for_training].create_shield())\n", " elif shielding == ShieldingConfig.Disabled:\n", " env = ActionMasker(env, nomask_fn)\n", " else:\n", " assert(False) \n", " model = MaskablePPO(\"CnnPolicy\", env, verbose=1, device=\"auto\")\n", " model.set_logger(logger)\n", " steps = 200\n", "\n", " model.learn(steps,callback=[InfoCallback()])\n", "\n", "\n", "\n", "if __name__ == '__main__':\n", " print(\"Starting the training\")\n", " main()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "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.10.12" } }, "nbformat": 4, "nbformat_minor": 4 }
|