haarnoja / sac

Soft Actor-Critic

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NNDiscriminatorFunction error

srama2512 opened this issue · comments

Hi,

I was able to install and run the sample SAC code. However, while executing python examples/mujoco_all_diayn.py --env=half-cheetah --log_dir=data/demo, I got the following errors:

value_function.py", line 50, in __init__ Parameterized.__init__(self) NameError: name 'Parameterized' is not defined

This was resolved by adding this import to value_function.py: from sandbox.rocky.tf.core.parameterized import Parameterized. However, I'm getting another error at this point:

  File "/private/home/sramakri/Projects/diayn/rllab/scripts/run_experiment_lite.py", line 137, in <module>
    run_experiment(sys.argv)
  File "/private/home/sramakri/Projects/diayn/rllab/scripts/run_experiment_lite.py", line 121, in run_experiment
    method_call(variant_data)
  File "examples/mujoco_all_diayn.py", line 221, in run_experiment
    num_skills=variant['num_skills'],
  File "/private/home/sramakri/Projects/diayn/sac/sac/value_functions/value_function.py", line 69, in __init__
    self._output_t = self.get_output_for(*self._input_pls)
  File "/private/home/sramakri/Projects/diayn/sac/sac/misc/mlp.py", line 179, in get_output_for
    output_nonlinearity=self._output_nonlinearity,
AttributeError: 'NNDiscriminatorFunction' object has no attribute '_output_nonlinearity'

I'm not sure how to resolve this error because self._output_nonlinearity is defined for the parent class MLPFunction but not the child class NNDiscriminatorFunction, where get_output_for is called.

Thanks for reporting the issue. I'll take a look at this over the week and will let you know once I get it fixed. Sorry for the trouble.

Thanks for reporting the issue. I'll take a look at this over the week and will let you know once I get it fixed. Sorry for the trouble.

I think the issue seems to be with a version mismatch b/w the SAC code base and the DIAYN code base. For example, in the constructor of sac/algos/base.py, the old version seems to be consistent with the current sac/algos/diayn.py definition. The latest definition is inconsistent since __init__ requires sampler, control_interval and does not have max_path_length, min_pool_size and batch_size.

The training works after checking out commit 6b37e0165f5af549f2a6e463cc9b191ff8d62268.

I am facing a similar mismatch with the current commit. Checking out commit 6b37e01 still works for me — but not the current commit.

Hi,
I'm facing the same problem after I checking out commit 6b37e0165f5af549f2a6e463cc9b191ff8d62268
Screenshot from 2020-11-19 12-25-23

When I run python ./examples/mujoco_all_diayn.py --env=ant --log_dir="/home/lq/sac/data/swimmer-experiment"
I got the error:

Traceback (most recent call last):
  File "/home/lq/sac/rllab/scripts/run_experiment_lite.py", line 137, in <module>
    run_experiment(sys.argv)
  File "/home/lq/sac/rllab/scripts/run_experiment_lite.py", line 121, in run_experiment
    method_call(variant_data)
  File "./examples/mujoco_all_diayn.py", line 221, in run_experiment
    num_skills=variant['num_skills'],
  File "/home/lq/sac/sac/value_functions/value_function.py", line 72, in __init__
    self._output_t = self.get_output_for(*self._input_pls)
  File "/home/lq/sac/sac/misc/mlp.py", line 179, in get_output_for
    output_nonlinearity=self._output_nonlinearity,
AttributeError: 'NNDiscriminatorFunction' object has no attribute '_output_nonlinearity'

Can you give me some suggestions?
Thanks a lot!