reward-learning-rl icon indicating copy to clipboard operation
reward-learning-rl copied to clipboard

dm_control+robosuite package not found, 'FeedforwardGaussianPolicy' object has no attribute '_Serializable__initialize'

Open weijiafeng opened this issue 5 years ago • 14 comments

Hi All, when running

softlearning run_example_local examples.classifier_rl
--n_goal_examples 10
--task=Image48SawyerDoorPullHookEnv-v0
--algorithm VICERAQ
--num-samples 5
--n_epochs 300
--active_query_frequency 10

I've experienced the following error:

  1. dm_control package not found. (The thing is - I've already ran pip install git+https://github.com/deepmind/dm_control.git and it is shown on terminal that I'd successfully install it: image

  2. robosuite package not found (same as above, I've already ran pip3 install robosuite: image

  3. AttributeError: 'FeedforwardGaussianPolicy' object has no attribute '_Serializable__initialize': image

FYI, my environment is: MacOS Mojave version 10.14.1 Python 3.6.5 Gym 0.9.3 Mujoco: 200 mujoco-py 1.50.1.68

Let me know what have I missed/done wrong? Thank you very much!

weijiafeng avatar Jun 02 '19 15:06 weijiafeng

Hi,

While I have not tried setting up this codebase on MacOS, I would recommend the following two things:

  1. Change mujoco version to 150 (instead of 200)
  2. Use v0.1 of the codebase: https://github.com/avisingh599/reward-learning-rl/tree/v0.1

I added the dm_control/robosuite dependencies later, and I think they have caused issues for others as well, and I will be investigating them soon. In the meanwhile, let me know if things work after you make the changes above.

avisingh599 avatar Jun 02 '19 15:06 avisingh599

@avisingh599 Thanks for your response. I followed your instructions (I've put mjkey.txt and mjpro150 into ~/.mujoco folder, downloaded v0.1 and rebuilt the soft learning environment using the yml in this v0.1 folder), the three errors stated in the post above haven't come up, yet there's another error about the gym package saying that the module 'gym' has no attribute 'register':

image

weijiafeng avatar Jun 03 '19 04:06 weijiafeng

Hmm - this is a bit strange. Can you post the output of pip freeze | grep gym?

avisingh599 avatar Jun 03 '19 04:06 avisingh599

@avisingh599 Is this because there's a file called gym.py which is messing up with the gym module installed? I am pretty sure I installed gym, in the same environment above, I checked my gym version: it is 0.9.3

image

Let me know if I've done anything incorrect? thanks!

weijiafeng avatar Jun 03 '19 04:06 weijiafeng

@avisingh599 image

weijiafeng avatar Jun 03 '19 04:06 weijiafeng

Hmm - your gym version from pip freeze seems correct, so I am not sure what exactly is happening. Could you try opening the python interpreter and typing in import gym; print(gym.__version__); gym.register()

avisingh599 avatar Jun 03 '19 04:06 avisingh599

@avisingh599 To run what you said in python interpreter, for the Pycharm environment, I set it to the softlearning environment created as per your instructions in ReadMe. I am not sure what directory to set for the Conda Executable? Does this matter?

image

weijiafeng avatar Jun 03 '19 05:06 weijiafeng

@avisingh599 Or should I add the soft learning environment by ticking the "Existing Interpreter" and add it? how to specify the directory for the softlearning environment? like ..../bin/..... ?

weijiafeng avatar Jun 03 '19 05:06 weijiafeng

I'm actually not sure - as I haven't used this interface. I only work on Linux, and don't use pycharm. Having said that, your settings seem fine to me - so with whatever setting you were launching the softlearning commands, I would suggest just typing in python to open the interpreter in interactive mode, and try out the commands that I suggested above.

avisingh599 avatar Jun 03 '19 05:06 avisingh599

@avisingh599 I've tried out your commands - the error of running gym.register() is "register() missing 1 required positional argument: 'id' :

image

weijiafeng avatar Jun 03 '19 06:06 weijiafeng

It looks like gym is able to find that function when you run it from this script, but it is somehow unable to find it from softlearning. I would suggest putting a break point (using IPython, for example) where softlearning errors out, investigating from there.

avisingh599 avatar Jun 03 '19 17:06 avisingh599

Well I just face the problem of 'AttributeError: 'FeedforwardGaussianPolicy' object has no attribute '_Serializable__initialize'', @avisingh599 . You might forget to answer this question. Could you give me some advice?

Skylark0924 avatar Jun 05 '20 14:06 Skylark0924

I tracked the codes and really did not find out where this attribute '_Serializable__initialize' is defined in gaussian_policy.py and base_policy.py.

Skylark0924 avatar Jun 05 '20 14:06 Skylark0924

Sorry to bother you. I found the solution. It's a problem caused by the wrong version of serializable package. Follow this issue to fix this bug.

Skylark0924 avatar Jun 05 '20 15:06 Skylark0924