-
Notifications
You must be signed in to change notification settings - Fork 19
Failed to run some projects #165
Description
Sorry to bother you, for some reason many of my projects fail, such as fqf、iqn、qrdqn、tfa_counterfactual
I use code like bazel run //examples:Project to run these.The following are some error details, I do not know how to solve.
But among these items, I care most about item tfa_counterfactual. If you can solve my questions, I would be very grateful!
- bazel run //examples:fqf
Traceback (most recent call last):
File "/home/myx/.cache/bazel/_bazel_myx/d2a33cf9a94393d7ef91227effa0186e/execroot/bark_ml/bazel-out/k8-fastbuild/bin/examples/fqf.runfiles/bark_ml/examples/fqf.py", line 58, in <module>
app.run(run_configuration)
File "/home/myx/anaconda3/envs/bark-ml/lib/python3.7/site-packages/absl/app.py", line 308, in run
_run_main(main, args)
File "/home/myx/anaconda3/envs/bark-ml/lib/python3.7/site-packages/absl/app.py", line 254, in _run_main
sys.exit(main(argv))
File "/home/myx/.cache/bazel/_bazel_myx/d2a33cf9a94393d7ef91227effa0186e/execroot/bark_ml/bazel-out/k8-fastbuild/bin/examples/fqf.runfiles/bark_ml/examples/fqf.py", line 39, in run_configuration
agent = FQFAgent(env=env, test_env=env, params = params)
File "/home/myx/.cache/bazel/_bazel_myx/d2a33cf9a94393d7ef91227effa0186e/execroot/bark_ml/bazel-out/k8-fastbuild/bin/examples/fqf.runfiles/bark_ml/bark_ml/library_wrappers/lib_fqf_iqn_qrdqn/agent/fqf_agent.py", line 24, in __init__
super(FQFAgent, self).__init__(*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'test_env'
I try to modify the code in fqf.py. Change agent = FQFAgent(env=env, test_env=env, params = params) to agent = FQFAgent(env=env, params = params), but new error occurs.
AttributeError: attempted to get missing private attribute '_observer'
In base_agent.py, there has a function,but error will say that no attribute '_observer' and '_ml_behavior'
def reset_action_observer(self, env):
self._observer = self._env._observer
self._ml_behavior = self._env._ml_behavior
- bazel run //examples:iqn
Traceback (most recent call last):
File "/home/myx/.cache/bazel/_bazel_myx/d2a33cf9a94393d7ef91227effa0186e/execroot/bark_ml/bazel-out/k8-fastbuild/bin/examples/iqn.runfiles/bark_ml/examples/iqn.py", line 57, in <module>
app.run(run_configuration)
File "/home/myx/anaconda3/envs/bark-ml/lib/python3.7/site-packages/absl/app.py", line 308, in run
_run_main(main, args)
File "/home/myx/anaconda3/envs/bark-ml/lib/python3.7/site-packages/absl/app.py", line 254, in _run_main
sys.exit(main(argv))
File "/home/myx/.cache/bazel/_bazel_myx/d2a33cf9a94393d7ef91227effa0186e/execroot/bark_ml/bazel-out/k8-fastbuild/bin/examples/iqn.runfiles/bark_ml/examples/iqn.py", line 37, in run_configuration
env = gym.make(FLAGS.env, params=params)
File "/home/myx/anaconda3/envs/bark-ml/lib/python3.7/site-packages/gym/envs/registration.py", line 676, in make
return registry.make(id, **kwargs)
File "/home/myx/anaconda3/envs/bark-ml/lib/python3.7/site-packages/gym/envs/registration.py", line 490, in make
versions = self.env_specs.versions(namespace, name)
File "/home/myx/anaconda3/envs/bark-ml/lib/python3.7/site-packages/gym/envs/registration.py", line 220, in versions
self._assert_name_exists(namespace, name)
File "/home/myx/anaconda3/envs/bark-ml/lib/python3.7/site-packages/gym/envs/registration.py", line 297, in _assert_name_exists
raise error.NameNotFound(message)
gym.error.NameNotFound: Environment `highway` doesn't exist.
I add import bark_ml.environments.gym in iqn.py, but new error occurs.
RuntimeError: Unable to cast Python instance of type <class 'float'> to C++ type 'int'
- bazel run //examples:qrdqn
This is the same mistake, but I don't know how to solove it.
RuntimeError: Unable to cast Python instance of type <class 'float'> to C++ type 'int'
- bazel run //examples:tfa_counterfactual
File "/home/myx/.cache/bazel/_bazel_myx/d2a33cf9a94393d7ef91227effa0186e/execroot/bark_ml/bazel-out/k8-fastbuild/bin/examples/tfa_counterfactual.runfiles/bark_ml/bark_ml/environments/counterfactual_runtime.py", line 254, in step
replaced_agent=cf_key, num_virtual_world=i)
File "/home/myx/.cache/bazel/_bazel_myx/d2a33cf9a94393d7ef91227effa0186e/execroot/bark_ml/bazel-out/k8-fastbuild/bin/examples/tfa_counterfactual.runfiles/bark_ml/bark_ml/environments/counterfactual_runtime.py", line 150, in SimulateWorld
local_tracer.Trace(eval_state, **kwargs)
TypeError: Trace() got an unexpected keyword argument 'replaced_agent'
Similar to fqf, I changed the code in counterfactual_runtime.py
self.SimulateWorld(
# cf_world[cf_key], local_tracer, N=self._cf_simulation_steps,replaced_agent=cf_key, num_virtual_world=i)
cf_world[cf_key], local_tracer, N=self._cf_simulation_steps)
self.SimulateWorld(
# gt_world, local_tracer, N=self._cf_simulation_steps,replaced_agent="None", num_virtual_world="None")
gt_world, local_tracer, N=self._cf_simulation_steps)
And new error occurs.
File "/home/myx/.cache/bazel/_bazel_myx/d2a33cf9a94393d7ef91227effa0186e/execroot/bark_ml/bazel-out/k8-fastbuild/bin/examples/tfa_counterfactual.runfiles/bark_ml/bark_ml/environments/counterfactual_runtime.py", line 169, in TraceCounterfactualWorldStats
collision_rate = local_tracer.collision_rate
AttributeError: 'Tracer' object has no attribute 'collision_rate'
I Find that Tracer import through from bark_ml.commons.tracer import Tracer,and in bark_ml/commons/tracer.py, the context as follows:
import pickle
class Tracer:
"""The tracer can be used to log certain values during episodes."""
def __init__(self, states=None, trace_history=True):
self._trace_history = trace_history
self._states = []
def Trace(self, eval_dict):
"""Traces and stores a state."""
if self._trace_history:
self._states.append(eval_dict)
def Reset(self):
self._trace_history = []