From 742529ccd746a74f33aff0bc8a1226e040a57cf6 Mon Sep 17 00:00:00 2001 From: Koha9 Date: Wed, 26 Oct 2022 03:15:37 +0900 Subject: [PATCH] Archive all tensorflow agents and env archive all TF py&ipynb turn face to pytorch. --- .../{ => Tensorflow}/DemoRecorder.ipynb | 0 .../{ => Tensorflow}/GAIL-Main.ipynb | 0 Aimbot-PPO-Python/{ => Tensorflow}/GAIL.py | 0 .../{ => Tensorflow}/GAILConfig.py | 0 .../{ => Tensorflow}/GAILHistory.py | 0 Aimbot-PPO-Python/{ => Tensorflow}/GAILMem.py | 0 .../{ => Tensorflow}/HumanAction.py | 0 .../{ => Tensorflow}/PPO-mian.ipynb | 0 Aimbot-PPO-Python/{ => Tensorflow}/PPO.py | 0 .../{ => Tensorflow}/PPOBuffer.py | 0 .../{ => Tensorflow}/PPOConfig.py | 0 .../{ => Tensorflow}/PPOHistoryRecorder.py | 0 .../{ => Tensorflow}/aimBotEnv.py | 0 Aimbot-PPO-Python/{ => Tensorflow}/env.ipynb | 0 .../{ => Tensorflow}/rewardAIClass.py | 0 .../Tensorflow/simple_test_env.ipynb | 61 ++++++++++++++ .../{ => Tensorflow}/testarea.ipynb | 11 +-- Aimbot-PPO-Python/simple_test_env.ipynb | 84 ------------------- 18 files changed, 62 insertions(+), 94 deletions(-) rename Aimbot-PPO-Python/{ => Tensorflow}/DemoRecorder.ipynb (100%) rename Aimbot-PPO-Python/{ => Tensorflow}/GAIL-Main.ipynb (100%) rename Aimbot-PPO-Python/{ => Tensorflow}/GAIL.py (100%) rename Aimbot-PPO-Python/{ => Tensorflow}/GAILConfig.py (100%) rename Aimbot-PPO-Python/{ => Tensorflow}/GAILHistory.py (100%) rename Aimbot-PPO-Python/{ => Tensorflow}/GAILMem.py (100%) rename Aimbot-PPO-Python/{ => Tensorflow}/HumanAction.py (100%) rename Aimbot-PPO-Python/{ => Tensorflow}/PPO-mian.ipynb (100%) rename Aimbot-PPO-Python/{ => Tensorflow}/PPO.py (100%) rename Aimbot-PPO-Python/{ => Tensorflow}/PPOBuffer.py (100%) rename Aimbot-PPO-Python/{ => Tensorflow}/PPOConfig.py (100%) rename Aimbot-PPO-Python/{ => Tensorflow}/PPOHistoryRecorder.py (100%) rename Aimbot-PPO-Python/{ => Tensorflow}/aimBotEnv.py (100%) rename Aimbot-PPO-Python/{ => Tensorflow}/env.ipynb (100%) rename Aimbot-PPO-Python/{ => Tensorflow}/rewardAIClass.py (100%) create mode 100644 Aimbot-PPO-Python/Tensorflow/simple_test_env.ipynb rename Aimbot-PPO-Python/{ => Tensorflow}/testarea.ipynb (98%) delete mode 100644 Aimbot-PPO-Python/simple_test_env.ipynb diff --git a/Aimbot-PPO-Python/DemoRecorder.ipynb b/Aimbot-PPO-Python/Tensorflow/DemoRecorder.ipynb similarity index 100% rename from Aimbot-PPO-Python/DemoRecorder.ipynb rename to Aimbot-PPO-Python/Tensorflow/DemoRecorder.ipynb diff --git a/Aimbot-PPO-Python/GAIL-Main.ipynb b/Aimbot-PPO-Python/Tensorflow/GAIL-Main.ipynb similarity index 100% rename from Aimbot-PPO-Python/GAIL-Main.ipynb rename to Aimbot-PPO-Python/Tensorflow/GAIL-Main.ipynb diff --git a/Aimbot-PPO-Python/GAIL.py b/Aimbot-PPO-Python/Tensorflow/GAIL.py similarity index 100% rename from Aimbot-PPO-Python/GAIL.py rename to Aimbot-PPO-Python/Tensorflow/GAIL.py diff --git a/Aimbot-PPO-Python/GAILConfig.py b/Aimbot-PPO-Python/Tensorflow/GAILConfig.py similarity index 100% rename from Aimbot-PPO-Python/GAILConfig.py rename to Aimbot-PPO-Python/Tensorflow/GAILConfig.py diff --git a/Aimbot-PPO-Python/GAILHistory.py b/Aimbot-PPO-Python/Tensorflow/GAILHistory.py similarity index 100% rename from Aimbot-PPO-Python/GAILHistory.py rename to Aimbot-PPO-Python/Tensorflow/GAILHistory.py diff --git a/Aimbot-PPO-Python/GAILMem.py b/Aimbot-PPO-Python/Tensorflow/GAILMem.py similarity index 100% rename from Aimbot-PPO-Python/GAILMem.py rename to Aimbot-PPO-Python/Tensorflow/GAILMem.py diff --git a/Aimbot-PPO-Python/HumanAction.py b/Aimbot-PPO-Python/Tensorflow/HumanAction.py similarity index 100% rename from Aimbot-PPO-Python/HumanAction.py rename to Aimbot-PPO-Python/Tensorflow/HumanAction.py diff --git a/Aimbot-PPO-Python/PPO-mian.ipynb b/Aimbot-PPO-Python/Tensorflow/PPO-mian.ipynb similarity index 100% rename from Aimbot-PPO-Python/PPO-mian.ipynb rename to Aimbot-PPO-Python/Tensorflow/PPO-mian.ipynb diff --git a/Aimbot-PPO-Python/PPO.py b/Aimbot-PPO-Python/Tensorflow/PPO.py similarity index 100% rename from Aimbot-PPO-Python/PPO.py rename to Aimbot-PPO-Python/Tensorflow/PPO.py diff --git a/Aimbot-PPO-Python/PPOBuffer.py b/Aimbot-PPO-Python/Tensorflow/PPOBuffer.py similarity index 100% rename from Aimbot-PPO-Python/PPOBuffer.py rename to Aimbot-PPO-Python/Tensorflow/PPOBuffer.py diff --git a/Aimbot-PPO-Python/PPOConfig.py b/Aimbot-PPO-Python/Tensorflow/PPOConfig.py similarity index 100% rename from Aimbot-PPO-Python/PPOConfig.py rename to Aimbot-PPO-Python/Tensorflow/PPOConfig.py diff --git a/Aimbot-PPO-Python/PPOHistoryRecorder.py b/Aimbot-PPO-Python/Tensorflow/PPOHistoryRecorder.py similarity index 100% rename from Aimbot-PPO-Python/PPOHistoryRecorder.py rename to Aimbot-PPO-Python/Tensorflow/PPOHistoryRecorder.py diff --git a/Aimbot-PPO-Python/aimBotEnv.py b/Aimbot-PPO-Python/Tensorflow/aimBotEnv.py similarity index 100% rename from Aimbot-PPO-Python/aimBotEnv.py rename to Aimbot-PPO-Python/Tensorflow/aimBotEnv.py diff --git a/Aimbot-PPO-Python/env.ipynb b/Aimbot-PPO-Python/Tensorflow/env.ipynb similarity index 100% rename from Aimbot-PPO-Python/env.ipynb rename to Aimbot-PPO-Python/Tensorflow/env.ipynb diff --git a/Aimbot-PPO-Python/rewardAIClass.py b/Aimbot-PPO-Python/Tensorflow/rewardAIClass.py similarity index 100% rename from Aimbot-PPO-Python/rewardAIClass.py rename to Aimbot-PPO-Python/Tensorflow/rewardAIClass.py diff --git a/Aimbot-PPO-Python/Tensorflow/simple_test_env.ipynb b/Aimbot-PPO-Python/Tensorflow/simple_test_env.ipynb new file mode 100644 index 0000000..96a5843 --- /dev/null +++ b/Aimbot-PPO-Python/Tensorflow/simple_test_env.ipynb @@ -0,0 +1,61 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "from mlagents_envs.environment import UnityEnvironment\n", + "from gym_unity.envs import UnityToGymWrapper\n", + "\n", + "ENV_PATH = \"../Build-CloseEnemyCut/Aimbot-PPO\"\n", + "WORKER_ID = 2\n", + "BASE_PORT = 2002\n", + "\n", + "def main():\n", + " unity_env = UnityEnvironment(file_name=ENV_PATH,seed = 1,side_channels=[],worker_id = WORKER_ID,base_port=BASE_PORT)\n", + " env = UnityToGymWrapper(unity_env, uint8_visual=True,allow_multiple_obs=True)\n", + " env.reset()\n", + " for _ in range(1000):\n", + " env.render()\n", + " o,r,d,_ = env.step(env.action_space.sample()) #random action\n", + " if d:\n", + " env.reset()\n", + " env.close() \n", + " \n", + "\n", + "\n", + "if __name__ == '__main__':\n", + " main()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3.9.7 64-bit", + "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.9.7" + }, + "orig_nbformat": 4, + "vscode": { + "interpreter": { + "hash": "86e2db13b09bd6be22cb599ea60c1572b9ef36ebeaa27a4c8e961d6df315ac32" + } + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/Aimbot-PPO-Python/testarea.ipynb b/Aimbot-PPO-Python/Tensorflow/testarea.ipynb similarity index 98% rename from Aimbot-PPO-Python/testarea.ipynb rename to Aimbot-PPO-Python/Tensorflow/testarea.ipynb index 55a8f7c..e56418f 100644 --- a/Aimbot-PPO-Python/testarea.ipynb +++ b/Aimbot-PPO-Python/Tensorflow/testarea.ipynb @@ -582,16 +582,7 @@ "execution_count": 4, "metadata": {}, "outputs": [], - "source": [ - "from os import mkdir\n", - "\n", - "\n", - "try:\n", - " open(\"thisdir/51\",\"w\")\n", - "except FileNotFoundError:\n", - " mkdir(\"thisdir/\")\n", - " open(\"thisdir/51\",\"w\")" - ] + "source": [] } ], "metadata": { diff --git a/Aimbot-PPO-Python/simple_test_env.ipynb b/Aimbot-PPO-Python/simple_test_env.ipynb deleted file mode 100644 index 509828a..0000000 --- a/Aimbot-PPO-Python/simple_test_env.ipynb +++ /dev/null @@ -1,84 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[INFO] Connected to Unity environment with package version 2.0.0 and communication version 1.5.0\n", - "[INFO] Connected new brain: AKMAgent?team=0\n", - "[WARNING] uint8_visual was set to true, but visual observations are not in use. This setting will not have any effect.\n" - ] - }, - { - "ename": "UnityGymException", - "evalue": "The gym wrapper does not provide explicit support for both discrete and continuous actions.", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mUnityGymException\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m~\\AppData\\Local\\Temp/ipykernel_10504/1419431386.py\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[0;32m 20\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 21\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0m__name__\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;34m'__main__'\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 22\u001b[1;33m \u001b[0mmain\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[1;32m~\\AppData\\Local\\Temp/ipykernel_10504/1419431386.py\u001b[0m in \u001b[0;36mmain\u001b[1;34m()\u001b[0m\n\u001b[0;32m 8\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mmain\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 9\u001b[0m \u001b[0munity_env\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mUnityEnvironment\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfile_name\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mENV_PATH\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mseed\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mside_channels\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mworker_id\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mWORKER_ID\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mbase_port\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mBASE_PORT\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 10\u001b[1;33m \u001b[0menv\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mUnityToGymWrapper\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0munity_env\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0muint8_visual\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mTrue\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mallow_multiple_obs\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mTrue\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 11\u001b[0m \u001b[0menv\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mreset\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 12\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0m_\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1000\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;32mc:\\Users\\UCUNI\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\gym_unity\\envs\\__init__.py\u001b[0m in \u001b[0;36m__init__\u001b[1;34m(self, unity_env, uint8_visual, flatten_branched, allow_multiple_obs, action_space_seed)\u001b[0m\n\u001b[0;32m 128\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_action_space\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mspaces\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mBox\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m-\u001b[0m\u001b[0mhigh\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mhigh\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfloat32\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 129\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 130\u001b[1;33m raise UnityGymException(\n\u001b[0m\u001b[0;32m 131\u001b[0m \u001b[1;34m\"The gym wrapper does not provide explicit support for both discrete \"\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 132\u001b[0m \u001b[1;34m\"and continuous actions.\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;31mUnityGymException\u001b[0m: The gym wrapper does not provide explicit support for both discrete and continuous actions." - ] - } - ], - "source": [ - "from mlagents_envs.environment import UnityEnvironment\n", - "from gym_unity.envs import UnityToGymWrapper\n", - "\n", - "ENV_PATH = './Build/Aimbot-PPO'\n", - "WORKER_ID = 2\n", - "BASE_PORT = 2002\n", - "\n", - "def main():\n", - " unity_env = UnityEnvironment(file_name=ENV_PATH,seed = 1,side_channels=[],worker_id = WORKER_ID,base_port=BASE_PORT)\n", - " env = UnityToGymWrapper(unity_env, uint8_visual=True,allow_multiple_obs=True)\n", - " env.reset()\n", - " for _ in range(1000):\n", - " env.render()\n", - " o,r,d,_ = env.step(env.action_space.sample()) #random action\n", - " if d:\n", - " env.reset()\n", - " env.close() \n", - " \n", - "\n", - "\n", - "if __name__ == '__main__':\n", - " main()" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3.9.7 64-bit", - "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.9.7" - }, - "orig_nbformat": 4, - "vscode": { - "interpreter": { - "hash": "86e2db13b09bd6be22cb599ea60c1572b9ef36ebeaa27a4c8e961d6df315ac32" - } - } - }, - "nbformat": 4, - "nbformat_minor": 2 -}