minerllabs / minerl

MineRL Competition for Sample Efficient Reinforcement Learning - Python Package
http://minerl.io/docs/
Other
711 stars 153 forks source link

BufferedBatchIter fails when buffer_target_size=10000 #560

Open alper111 opened 3 years ago

alper111 commented 3 years ago

Steps to reproduce:

import minerl
from minerl.data import BufferedBatchIter

data = minerl.data.make('MineRLObtainDiamondDenseVectorObf-v0')
iterator = BufferedBatchIter(data, buffer_target_size=10000)

count = 0
for (s, a, r, sn, d) in iterator.buffered_batch_iter(batch_size=32, num_epochs=1):
        # ... do something with the data.
        count += len(r)
        print(count)

print("epoch finished %d" % count)

Expected behavior:

The loop should finish successfully.

Observed behavior:

Traceback (most recent call last):
  File "/home/***/workspace/golem/sampler.py", line 8, in <module>
    for (s, a, r, sn, d) in iterator.buffered_batch_iter(batch_size=32, num_epochs=1):
  File "/home/***/miniconda3/envs/minerl/lib/python3.9/site-packages/minerl/data/buffered_batch_iter.py", line 119, in buffered_batch_iter
    assert len(self.available_trajectories) == 0, "You've reached the end of your " \
AssertionError: You've reached the end of your data buffer while still having trajectories available; something seems to have gone wrong
Miffyli commented 3 years ago

Pinging @decodyng if she would like to take a look at this. I am quickly passing by and will delve deeper into this next week.