acme icon indicating copy to clipboard operation
acme copied to clipboard

Google Colab Acme tutorial datasets.make_reverb_dataset ValueError

Open DKevi opened this issue 2 years ago • 3 comments

I am trying to learn Acme from the Colab tutorial but datasets.make_reverb_dataset is getting ValueError on environment_spec. Even after commenting out the argument, since it is not required anymore, another ValueError appears.

The ValueError before removing environment_spec: ValueError Traceback (most recent call last) in () 7 batch_size=256, 8 environment_spec=environment_spec, ----> 9 transition_adder=True)

/usr/local/lib/python3.7/dist-packages/acme/datasets/reverb.py in make_reverb_dataset(server_address, batch_size, prefetch_size, table, num_parallel_calls, max_in_flight_samples_per_worker, postprocess, environment_spec, extra_spec, transition_adder, convert_zero_size_to_none, using_deprecated_adder, sequence_length) 48 if environment_spec or extra_spec: 49 raise ValueError( ---> 50 'The make_reverb_dataset factory function no longer requires specs as' 51 ' as they should be passed as a signature to the reverb.Table when it' 52 ' is created. Consider either updating your code or falling back to the'

ValueError: The make_reverb_dataset factory function no longer requires specs as as they should be passed as a signature to the reverb.Table when it is created. Consider either updating your code or falling back to the deprecated dataset factory in acme/datasets/deprecated.

The ValueError after removing environment_spec: ValueError: in user code:

File "/usr/local/lib/python3.7/dist-packages/acme/datasets/reverb.py", line 71, in _make_dataset  *
    dataset = reverb.TrajectoryDataset.from_table_signature(
File "/usr/local/lib/python3.7/dist-packages/reverb/trajectory_dataset.py", line 195, in from_table_signature  *
    raise ValueError(

ValueError: Table priority_table at localhost:23625 does not have a signature.

DKevi avatar Apr 02 '22 21:04 DKevi

I'm running into this as well and it's not clear what the fix should be

rdevon avatar May 16 '22 19:05 rdevon

Problem is the table creation. Should be:

replay_buffer = reverb.Table(
    name=adders.DEFAULT_PRIORITY_TABLE,
    max_size=1000000,
    remover=reverb.selectors.Fifo(),
    sampler=reverb.selectors.Uniform(),
    rate_limiter=reverb.rate_limiters.MinSize(min_size_to_sample=1),
    signature=(tf.TensorSpec(2), tf.TensorSpec(1), tf.TensorSpec(None), tf.TensorSpec(None), tf.TensorSpec(2)))

rdevon avatar May 16 '22 20:05 rdevon

The above solution removes the above error, but fails when needing to step through the trainer farther down in the tutorial. These are the correct buffer args I believe:

from acme.adders import reverb as reverb_adders
replay_buffer = reverb.Table(
    name=adders.DEFAULT_PRIORITY_TABLE,
    max_size=1000000,
    remover=reverb.selectors.Fifo(),
    sampler=reverb.selectors.Uniform(),
    rate_limiter=reverb.rate_limiters.MinSize(min_size_to_sample=1),
    signature=reverb_adders.NStepTransitionAdder.signature(
            environment_spec))

rdevon avatar May 17 '22 16:05 rdevon

Hi DKevi and rdevon,

Thanks for your proposed solutions and apologies for the delay on this. Following the release of the new edition of Acme, we have revamped our quickstart and tutorial guides. Hopefully they are much more clear (and bug free!). I'll mark this comment as closed as it is now obsolete but please do open a new one if you notice any issues in the new guides.

Happy Acming!

Bobak

bshahr avatar Sep 29 '22 08:09 bshahr