chris-chris / pysc2-examples

StarCraft II - pysc2 Deep Reinforcement Learning Examples
Apache License 2.0
753 stars 356 forks source link

ImportError: cannot import name 'mse' #22

Open Guo-Youtian opened 5 years ago

Guo-Youtian commented 5 years ago

$ python train_mineral_shards.py --algorithm=a2c /home/guoyoutian/anaconda3/lib/python3.6/site-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type. from ._conv import register_converters as _register_converters pygame 1.9.4 Hello from the pygame community. https://www.pygame.org/contribute.html Traceback (most recent call last): File "train_mineral_shards.py", line 15, in from a2c import a2c File "/home/guoyoutian/PycharmProjects/pysc2-examples-master/a2c/a2c.py", line 12, in from baselines.a2c.utils import cat_entropy, mse ImportError: cannot import name 'mse'

XuJing1022 commented 5 years ago

Hi, I met the same bug. Whether did you solve it later? thx

divyavanmahajan commented 5 years ago

The baselines.a2c.util does not have a "mse" function. So edit a2c/a2c.py

Line 12: REMOVE ,mse from baselines.a2c.utils import cat_entropy, mse

Line 27: Add these two lines to define the missing mse function

def mse(pred, target):
  return tf.square(pred-target)/2.