stepjam / TecNets

Official code for "Task-Embedded Control Networks for Few-Shot Imitation Learning".
Other
44 stars 10 forks source link

NameError: name 'EvalMilReach' is not defined #1

Closed suqianxin closed 5 years ago

suqianxin commented 5 years ago

When i run "./tecnets_corl_results.sh sim_reach",some problem appeared:

WARNING:tensorflow:From /home/suqianxin/gym/TecNets/consumers/margin_loss.py:14: calling reduce_sum (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version. Instructions for updating: keep_dims is deprecated, use keepdims instead Traceback (most recent call last): File "main_il.py", line 165, in eval = EvalMilReach(sess=p.get_session(), NameError: name 'EvalMilReach' is not defined

I don't know how to deal with this error ,could you please help me?Thank you.

suqianxin commented 5 years ago

I add the "from evaluation.eval_mil_reach import EvalMilReach" to the main_mil.py and the question is slove,i don't know if this is the right thing to do.But now a new error occur:

WARNING:tensorflow:From /home/suqianxin/gym/TecNets/consumers/margin_loss.py:14: calling reduce_sum (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version. Instructions for updating: keep_dims is deprecated, use keepdims instead 2019-09-04 11:14:11.321735: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA 2019-09-04 11:14:11.421994: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:895] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2019-09-04 11:14:11.422356: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1105] Found device 0 with properties: name: GeForce GTX 1060 6GB major: 6 minor: 1 memoryClockRate(GHz): 1.7085 pciBusID: 0000:01:00.0 totalMemory: 5.93GiB freeMemory: 4.95GiB 2019-09-04 11:14:11.422371: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1195] Creating TensorFlow device (/device:GPU:0) -> (device: 0, name: GeForce GTX 1060 6GB, pci bus id: 0000:01:00.0, compute capability: 6.1) Traceback (most recent call last): File "/home/suqianxin/gym/gym/envs/registration.py", line 132, in spec return self.env_specs[id] KeyError: 'ReacherMILTest-v1'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "main_il.py", line 175, in render=False) File "/home/suqianxin/gym/TecNets/evaluation/eval_mil_reach.py", line 18, in init self.env = gym.make('ReacherMILTest-v1') File "/home/suqianxin/gym/gym/envs/registration.py", line 156, in make return registry.make(id, **kwargs) File "/home/suqianxin/gym/gym/envs/registration.py", line 100, in make spec = self.spec(path) File "/home/suqianxin/gym/gym/envs/registration.py", line 142, in spec raise error.UnregisteredEnv('No registered env with id: {}'.format(id)) gym.error.UnregisteredEnv: No registered env with id: ReacherMILTest-v1

How to handle this error?Look forward to someone's help.Thank you.

suqianxin commented 5 years ago

I have made a mistake that i didn't switch to the mil.When i switch to the mil ,the error above is sloved.But now i meet a new question,like this:

Traceback (most recent call last): File "/home/suqianxin/gym/gym/envs/mujoco/mujoco_env.py", line 12, in from mujoco_py.mjlib import mjlib ImportError: No module named 'mujoco_py.mjlib'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "main_il.py", line 178, in render=False) File "/home/suqianxin/gym/TecNets/evaluation/eval_mil_reach.py", line 18, in init self.env = gym.make('ReacherMILTest-v1') File "/home/suqianxin/gym/gym/envs/registration.py", line 164, in make return registry.make(id) File "/home/suqianxin/gym/gym/envs/registration.py", line 122, in make env = spec.make() File "/home/suqianxin/gym/gym/envs/registration.py", line 88, in make cls = load(self._entry_point) File "/home/suqianxin/gym/gym/envs/registration.py", line 17, in load result = entry_point.load(False) File "/home/suqianxin/anaconda3/envs/gymlab/lib/python3.5/site-packages/pkg_resources/init.py", line 2434, in load return self.resolve() File "/home/suqianxin/anaconda3/envs/gymlab/lib/python3.5/site-packages/pkg_resources/init.py", line 2440, in resolve module = import(self.module_name, fromlist=['name'], level=0) File "/home/suqianxin/gym/gym/envs/mujoco/init.py", line 1, in from gym.envs.mujoco.mujoco_env import MujocoEnv File "/home/suqianxin/gym/gym/envs/mujoco/mujoco_env.py", line 14, in raise error.DependencyNotInstalled("{}. (HINT: you need to install mujoco_py, and also perform the setup instructions here: https://github.com/openai/mujoco-py/.)".format(e)) gym.error.DependencyNotInstalled: No module named 'mujoco_py.mjlib'. (HINT: you need to install mujoco_py, and also perform the setup instructions here: https://github.com/openai/mujoco-py/.)

I have been searching for a long time and have not found a solution.How can I solve the problem? Thanks!

suqianxin commented 5 years ago

When i use gym's branch mil ,the version of gym is 0.9.3 and the mujoco version 131,mujoco_py version is 0.5.7.The problem is sloved.

nevakanezzar commented 4 years ago

Hey @suqianxin -- I'm trying to get this to work ; I have got the right mujoco and mujoco_py, but it still doesn't work. I don't understand why you need to install gym to a specific version, don't we just need to use tianheyu's gym @ mil branch (and @stepjam says this doesn't need to be installed, it can just be on the pythonpath). Please advise exactly what you did if you have a moment, it will help a lot.

For reference, I am getting this error:

Traceback (most recent call last):
  File "main_il.py", line 89, in <module>
    from evaluation.eval_mil_push import EvalMilPush
  File "/home/user/TecNets/evaluation/eval_mil_push.py", line 4, in <module>
    from gym.envs.mujoco.pusher import PusherEnv
  File "/home/user/tianheyu-gym/gym/gym/envs/mujoco/__init__.py", line 1, in <module>
    from gym.envs.mujoco.mujoco_env import MujocoEnv
  File "/home/user/tianheyu-gym/gym/gym/envs/mujoco/mujoco_env.py", line 11, in <module>
    import mujoco_py
  File "/home/user/env/lib/python3.7/site-packages/mujoco_py/__init__.py", line 4, in <module>
    from .mjviewer import MjViewer
  File "/home/user/env/lib/python3.7/site-packages/mujoco_py/mjviewer.py", line 7, in <module>
    from . import mjcore, mjconstants, glfw
  File "/home/user/env/lib/python3.7/site-packages/mujoco_py/mjcore.py", line 6, in <module>
    from .mjlib import mjlib
  File "/home/user/env/lib/python3.7/site-packages/mujoco_py/mjlib.py", line 23, in <module>
    mjlib.mj_loadXML.argtypes = [String, String, c_char_p, c_int]
TypeError: item 1 in _argtypes_ passes a union by value, which is unsupported.
nevakanezzar commented 4 years ago

Further investigation leads to deep changes made within Python itself on how it handles some C stuff: In order to correct this bug: https://bugs.python.org/issue16575 They made this change: https://github.com/python/cpython/commit/79d4ed102a5069c6cebaed2627cb1645637f0429#diff-998bfefaefe2ab83d5f523e18f158fa4 That has broken a lot stuff in Python 3.7.6 -- 3.8.1. Apparently it will be fixed in 3.8.2, but I don't know. Examples of stuff it has broken: https://github.com/davidjamesca/ctypesgen/issues/77 https://github.com/pyglet/pyglet/issues/112