maurock / snake-ga

AI Agent that learns how to play Snake with Deep Q-Learning
528 stars 999 forks source link

i get this error. what do i do? new to python and programming and just want to execute this cool program. #13

Open n4hid opened 3 years ago

n4hid commented 3 years ago

2020-11-26 23:16:55.536092: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations: AVX2 FMA To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. 2020-11-26 23:16:55.550165: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x7fdf6d52e130 initialized for platform Host (this does not guarantee that XLA will be used). Devices: 2020-11-26 23:16:55.550181: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version Traceback (most recent call last): File "/Users/nahidahmed/Desktop/SnakeGame/snakeClass.py", line 309, in run(args.display, args.speed, params) File "/Users/nahidahmed/Desktop/SnakeGame/snakeClass.py", line 223, in run agent = DQNAgent(params) File "/Users/nahidahmed/Desktop/SnakeGame/DQN.py", line 29, in init self.model = self.network() File "/Users/nahidahmed/Desktop/SnakeGame/DQN.py", line 33, in network model.add(Dense(output_dim=self.first_layer, activation='relu', input_dim=11)) TypeError: init() missing 1 required positional argument: 'units'

Ad1tyaV commented 3 years ago

Same error on windows as well, could you please let us know

CodeBlog-x64 commented 3 years ago

Sorry for pushing this thread but I’m also struggling with this as well. I didn’t know if I should change the output_dims to units instead. If anyone could clarify how we could fix this problem and confusion we would greatly appreciate it.

Ps: I am using windows 10, python 3.8, and Tensorflow 2.

tipycalFlow commented 3 years ago

Removing param name output_dim fixes this: Replace model.add(Dense(output_dim=self.first_layer, activation='relu', input_dim=11)) with model.add(Dense(self.first_layer, activation='relu', input_dim=11)) for all instances where Dense layer is created

n4hid commented 3 years ago

Removing param name output_dim fixes this:

n4hid commented 3 years ago

@tipycalFlow hey can you send me a video of this working, whether its a youtube link or something. this would be very helpful.

Sviskon0 commented 3 years ago

Sorry for not bringing a solution, but this replaces the error with

Traceback (most recent call last): File "thonnyfiler/snake/snake-ga-master1/snakeClass.py", line 308, in run(args.display, args.speed, params) File "thonnyfiler/snake/snake-ga-master1/snakeClass.py", line 222, in run agent = DQNAgent(params) File "C:\Users\Elev\thonnyfiler\snake\snake-ga-master1\DQN.py", line 27, in init self.model = self.network() File "C:\Users\Elev\thonnyfiler\snake\snake-ga-master1\DQN.py", line 34, in network model.add(Dense(activation='softmax')) TypeError: init() missing 1 required positional argument: 'units'

Removing param name output_dim fixes this: Replace model.add(Dense(output_dim=self.first_layer, activation='relu', input_dim=11)) with model.add(Dense(self.first_layer, activation='relu', input_dim=11)) for all instances where Dense layer is created

robert-lara commented 2 years ago

Change these lines to units instead of output_dim in DQN.py lines 31-34:

model.add(Dense(units=self.first_layer, activation='relu', input_dim=11)) model.add(Dense(units=self.second_layer, activation='relu')) model.add(Dense(units=self.third_layer, activation='relu')) model.add(Dense(units=3, activation='softmax'))