park-project / park

MIT License
218 stars 55 forks source link

test unit_test.py encounter error: no attribute pl_n_devs #12

Closed uoyevoli closed 4 years ago

uoyevoli commented 4 years ago

Hi, after i install package using setup.py, i run python setup.py install to do it, but when i run python unit_tests.py, i encounter these error, and i use conda environment and install tensorflow-gpu version, anyone have known it ? Thanks any way!

`====================================================================== ERROR: test_run_env_n_times (park.unittest.test_tf_placement.TestTFPlacement)

Traceback (most recent call last): File "/home/chenfp/projects/park/park/unittest/test_tf_placement.py", line 12, in test_run_env_n_times run_env_with_random_agent(self.env_name, seed=n) File "/home/chenfp/projects/park/park/unittest/run_env.py", line 9, in run_env_with_random_agent env = park.make(env_name) File "/home/chenfp/projects/park/park/envs/registration.py", line 77, in make return registry.make(env_id) File "/home/chenfp/projects/park/park/envs/registration.py", line 53, in make env = spec.make() File "/home/chenfp/projects/park/park/envs/registration.py", line 36, in make env = cls() File "/home/chenfp/projects/park/park/envs/tf_placement/tf_placement.py", line 31, in init TFPlacementSimEnv.init(self) File "/home/chenfp/projects/park/park/envs/tf_placement_sim/tf_placement_sim.py", line 57, in init self.setup_env() File "/home/chenfp/projects/park/park/envs/tf_placement_sim/tf_placement_sim.py", line 75, in setup_env device_names = ['/device:GPU:%d' % i for i in range(config.pl_n_devs)] AttributeError: 'Namespace' object has no attribute 'pl_n_devs'

====================================================================== ERROR: test_run_env_n_times (park.unittest.test_tf_placement_sim.TestTFPlacementSim)

Traceback (most recent call last): File "/home/chenfp/projects/park/park/unittest/test_tf_placement_sim.py", line 12, in test_run_env_n_times run_env_with_random_agent(self.env_name, seed=n) File "/home/chenfp/projects/park/park/unittest/run_env.py", line 9, in run_env_with_random_agent env = park.make(env_name) File "/home/chenfp/projects/park/park/envs/registration.py", line 77, in make return registry.make(env_id) File "/home/chenfp/projects/park/park/envs/registration.py", line 53, in make env = spec.make() File "/home/chenfp/projects/park/park/envs/registration.py", line 36, in make env = cls() File "/home/chenfp/projects/park/park/envs/tf_placement_sim/tf_placement_sim.py", line 57, in init self.setup_env() File "/home/chenfp/projects/park/park/envs/tf_placement_sim/tf_placement_sim.py", line 75, in setup_env device_names = ['/device:GPU:%d' % i for i in range(config.pl_n_devs)] AttributeError: 'Namespace' object has no attribute 'pl_n_devs'


Ran 2 tests in 1.816s

FAILED (errors=2)`

uoyevoli commented 4 years ago

Have solved this problem

  1. conda environment
  2. conda create -n park python=3.6 tensorflow-gpu=1.9 main reason is python and tensorlfow-gpu version, in addition, tf_placement_sim.py, config.pl_graph and config.pl_n_devs need to be defined in advanced!