MLJejuCamp2017 / DRL_based_SelfDrivingCarControl

Deep Reinforcement Learning (DQN) based Self Driving Car Control with Vehicle Simulator
293 stars 95 forks source link

Reg- unable to run code #9

Open jaswanthiiit opened 6 years ago

jaswanthiiit commented 6 years ago

Hi ,

I am trying to run your code through jupyter notebook connecting from anaconda prompt by the method you described earlier like unzipping etc. getting few issues like:

ModuleNotFoundError Traceback (most recent call last)

in () 8 import time 9 ---> 10 from unityagents import UnityEnvironment 11 12 get_ipython().run_line_magic('matplotlib', 'inline') ModuleNotFoundError: No module named 'unityagents' Name Error: name " UnityEnvironment " is not defined --------------------------------------------------------------------------- NameError Traceback (most recent call last) in () ----> 1 env = UnityEnvironment(file_name=env_name) 2 3 # Examine environment parameters 4 print(str(env)) 5 NameError: name 'UnityEnvironment' is not defined --------------------------------------------------------------------------- error Traceback (most recent call last) in () 17 18 # Get information for update ---> 19 env_info = env.step(action_in)[default_brain] 20 21 next_observation_stack, observation_set, next_state_stack, state_set = resize_input(env_info, observation_set, state_set) C:\Users\Q\Desktop\JejuCamp_ML_Agents\unityagents\environment.py in step(self, vector_action, memory, text_action) 469 self._conn.send(b"STEP") 470 self._send_action(vector_action, memory, text_action) --> 471 return self._get_state() 472 elif not self._loaded: 473 raise UnityEnvironmentException("No Unity environment is loaded.") C:\Users\Q\Desktop\JejuCamp_ML_Agents\unityagents\environment.py in _get_state(self) 285 self._data = {} 286 while True: --> 287 state_dict, end_of_message = self._get_state_dict() 288 if end_of_message is not None: 289 self._global_done = end_of_message C:\Users\Q\Desktop\JejuCamp_ML_Agents\unityagents\environment.py in _get_state_dict(self) 241 :return: 242 """ --> 243 state = self._recv_bytes().decode('utf-8') 244 if state[:14] == "END_OF_MESSAGE": 245 return {}, state[15:] == 'True' C:\Users\Q\Desktop\JejuCamp_ML_Agents\unityagents\environment.py in _recv_bytes(self) 217 try: 218 s = self._conn.recv(self._buffer_size) --> 219 message_length = struct.unpack("I", bytearray(s[:4]))[0] 220 s = s[4:] 221 while len(s) != message_length: error: unpack requires a bytes object of length 4 once i open the simulator app, I get following exception found at end in log file. I cannot file .cs file. please help me in this regard. Mono path[0] = 'C:/DL/adas/jas/DRL_based_SelfDrivingCarControl-master (1)/DRL_based_SelfDrivingCarControl-master/environment/jeju_camp_Data/Managed' Mono config path = 'C:/DL/adas/jas/DRL_based_SelfDrivingCarControl-master (1)/DRL_based_SelfDrivingCarControl-master/environment/jeju_camp_Data/MonoBleedingEdge/etc' PlayerConnection initialized from C:/DL/adas/jas/DRL_based_SelfDrivingCarControl-master (1)/DRL_based_SelfDrivingCarControl-master/environment/jeju_camp_Data (debug = 0) PlayerConnection initialized network socket : 0.0.0.0 55335 Multi-casting "[IP] 10.0.3.178 [Port] 55335 [Flags] 2 [Guid] 3442019743 [EditorId] 2618453742 [Version] 1048832 [Id] WindowsPlayer(LAPTOP-MDH1861V) [Debug] 0" to [225.0.0.222:54997]... Started listening to [0.0.0.0:55335] PlayerConnection already initialized - listening to [0.0.0.0:55335] Initialize engine version: 2017.3.1f1 (fc1d3344e6ea) GfxDevice: creating device client; threaded=1 Direct3D: Version: Direct3D 11.0 [level 11.1] Renderer: Intel(R) HD Graphics 5500 (ID=0x1616) Vendor: Intel VRAM: 1130 MB Driver: 20.19.15.4642 Begin MonoManager ReloadAssembly - Completed reload, in 7.260 seconds Initializing input. XInput1_3.dll not found. Trying XInput9_1_0.dll instead... Input initialized. Initialized touch support. Setting up 2 worker threads for Enlighten. Thread -> id: 3714 -> priority: 1 Thread -> id: 342c -> priority: 1 UnloadTime: 4.280462 ms UnityAgentsException: The brain Brain was set to External mode but Unity was unable to read the arguments passed at launch. at CoreBrainExternal.InitializeCoreBrain (Communicator communicator) [0x00059] in D:\UnityGames\ML_Agent_Jejucamp2017\Assets\Scripts\CoreBrainExternal.cs:37 at Brain.InitializeBrain (Academy aca, Communicator communicator) [0x0000e] in D:\UnityGames\ML_Agent_Jejucamp2017\Assets\Scripts\Brain.cs:209 at Academy.InitializeEnvironment () [0x00056] in D:\UnityGames\ML_Agent_Jejucamp2017\Assets\Scripts\Academy.cs:230 at Academy.Awake () [0x00002] in D:\UnityGames\ML_Agent_Jejucamp2017\Assets\Scripts\Academy.cs:208 (Filename: D:/UnityGames/ML_Agent_Jejucamp2017/Assets/Scripts/CoreBrainExternal.cs Line: 37) Can you please suggest me step by step procedure to execute as i am beginer to RL concepts... Thank you. Could you tell me the code execution process for each ipynb files in RL algorithms folder.
Kyushik commented 6 years ago

@jaswanthiiit Sorry for late reply. I went to military training for a month, so I couldn't use any electronic devices. I moved unityagents folder into the RL_algorithms folder. I think it will fix the issue. I will tell you how to execute this project.

  1. download the github repo
  2. download the simulator and put all the files into the environment folder
  3. open the ipynb file in the RL_algorithm folder and run it!

Thank you.

Zhousiyuhit commented 5 years ago

I have resolved the problem when I modified a line of code:

from RL_algorithms.unityagents.environment import UnityEnvironment

JunaidRana commented 5 years ago

have resolved this using this command.

from mlagents.envs import UnityEnvironment

jayden199012 commented 4 years ago

@JunaidRana Saved my life!