rll-research/url_benchmark

Bug in replay buffer

Baichenjia opened this issue · 7 comments

In line 49 of replay_buffer.py
time_step is an ExtendedTimeStepWrapper objective, not a list.

Why you use indecs to extract information?

value = time_step[spec.name]

The error is

TypeError: tuple indices must be integers or slices, not str

Also, why you need a ExtendedTimeStepWrapper objective?

I also get an error as

return getattr(self, attr) TypeError: getattr(): attribute name must be string

Can you simplify your code? I find this class do nothing.

I think you have Python version that less than 3.8, which our code expects.

This wrapper is needed to store actions in timestep, it is not useless

Thanks for your reply!

Why we need store actions? I still feel confused.

It works when I use python 3.8, thanks

We store actions in timestep so it is easier to pass around transitions, for example to add them to the replay buffer.

I think you have Python version that less than 3.8, which our code expects.

Could you tell me why python<3.8 raises "TypeError: getattr(): attribute name must be string" error?

from https://docs.python.org/3.8/library/functions.html#getattr

getattr(object, name[, default])[¶](https://docs.python.org/3.8/library/functions.html#getattr)
Return the value of the named attribute of object. name must be a string. If the string is the name of one of the object’s attributes, the result is the value of that attribute. For example, getattr(x, 'foobar') is equivalent to x.foobar. If the named attribute does not exist, default is returned if provided, otherwise [AttributeError](https://docs.python.org/3.8/library/exceptions.html#AttributeError) is raised.

https://docs.python.org/3.7/library/functions.html#getattr

getattr(object, name[, default])[¶](https://docs.python.org/3.7/library/functions.html#getattr)
Return the value of the named attribute of object. name must be a string. If the string is the name of one of the object’s attributes, the result is the value of that attribute. For example, getattr(x, 'foobar') is equivalent to x.foobar. If the named attribute does not exist, default is returned if provided, otherwise [AttributeError](https://docs.python.org/3.7/library/exceptions.html#AttributeError) is raised.

The explanations seem quite same.