chris-chris / pysc2-examples

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

BatchInput seems to be deprecated in latest openai/baselines #23

Closed DPain closed 4 years ago

DPain commented 5 years ago

Hi, this is somewhat related to Issue #13 . As of 3/11/2019, openaI/baselines does not support BatchInput in baselines.deepq.utils anymore.

The change was made in commit 24fe3d6576dd8f4cdd5f017805be689d6fa6be8c May 21, 2018. It seems like BatchInput has been changed to ObvservationInput.

openai/baselines issue #524 also states this issue, but there were no replies made yet.

Since ObvservationInput only accepts gym spaces, I'm not really sure how to modify enjoy_mineral_shards.py to run on the latest baselines since the code below will not work anymore.

def make_obs_ph(name):
      return U.BatchInput((64, 64), name=name)

I think I should be using a code something like the below, but if I do so I would get another error saying ValueError: Convolution expects input with rank 4, got 2 while building the act.

def make_obs_ph(name):
      U.ObservationInput(Box(low=-32.0, high=32.0, shape=(2,)), name=name)

Thanks in advance!

Juphex commented 5 years ago

Any progress?

sritee commented 5 years ago

I ended up copy pasting BatchInput from the history of the utils file and using it.

Dtrycode commented 5 years ago

I ended up copy pasting BatchInput from the history of the utils file and using it.

Have you encountered this error? ValueError: Convolution expects input with rank 4, got 3

AlmightyMelon commented 5 years ago

I also get: ValueError: Convolution expects input with rank 4, got 3

After doing this:

It also looks like some of the utility functions have moved. In enjoy_mineral_shards.py and deepq_mineral_shards.py, add somewhere at the top:

import baselines.deepq.utils as U2

Change all: U.BatchInput, U.load_state, U.save_state to: U2.BatchInput, U2.load_state, U2.save_state

Dtrycode commented 5 years ago

I also get: ValueError: Convolution expects input with rank 4, got 3

After doing this:

It also looks like some of the utility functions have moved. In enjoy_mineral_shards.py and deepq_mineral_shards.py, add somewhere at the top: import baselines.deepq.utils as U2 Change all: U.BatchInput, U.load_state, U.save_state to: U2.BatchInput, U2.load_state, U2.save_state

The error is with tensorflow. I tried to change the input to BatchInput function to ( #, #, 1), and modify input samples to the dimension accordingly.

AlmightyMelon commented 5 years ago

I'll go back to building my own basic examples to teach myself. That fix is beyond me for now.