Closed techboy-coder closed 2 years ago
Hello, you posted your issue in the old SB2 repo, but you are using sb3... Did you check the values too? they must be in the defined limits.
Hey 👋, Thanks for letting me know about the wrong repo. I just found the new one... I was also able to solve the issue.
I found that np.empty()
(in Client
class during the initialization of self.data
) fills up the array with the maximum and minimum signed 32-bit int values. So yes, I had to define limits (I just arr.fill(0)
my array). Not doing so triggered the assertion error.
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ method_name = 'step' │ │
│ │ obs = array([ 0, 0, 0, 0, -2147483648, │ │
│ │ │ │ │ │ 0, -2147483648, -2147483648, 0, 0, │ │
│ │ │ │ │ │ 0, 0, 0, -2147483648, -2147483648, │ │
│ │ │ -2147483648, -2147483648, -2147483648, -2147483648, -2147483648, │ │
│ │ │ │ │ │ 0, 0, 0, -2147483648, -2147483648, │ │
│ │ │ -2147483648, -2147483648, -2147483648, -2147483648, -2147483648, │ │
│ │ │ │ │ │ 0, 0, 0, -2147483648, -2147483648, │ │
│ │ │ │ │ │ 0, 0, 0, 0, 0, │ │
│ │ │ │ │ │ 0, 0, 0, 0, 0, │ │
│ │ │ │ │ │ 0, 0, 0, 0, 0, │ │
│ │ │ │ │ │ 0, 0, 0, 0, 0, │ │
│ │ │ │ │ │ 0, 0, 0, 0, 0, │ │
│ │ │ │ │ │ 0, 0, 0, 0, 0, │ │
│ │ │ │ │ │ 0, 0, -2147483648, 0, -2147483648, │ │
│ │ │ │ │ │ 0, 0, 0, 0, 0, │ │
│ │ │ │ │ │ 0, -2147483648, -2147483648, -2147483648, 0, │ │
│ │ │ │ │ │ 0, 0, 0, 0, 0, │ │
│ │ │ │ │ │ 0, 0, 0, 0, -2147483648, │ │
│ │ │ │ │ │ 0, 0, 0, -2147483648, -2147483648, │ │
│ │ │ -2147483648, 0, 0, 0, 0, │ │
│ │ │ │ │ │ 0, 0, 0, -2147483648, -2147483648, │ │
│ │ │ │ │ │ 0, 0, 0, -2147483648, 0, │ │
│ │ │ │ │ │ 0, 0, 0, 0, 0, │ │
│ │ │ │ │ │ 0, 0, -2147483648, 0, 0, │ │
│ │ │ │ │ │ 0, 0, 0, 0, -2147483648, │ │
│ │ │ -2147483648, -2147483648, -2147483648, 0, -2147483648, │ │
│ │ │ │ │ │ 0, 0, 0, 0, 0, │ │
│ │ │ │ │ │ 0, -2147483648, -2147483648, -2147483648, 0, │ │
│ │ │ │ │ │ 0, 0, 0, -2147483648, -2147483648, │ │
│ │ │ -2147483648, -2147483648, -2147483648, 0, 0, │ │
│ │ │ │ │ │ 0, 0, 0, 0, 0, │ │
│ │ │ -2147483648, 0, 0, -2147483648, -2147483648, │ │
│ │ │ │ │ │ 0, 0, 0, 0, 0, │ │
│ │ │ -2147483648, -2147483648, -2147483648, 0, 0, │ │
│ │ │ │ │ │ 0, 0, 0, -2147483648, 0, │ │
│ │ │ -2147483648, -2147483648, 0, 0, 0, │ │
│ │ │ │ │ │ 0, 0, 0, 0, 0, │ │
│ │ │ │ │ │ 0, -2147483648, 0, 0, 4999656, │ │
│ │ │ │ │ │ 0, 0, 0, 0, 0, │ │
│ │ │ │ │ │ 0, 0, 0, -2147483648, 0, │ │
│ │ │ │ │ │ 0, 0, 0, -2147483648, -2147483648, │ │
│ │ │ -2147483648, -2147483648, -2147483648, -2147483648, 0, │ │
│ │ │ │ │ │ 0, 0, 0, -2147483648, -2147483648, │ │
│ │ │ -2147483648, -2147483648, -2147483648, -2147483648, 0, │ │
│ │ │ │ │ │ 0, 0, 0, -2147483648, -2147483648, │ │
│ │ │ -2147483648, -2147483648, -2147483648, -2147483648, -2147483648, │ │
│ │ │ │ │ │ 0, 0, 0, -2147483648, -2147483648, │ │
│ │ │ │ │ │ 0, 0, 0, 0, 0, │ │
│ │ │ │ │ │ 0, 0, 0, -2147483648, 0, │ │
│ │ │ │ │ │ 0, -2147483648, 0, 0, -2147483648, │ │
│ │ │ │ │ │ 0, 0, 0, 0, 0, │ │
# ...
Also, thanks for taking the time and replying :).
While trying to create my own custom environment, I run into a strange problem. According to stablebaseline3's custom environment checker (
check_env
), my observation (returned bystep()
) does not match the specified observation space. At the same time, I print out the shapes and data types of all the observations returned, as well as the observation space example, which all match and give me the same shape and data type. The error message seems to be contradicting my debug statements (print line).Error: I am getting the following error:
AssertionError: The observation returned by the `step()` method does not match the given observation space
Full error message:
```python ╰─> python .\app.py py version: 3.9.12 (main, Apr 4 2022, 05:22:27) [MSC v.1916 64 bit (AMD64)] Dimensions: 462 (flattened). Sample Observation (462,) int32 Reset Observation (462,) int32 Step Observation (462,) int32 ╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ C:\Users\Shivr\Documents\Code\Projects\MA9\home\app.py:157 in