MorvanZhou / pytorch-A3C

Simple A3C implementation with pytorch + multiprocessing
https://mofanpy.com
MIT License
608 stars 142 forks source link

The discrete_A3C.py is not working... #23

Closed Petrelli closed 1 year ago

Petrelli commented 1 year ago

I got this error:

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/Users/Petrelli/Desktop/Research/code/pytorch-A3C/continuous_A3C.py", line 88, in run a = self.lnet.choose_action(v_wrap(s[None, :])) TypeError: tuple indices must be integers or slices, not tuple

Then I just changed the line 85 to a = self.lnet.choose_action(v_wrap(s[None :]))

However, another error comes...

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/Users/Petrelli/Desktop/Research/code/pytorch-A3C/discrete_A3C.py", line 85, in run a = self.lnet.choose_action(v_wrap(s[None :])) File "/Users/Petrelli/Desktop/Research/code/pytorch-A3C/utils.py", line 11, in v_wrap if np_array.dtype != dtype: AttributeError: 'tuple' object has no attribute 'dtype'

Not sure if it is the python version's reason (I used python 3.9 and 3.10 to run the code, on Mac).

Petrelli commented 1 year ago

it was the Mac M1 silicon's reason...

Shengqi-Kong commented 3 months ago

i get the same error. Win11+intel i9. "TypeError: tuple indices must be integers or slices, not tuple" on " a = self.lnet.choose_action(v_wrap(s[None, :])) "