Closed Lan131 closed 5 months ago
We forgot to annotate the git mtenv code in base.txt, which might have caused some errors. We've made a new commit to fix that.
And \$ seed \$ in Getting started should be replaced by any specific number such as 1,10,20 ...
For instance, the running code can be bash CMTA.sh 10
for seed=10
So after install base.txt, dev.txt, and gym I run and get ModuleNotFoundError: No module named 'mtenv'
If I try to run this line from base.txt:
"-e git+https://github.com/facebookresearch/mtenv.git@main#egg=mtenv[all] ` B5==0.7" or run this pip install -e git+https://github.com/facebookresearch/mtenv.git@main#egg=mtenv[all]==0.7
I get this error.
DEPRECATION: git+https://github.com/facebookresearch/mtenv.git@main#egg=mtenv[all]==0.7 contains an egg fragment with a non-PEP 508 name pip 25.0 will enforce this behaviour change. A possible replacement is to use the req @ url syntax, and remove the egg fragment. Discussion can be found at https://github.com/pypa/pip/issues/11617 Obtaining mtenv[all]==0.7 from git+https://github.com/facebookresearch/mtenv.git@main#egg=mtenv[all]==0.7 (from mtenv[all]==0.7) Updating ./src/mtenv clone (to revision main) Running command git fetch -q --tags Running command git reset --hard -q f9c52ad56c00bc3dff96b4e6c4979376aa24854b Preparing metadata (setup.py) ... error error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [78 lines of output]
Traceback (most recent call last):
File "/home/research/lanier.m/Desktop/CMTA-main/scripts/src/mtenv/mtenv/envs/control/setup.py", line 6, in
^
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/home/research/lanier.m/Desktop/CMTA-main/scripts/src/mtenv/setup.py", line 63, in <module>
setuptools.setup(
File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/setuptools/__init__.py", line 104, in setup
return distutils.core.setup(**attrs)
File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 185, in setup
return run_commands(dist)
File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
dist.run_commands()
File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
self.run_command(cmd)
File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/setuptools/dist.py", line 967, in run_command
super().run_command(command)
File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 314, in run
writer(self, ep.name, os.path.join(self.egg_info, ep.name))
File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 677, in write_pkg_info
metadata.write_pkg_info(cmd.egg_info)
File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/setuptools/_core_metadata.py", line 135, in write_pkg_info
self.write_pkg_file(f)
File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/setuptools/_core_metadata.py", line 205, in write_pkg_file
_write_requirements(self, file)
File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/setuptools/_core_metadata.py", line 228, in _write_requirements
r = _include_extra(req, extra, condition.strip())
File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/setuptools/_core_metadata.py", line 241, in _include_extra
r.marker = Marker(" and ".join(x for x in parts if x))
File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/setuptools/_vendor/packaging/markers.py", line 217, in __init__
raise InvalidMarker(str(e)) from e
setuptools.extern.packaging.markers.InvalidMarker: Expected a marker variable or quoted string
^
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed
× Encountered error while generating package metadata. ╰─> See above for output.
note: This is an issue with the package mentioned above, not pip. hint: See above for details.
Can you also please provide the scipy version used. Newer versions are incompatible with the provided numpy version and installing some of the pacakges will automaticlly install a newer version of scipy which is incompatible.
Since we modified mtenv, we should not pip install the mtenv library from github directly. After git clone our repository, we need to pip install -e src/mtenv/.
We'll add this in the Readme.
And the scipy version is 1.7.0 for our environment.
Thank you for that. Do I need to run anything prior to pip install -e src/mtenv/.
? When I download and run I get this error.
[lanier.m@ssh8 CMTA-main]$ pip install -e src/mtenv/ Obtaining file:///home/research/lanier.m/Desktop/CMTA-main/src/mtenv Preparing metadata (setup.py) ... error error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [21 lines of output]
Traceback (most recent call last):
File "/home/research/lanier.m/Desktop/CMTA-main/src/mtenv/mtenv/envs/control/setup.py", line 6, in
note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed
× Encountered error while generating package metadata. ╰─> See above for output.
note: This is an issue with the package mentioned above, not pip. hint: See above for details.
It looks like you need to add mtenv to PYTHONPATH, or you can try this: cd src/mtenv; pip install -e .
So when I do that and run it now I get a different error, but am able to install: mesg: ttyname failed: Inappropriate ioctl for device mesg: ttyname failed: Inappropriate ioctl for device setup: seed: 10 setup: metaworld algo: CMTA_info2500_mt10 base_path: /home/research/lanier.m/Desktop/CMTA-main/scripts dir_name: logs_fix save_dir: ${setup.base_path}/${setup.dir_name}/${setup.id} device: cuda:0 id: CMTA_info2500_mt10_seed_10 description: Sample Task tags: null git: commit_id: null has_uncommitted_changes: null issue_id: null date: '2024-03-18 13:35:43' slurm_id: '-1' debug: should_enable: false experiment: name: metaworld builder: target: mtrl.experiment.${experiment.name}.Experiment init_steps: 3000 num_train_steps: 2500000 eval_freq: 3000 num_eval_episodes: 1 should_resume: true eval_only: false random_pos: false save: model: retain_last_n: 1 buffer: should_save: true size_per_chunk: 15000 num_samples_to_save: -1 save_dir: ${setup.save_dir} save_video: true envs_to_exclude_during_training: null agent: name: state_sac encoder_feature_dim: 64 num_layers: 0 num_filters: 0 builder: target: mtrl.agent.sac.Agent actor_cfg: ${agent.actor} critic_cfg: ${agent.critic} multitask_cfg: ${agent.multitask} alpha_optimizer_cfg: ${agent.optimizers.alpha} actor_optimizer_cfg: ${agent.optimizers.actor} critic_optimizer_cfg: ${agent.optimizers.critic} discount: 0.99 init_temperature: 1.0 actor_update_freq: 1 critic_tau: 0.005 critic_target_update_freq: 1 encoder_tau: 0.05 actor: target: mtrl.agent.components.actor.Actor num_layers: 3 hidden_dim: 512 log_std_bounds:
[2024-03-18 13:35:44,101][default_logger][INFO] - {"setup": {"seed": 10, "setup": "metaworld", "algo": "CMTA_info2500_mt10", "base_path": "/home/research/lanier.m/Desktop/CMTA-main/scripts", "dir_name": "logs_fix", "save_dir": "${setup.base_path}/${setup.dir_name}/${setup.id}", "device": "cuda:0", "id": "CMTA_info2500_mt10_seed_10", "description": "Sample Task", "tags": null, "git": {"commit_id": null, "has_uncommitted_changes": null, "issue_id": null}, "date": "2024-03-18 13:35:43", "slurm_id": "-1", "debug": {"should_enable": false}}, "experiment": {"name": "metaworld", "builder": {"target": "mtrl.experiment.${experiment.name}.Experiment"}, "init_steps": 3000, "num_train_steps": 2500000, "eval_freq": 3000, "num_eval_episodes": 1, "should_resume": true, "eval_only": false, "random_pos": false, "save": {"model": {"retain_last_n": 1}, "buffer": {"should_save": true, "size_per_chunk": 15000, "num_samples_to_save": -1}}, "save_dir": "${setup.save_dir}", "save_video": true, "envs_to_exclude_during_training": null}, "agent": {"name": "state_sac", "encoder_feature_dim": 64, "num_layers": 0, "num_filters": 0, "builder": {"target": "mtrl.agent.sac.Agent", "actor_cfg": "${agent.actor}", "critic_cfg": "${agent.critic}", "multitask_cfg": "${agent.multitask}", "alpha_optimizer_cfg": "${agent.optimizers.alpha}", "actor_optimizer_cfg": "${agent.optimizers.actor}", "critic_optimizer_cfg": "${agent.optimizers.critic}", "discount": 0.99, "init_temperature": 1.0, "actor_update_freq": 1, "critic_tau": 0.005, "critic_target_update_freq": 1, "encoder_tau": 0.05}, "actor": {"target": "mtrl.agent.components.actor.Actor", "num_layers": 3, "hidden_dim": 512, "log_std_bounds": [-20, 2], "encoder_cfg": "${agent.encoder}", "multitask_cfg": "${agent.multitask}"}, "critic": {"target": "mtrl.agent.components.critic.Critic", "hidden_dim": "${agent.actor.hidden_dim}", "num_layers": "${agent.actor.num_layers}", "encoder_cfg": "${agent.encoder}", "multitask_cfg": "${agent.multitask}"}, "encoder": {"type_to_select": "moe", "identity": {"type": "identity", "feature_dim": "${agent.encoder_feature_dim}"}, "feedforward": {"type": "feedforward", "hidden_dim": 64, "num_layers": 2, "feature_dim": "${agent.encoder_feature_dim}", "should_tie_encoders": true}, "lstm": {"type": "lstm", "hidden_dim": 64, "num_layers": 2, "feature_dim": "${agent.encoder_feature_dim}", "should_tie_encoders": true}, "film": {"type": "film", "hidden_dim": 64, "num_layers": 2, "feature_dim": "${agent.encoder_feature_dim}", "should_tie_encoders": true}, "moe": {"type": "moe", "encoder_cfg": {"type": "feedforward", "hidden_dim": 64, "num_layers": 2, "feature_dim": "${agent.encoder_feature_dim}", "should_tie_encoders": true}, "num_experts": 6, "task_id_to_encoder_id_cfg": {"mode": "rnn_attention", "num_envs": "${env.num_envs}", "gate": {"embedding_dim": 64, "hidden_dim": 64, "num_layers": 2, "temperature": 1.0, "should_use_soft_attention": false, "topk": 2, "task_encoder_cfg": {"should_use_task_encoding": true, "should_detach_task_encoding": true}}, "attention": {"embedding_dim": 64, "hidden_dim": 64, "num_layers": 1, "temperature": 1.0, "should_use_soft_attention": true, "task_encoder_cfg": {"should_use_task_encoding": true, "should_detach_task_encoding": false}}, "rnn_attention": {"rnn_hidden_dim": 64, "hidden_dim": 64, "num_layers": 1, "temperature": 1.0, "should_use_soft_attention": true}, "cluster": {"env_name": "${env.name}", "task_description": "${env.description}", "ordered_task_list": "${env.ordered_task_list}", "mapping_cfg": "${agent.task_to_encoder_cluster}", "num_eval_episodes": "${experiment.num_eval_episodes}", "batch_size": "${replay_buffer.batch_size}"}, "identity": {"num_eval_episodes": "${experiment.num_eval_episodes}", "batch_size": "${replay_buffer.batch_size}"}, "ensemble": {"num_eval_episodes": "${experiment.num_eval_episodes}", "batch_size": "${replay_buffer.batch_size}"}}}, "factorized_moe": {"type": "fmoe", "encoder_cfg": "${agent.encoder.feedforward}", "num_factors": 2, "num_experts_per_factor": [5, 5]}, "pixel": {"type": "pixel", "feature_dim": "${agent.encoder_feature_dim}", "num_filters": "${agent.num_filters}", "num_layers": "${agent.num_layers}"}}, "transition_model": {"target": "mtrl.agent.components.transition_model.make_transition_model", "transition_cfg": {"type": "", "feature_dim": "${agent.encoder_feature_dim}", "layer_width": 512}, "multitask_cfg": "${agent.multitask}"}, "mask": {"num_tasks": "${env.num_envs}", "num_eval_episodes": "${experiment.num_eval_episodes}", "batch_size": "${replay_buffer.batch_size}"}, "multitask": {"num_envs": 10, "should_use_disentangled_alpha": true, "should_use_reweighting": false, "should_use_task_encoder": true, "should_use_multi_head_policy": false, "should_use_disjoint_policy": false, "should_use_attention_multi_head_policy": false, "task_encoder_cfg": {"model_cfg": {"target": "mtrl.agent.components.task_encoder.TaskEncoder", "pretrained_embedding_cfg": {"should_use": false, "path_to_load_from": "/workspace/S/lansiming/mtrl/metadata/task_embedding/roberta_small/${env.name}.json", "ordered_task_list": "${env.ordered_task_list}"}, "num_embeddings": "${agent.multitask.num_envs}", "embedding_dim": 64, "hidden_dim": 64, "num_layers": 1, "output_dim": 64}, "optimizer_cfg": "${agent.optimizers.actor}", "losses_to_train": ["critic", "transition_reward", "decoder", "task_encoder"]}, "multi_head_policy_cfg": {"mask_cfg": "${agent.mask}"}, "actor_cfg": {"should_condition_model_on_task_info": false, "should_condition_encoder_on_task_info": true, "should_concatenate_task_info_with_encoder": true, "moe_cfg": {"mode": "soft_modularization", "num_experts": 4, "should_use": false}}, "critic_cfg": "${agent.multitask.actor_cfg}"}, "gradnorm": {"alpha": 1.0}, "task_to_encoder_cluster": {"mt10": {"cluster": {"action_close": ["close"], "action_default": ["insert", "pick and place", "press", "reach"], "action_open": ["open"], "action_push": ["push"], "object_default": ["button", "door", "peg", "revolving joint"], "object_drawer": ["drawer"], "object_goal": ["goal"], "object_puck": ["puck"], "object_window": ["window"]}}, "mt50": {"cluster": {"action_close": ["close"], "action_default": ["insert", "pick and place", "press", "reach"], "action_open": ["open"], "action_push": ["push"], "object_default": ["button", "door", "peg", "revolving joint"], "object_drawer": ["drawer"], "object_goal": ["goal"], "object_puck": ["puck"], "object_window": ["window"]}}}, "optimizers": {"actor": {"target": "torch.optim.Adam", "lr": 0.0003, "betas": [0.9, 0.999]}, "alpha": {"target": "torch.optim.Adam", "lr": 0.0003, "betas": [0.9, 0.999]}, "critic": {"target": "torch.optim.Adam", "lr": 0.0003, "betas": [0.9, 0.999]}, "decoder": {"target": "torch.optim.Adam", "lr": 0.0003, "betas": [0.9, 0.999], "weight_decay": 1e-07}, "encoder": {"target": "torch.optim.Adam", "lr": 0.0003, "betas": [0.9, 0.999]}}}, "env": {"name": "metaworld-mt10", "num_envs": 10, "benchmark": {"target": "metaworld.MT10"}, "builder": {"make_kwargs": {"should_perform_reward_normalization": true}}, "dummy": {"target": "metaworld.MT1", "env_name": "pick-place-v1"}, "description": {"reach-v1": "Reach a goal position. Randomize the goal positions.", "push-v1": "Push the puck to a goal. Randomize puck and goal positions.", "pick-place-v1": "Pick and place a puck to a goal. Randomize puck and goal positions.", "door-open-v1": "Open a door with a revolving joint. Randomize door positions.", "drawer-open-v1": "Open a drawer. Randomize drawer positions.", "drawer-close-v1": "Push and close a drawer. Randomize the drawer positions.", "button-press-topdown-v1": "Press a button from the top. Randomize button positions.", "peg-insert-side-v1": "Insert a peg sideways. Randomize peg and goal positions.", "window-open-v1": "Push and open a window. Randomize window positions.", "window-close-v1": "Push and close a window. Randomize window positions."}, "ordered_task_list": null}, "replay_buffer": {"target": "mtrl.replay_buffer.ReplayBuffer", "env_obs_shape": null, "action_shape": null, "capacity": 5000000, "batch_size": 1280}, "logger": {"target": "mtrl.logger.Logger", "logger_dir": "${setup.save_dir}", "use_tb": false}, "metrics": {"train": [["episode", "E", "int", "average"], ["step", "S", "int", "average"], ["duration", "D", "time", "average"], ["hours", "T", "time", "average"], ["episode_reward", "R", "float", "average"], ["success", "Su", "float", "average"], ["batch_reward", "BR", "float", "average"], ["actor_loss", "ALOSS", "float", "average"], ["critic_loss", "CLOSS", "float", "average"], ["ae_loss", "RLOSS", "float", "average"], ["ae_transition_loss", null, "float", "average"], ["reward_loss", null, "float", "average"], ["actor_target_entropy", null, "float", "average"], ["actor_entropy", null, "float", "average"], ["alpha_loss", null, "float", "average"], ["alphavalue", null, "float", "average"], ["contrastive_loss", "MLOSS", "float", "average"], ["max_rat", "MR", "float", "average"], ["env_index", "ENV", "str", "constant"], ["episode_reward_envindex", "R_", "float", "average"], ["success_envindex", "Su_", "float", "average"], ["envindex", "ENV_", "str", "constant"], ["batch_reward_agentindex", null, "float", "average"], ["critic_loss_agentindex", "AGENT_", "float", "average"], ["actor_distilled_agent_loss_agentindex", null, "float", "average"], ["actor_loss_agentindex", null, "float", "average"], ["actor_target_entropy_agentindex", null, "float", "average"], ["actor_entropy_agentindex", null, "float", "average"], ["alpha_loss_agentindex", null, "float", "average"], ["alpha_value_agentindex", null, "float", "average"], ["ae_loss_agentindex", null, "float", "average"], ["info_nce_loss", "IN", "float", "average"], ["accuracy", null, "float", "average"]], "eval": [["episode", "E", "int", "average"], ["step", "S", "int", "average"], ["episode_reward", "R", "float", "average"], ["env_index", "ENV", "str", "constant"], ["success", "Su", "float", "average"], ["episode_reward_envindex", "R_", "float", "average"], ["success_envindex", "Su_", "float", "average"], ["envindex", "ENV_", "str", "constant"], ["batch_reward_agentindex", "AGENT_", "float", "average"]]}, "logbook": {"target": "ml_logger.logbook.make_config", "write_to_console": false, "logger_dir": "${setup.save_dir}", "create_multiple_log_files": false}, "status": "RUNNING", "logbook_id": "0", "logbook_timestamp": "01:35:44PM CDT Mar 18, 2024", "logbook_type": "metadata"}
Starting Experiment at Mon Mar 18 13:35:44 2024
torch version = 1.7.1+cu110
Traceback (most recent call last):
File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/hydra/_internal/utils.py", line 529, in _locate
module = import_module(mod)
File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/hydra/utils.py", line 61, in call type_or_callable = _locate(cls) File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/hydra/_internal/utils.py", line 532, in _locate raise ImportError(f"Error loading module '{path}'") from e ImportError: Error loading module 'metaworld.MT10'
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/hydra/utils.py", line 63, in call return _instantiate_class(type_or_callable, config, *args, *kwargs) File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/hydra/_internal/utils.py", line 500, in _instantiate_class return clazz(args, **final_kwargs) File "/home/research/lanier.m/Desktop/CMTA-main/mtrl/experiment/metaworld.py", line 20, in init super().init(config, experiment_id) File "/home/research/lanier.m/Desktop/CMTA-main/mtrl/experiment/multitask.py", line 27, in init super().init(config, experiment_id) File "/home/research/lanier.m/Desktop/CMTA-main/mtrl/experiment/experiment.py", line 33, in init self.envs, self.env_metadata = self.build_envs() File "/home/research/lanier.m/Desktop/CMTA-main/mtrl/experiment/metaworld.py", line 44, in build_envs benchmark = hydra.utils.instantiate(self.config.env.benchmark) File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/hydra/utils.py", line 70, in call raise HydraException(f"Error calling '{cls}' : {e}") from e hydra.errors.HydraException: Error calling 'metaworld.MT10' : Error loading module 'metaworld.MT10'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/research/lanier.m/Desktop/CMTA-main/scripts/../main.py", line 18, in
edit: this looks potentially related https://github.com/facebookresearch/mtrl/issues/11
I also got exactly same issue, any suggestions on how to fix this?
Before we can run our algorithm, we need to install metaworld successfully. You could find the solution in https://github.com/Farama-Foundation/Metaworld.
Installing the commit on the page gives me an error related to mujoco:
pip install git+https://github.com/Farama-Foundation/Metaworld.git@af8417bfc82a3e249b4b02156518d775f29eb289
Your repo doesn't specify which version you used. Using mujoco_py==2.0.2.8, properly downloading the binaries and exporting the path, installing cython<3 lets me install metaworld:
Package Version Editable project location
absl-py 2.1.0 antlr4-python3-runtime 4.8 cffi 1.16.0 cloudpickle 1.6.0 Cython 0.29.37 Farama-Notifications 0.0.4 fasteners 0.19 future 1.0.0 glfw 2.7.0 gym 0.17.3 hydra-core 1.0.5 hydra-submitit-launcher 1.0.1 imageio 2.9.0 imageio-ffmpeg 0.4.3 importlib_metadata 7.0.2 metaworld 0.0.0 mllogger 0.7 mtenv 1.0 /home/research/lanier.m/Desktop/CMTA-main/src/mtenv mujoco 2.3.7 mujoco-py 2.0.2.8 numpy 1.19.5 omegaconf 2.0.6 opencv-python 4.5.1.48 Pillow 7.1.0 pip 24.0 pycparser 2.21 pyglet 1.5.0 PyOpenGL 3.1.7 PyYAML 6.0.1 scipy 1.7.0 setuptools 65.5.0 submitit 1.5.1 termcolor 1.1.0 torch 1.7.1+cu110 torchvision 0.8.2+cu110 typing_extensions 4.10.0 wheel 0.42.0 zipp 3.18.1
However I get errors both running the code provided as well as importing metaworld in python in general: hydra.errors.HydraException: Error calling 'metaworld.MT10' : Error loading module 'metaworld.MT10'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/research/lanier.m/Desktop/CMTA-main/scripts/../main.py", line 18, in
import metaworld running build_ext building 'mujoco_py.cymj' extension gcc -pthread -B /home/research/lanier.m/miniconda3/envs/FairRL/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/research/lanier.m/miniconda3/envs/FairRL/include -fPIC -O2 -isystem /home/research/lanier.m/miniconda3/envs/FairRL/include -fPIC -I/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/mujoco_py -I/home/research/lanier.m/.mujoco/mujoco200/include -I/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/numpy/core/include -I/home/research/lanier.m/miniconda3/envs/FairRL/include/python3.9 -c /home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/mujoco_py/cymj.c -o /home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/mujoco_py/generated/_pyxbld_2.0.2.8_39_linuxcpuextensionbuilder/temp.linux-x86_64-cpython-39/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/mujoco_py/cymj.o -fopenmp -w /home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/mujoco_py/cymj.c: In function ‘pyx_f_9mujoco_py_4cymj_11PyMjvFigure__set’: /home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/mujoco_py/cymj.c:77666:91: error: subscripted value is neither array nor pointer nor vector pyx_t_1 = ((PyObject *)pyx_f_9mujoco_py_4cymjwrap_float_1d((&(pyx_v_p->linewidth[0])), 0x64)); if (unlikely(!pyx_t_1)) PYX_ERR(4, 3829, __pyx_L1_error) ^ /home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/mujoco_py/cymj.c: In function ‘pyx_pf_9mujoco_py_4cymj_11PyMjvFigure_9legendoff_get’: /home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/mujoco_py/cymj.c:78306:55: error: ‘mjvFigure’ {aka ‘struct _mjvFigure’} has no member named ‘legendoff’; did you mean ‘legendoffset’? pyx_t_1 = __Pyx_PyInt_From_int(pyx_v_self->ptr->legendoff); if (unlikely(!pyx_t_1)) PYX_ERR(4, 3860, pyx_L1_error) ^
~~~~ legendoffset /home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/mujoco_py/cymj.c: In function ‘__pyx_pf_9mujoco_py_4cymj_11PyMjvFigure_9legendoff_2set’: /home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/mujoco_py/cymj.c:78361:22: error: ‘mjvFigure’ {aka ‘struct _mjvFigure’} has no member named ‘legendoff’; did you mean ‘legendoffset’? pyx_v_self->ptr->legendoff = __pyx_v_x; ^~~~~ legendoffset Traceback (most recent call last): File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/setuptools/_distutils/unixccompiler.py", line 186, in _compile self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs) File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/setuptools/_distutils/ccompiler.py", line 1007, in spawn spawn(cmd, dry_run=self.dry_run, **kwargs) File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/setuptools/_distutils/spawn.py", line 70, in spawn raise DistutilsExecError( distutils.errors.DistutilsExecError: command '/usr/bin/gcc' failed with exit code 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "
Can you please provide the mujoco version used as well as any dependencies for that?
we use mujoco-py 2.1.2.14. Please refer to other tutorials to install metaworld and mujoco.
The metaworld commit provided is incompatible with that version of mujoco.
(FairRL) [lanier.m@ssh8 Desktop]$ pip install git+https://github.com/Farama-Foundation/Metaworld.git@af8417bfc82a3e249b4b02156518d775f29eb289 Collecting git+https://github.com/Farama-Foundation/Metaworld.git@af8417bfc82a3e249b4b02156518d775f29eb289 Cloning https://github.com/Farama-Foundation/Metaworld.git (to revision af8417bfc82a3e249b4b02156518d775f29eb289) to /tmp/pip-req-build-0rqdf4v1 Running command git clone --filter=blob:none --quiet https://github.com/Farama-Foundation/Metaworld.git /tmp/pip-req-build-0rqdf4v1 Running command git rev-parse -q --verify 'sha^af8417bfc82a3e249b4b02156518d775f29eb289' Running command git fetch -q https://github.com/Farama-Foundation/Metaworld.git af8417bfc82a3e249b4b02156518d775f29eb289 Running command git checkout -q af8417bfc82a3e249b4b02156518d775f29eb289 Resolved https://github.com/Farama-Foundation/Metaworld.git to commit af8417bfc82a3e249b4b02156518d775f29eb289 Preparing metadata (setup.py) ... done Requirement already satisfied: gym>=0.15.4 in /home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages (from metaworld==0.0.0) (0.17.3) Collecting mujoco-py<2.1,>=2.0 (from metaworld==0.0.0)
It automaticly tries to install a different version over the one existing. This doesn't appear reproducible.
I was able to get it running although I needed to install patchelf and info-nce-pytorch. Please close. Thank you for all your efforts.
First of all, if you pip install -r dev.txt or any of the other requirements files you get this notice:
DEPRECATION: git+https://github.com/facebookresearch/mtenv.git@main#egg=mtenv[all] contains an egg fragment with a non-PEP 508 name pip 25.0 will enforce this behaviour change. A possible replacement is to use the req @ url syntax, and remove the egg fragment. Discussion can be found at https://github.com/pypa/pip/issues/11617
Installing all packages individually and running CMTA.sh I get this error
[2024-03-13 19:59:47,927][default_logger][INFO] - {"setup": {"seed": "", "setup": "metaworld", "algo": "CMTA_info2500_mt10", "base_path": "/home/research/lanier.m/Desktop/CMTA-main/scripts", "dir_name": "logs_fix", "save_dir": "${setup.base_path}/${setup.dir_name}/${setup.id}", "device": "cuda:0", "id": "CMTA_info2500_mt10seed", "description": "Sample Task", "tags": null, "git": {"commit_id": null, "has_uncommitted_changes": null, "issue_id": null}, "date": "2024-03-13 19:59:47", "slurm_id": "-1", "debug": {"should_enable": false}}, "experiment": {"name": "metaworld", "builder": {"target": "mtrl.experiment.${experiment.name}.Experiment"}, "init_steps": 3000, "num_train_steps": 2500000, "eval_freq": 3000, "num_eval_episodes": 1, "should_resume": true, "eval_only": false, "random_pos": false, "save": {"model": {"retain_last_n": 1}, "buffer": {"should_save": true, "size_per_chunk": 15000, "num_samples_to_save": -1}}, "save_dir": "${setup.save_dir}", "save_video": true, "envs_to_exclude_during_training": null}, "agent": {"name": "state_sac", "encoder_feature_dim": 64, "num_layers": 0, "num_filters": 0, "builder": {"target": "mtrl.agent.sac.Agent", "actor_cfg": "${agent.actor}", "critic_cfg": "${agent.critic}", "multitask_cfg": "${agent.multitask}", "alpha_optimizer_cfg": "${agent.optimizers.alpha}", "actor_optimizer_cfg": "${agent.optimizers.actor}", "critic_optimizer_cfg": "${agent.optimizers.critic}", "discount": 0.99, "init_temperature": 1.0, "actor_update_freq": 1, "critic_tau": 0.005, "critic_target_update_freq": 1, "encoder_tau": 0.05}, "actor": {"target": "mtrl.agent.components.actor.Actor", "num_layers": 3, "hidden_dim": 512, "log_std_bounds": [-20, 2], "encoder_cfg": "${agent.encoder}", "multitask_cfg": "${agent.multitask}"}, "critic": {"target": "mtrl.agent.components.critic.Critic", "hidden_dim": "${agent.actor.hidden_dim}", "num_layers": "${agent.actor.num_layers}", "encoder_cfg": "${agent.encoder}", "multitask_cfg": "${agent.multitask}"}, "encoder": {"type_to_select": "moe", "identity": {"type": "identity", "feature_dim": "${agent.encoder_feature_dim}"}, "feedforward": {"type": "feedforward", "hidden_dim": 64, "num_layers": 2, "feature_dim": "${agent.encoder_feature_dim}", "should_tie_encoders": true}, "lstm": {"type": "lstm", "hidden_dim": 64, "num_layers": 2, "feature_dim": "${agent.encoder_feature_dim}", "should_tie_encoders": true}, "film": {"type": "film", "hidden_dim": 64, "num_layers": 2, "feature_dim": "${agent.encoder_feature_dim}", "should_tie_encoders": true}, "moe": {"type": "moe", "encoder_cfg": {"type": "feedforward", "hidden_dim": 64, "num_layers": 2, "feature_dim": "${agent.encoder_feature_dim}", "should_tie_encoders": true}, "num_experts": 6, "task_id_to_encoder_id_cfg": {"mode": "rnn_attention", "num_envs": "${env.num_envs}", "gate": {"embedding_dim": 64, "hidden_dim": 64, "num_layers": 2, "temperature": 1.0, "should_use_soft_attention": false, "topk": 2, "task_encoder_cfg": {"should_use_task_encoding": true, "should_detach_task_encoding": true}}, "attention": {"embedding_dim": 64, "hidden_dim": 64, "num_layers": 1, "temperature": 1.0, "should_use_soft_attention": true, "task_encoder_cfg": {"should_use_task_encoding": true, "should_detach_task_encoding": false}}, "rnn_attention": {"rnn_hidden_dim": 64, "hidden_dim": 64, "num_layers": 1, "temperature": 1.0, "should_use_soft_attention": true}, "cluster": {"env_name": "${env.name}", "task_description": "${env.description}", "ordered_task_list": "${env.ordered_task_list}", "mapping_cfg": "${agent.task_to_encoder_cluster}", "num_eval_episodes": "${experiment.num_eval_episodes}", "batch_size": "${replay_buffer.batch_size}"}, "identity": {"num_eval_episodes": "${experiment.num_eval_episodes}", "batch_size": "${replay_buffer.batch_size}"}, "ensemble": {"num_eval_episodes": "${experiment.num_eval_episodes}", "batch_size": "${replay_buffer.batch_size}"}}}, "factorized_moe": {"type": "fmoe", "encoder_cfg": "${agent.encoder.feedforward}", "num_factors": 2, "num_experts_per_factor": [5, 5]}, "pixel": {"type": "pixel", "feature_dim": "${agent.encoder_feature_dim}", "num_filters": "${agent.num_filters}", "num_layers": "${agent.num_layers}"}}, "transition_model": {"target": "mtrl.agent.components.transition_model.make_transition_model", "transition_cfg": {"type": "", "feature_dim": "${agent.encoder_feature_dim}", "layer_width": 512}, "multitask_cfg": "${agent.multitask}"}, "mask": {"num_tasks": "${env.num_envs}", "num_eval_episodes": "${experiment.num_eval_episodes}", "batch_size": "${replay_buffer.batch_size}"}, "multitask": {"num_envs": 10, "should_use_disentangled_alpha": true, "should_use_reweighting": false, "should_use_task_encoder": true, "should_use_multi_head_policy": false, "should_use_disjoint_policy": false, "should_use_attention_multi_head_policy": false, "task_encoder_cfg": {"model_cfg": {"target": "mtrl.agent.components.task_encoder.TaskEncoder", "pretrained_embedding_cfg": {"should_use": false, "path_to_load_from": "/workspace/S/lansiming/mtrl/metadata/task_embedding/roberta_small/${env.name}.json", "ordered_task_list": "${env.ordered_task_list}"}, "num_embeddings": "${agent.multitask.num_envs}", "embedding_dim": 64, "hidden_dim": 64, "num_layers": 1, "output_dim": 64}, "optimizer_cfg": "${agent.optimizers.actor}", "losses_to_train": ["critic", "transition_reward", "decoder", "task_encoder"]}, "multi_head_policy_cfg": {"mask_cfg": "${agent.mask}"}, "actor_cfg": {"should_condition_model_on_task_info": false, "should_condition_encoder_on_task_info": true, "should_concatenate_task_info_with_encoder": true, "moe_cfg": {"mode": "soft_modularization", "num_experts": 4, "should_use": false}}, "critic_cfg": "${agent.multitask.actor_cfg}"}, "gradnorm": {"alpha": 1.0}, "task_to_encoder_cluster": {"mt10": {"cluster": {"action_close": ["close"], "action_default": ["insert", "pick and place", "press", "reach"], "action_open": ["open"], "action_push": ["push"], "object_default": ["button", "door", "peg", "revolving joint"], "object_drawer": ["drawer"], "object_goal": ["goal"], "object_puck": ["puck"], "object_window": ["window"]}}, "mt50": {"cluster": {"action_close": ["close"], "action_default": ["insert", "pick and place", "press", "reach"], "action_open": ["open"], "action_push": ["push"], "object_default": ["button", "door", "peg", "revolving joint"], "object_drawer": ["drawer"], "object_goal": ["goal"], "object_puck": ["puck"], "object_window": ["window"]}}}, "optimizers": {"actor": {"target": "torch.optim.Adam", "lr": 0.0003, "betas": [0.9, 0.999]}, "alpha": {"target": "torch.optim.Adam", "lr": 0.0003, "betas": [0.9, 0.999]}, "critic": {"target": "torch.optim.Adam", "lr": 0.0003, "betas": [0.9, 0.999]}, "decoder": {"target": "torch.optim.Adam", "lr": 0.0003, "betas": [0.9, 0.999], "weight_decay": 1e-07}, "encoder": {"target": "torch.optim.Adam", "lr": 0.0003, "betas": [0.9, 0.999]}}}, "env": {"name": "metaworld-mt10", "num_envs": 10, "benchmark": {"target": "metaworld.MT10"}, "builder": {"make_kwargs": {"should_perform_reward_normalization": true}}, "dummy": {"target": "metaworld.MT1", "env_name": "pick-place-v1"}, "description": {"reach-v1": "Reach a goal position. Randomize the goal positions.", "push-v1": "Push the puck to a goal. Randomize puck and goal positions.", "pick-place-v1": "Pick and place a puck to a goal. Randomize puck and goal positions.", "door-open-v1": "Open a door with a revolving joint. Randomize door positions.", "drawer-open-v1": "Open a drawer. Randomize drawer positions.", "drawer-close-v1": "Push and close a drawer. Randomize the drawer positions.", "button-press-topdown-v1": "Press a button from the top. Randomize button positions.", "peg-insert-side-v1": "Insert a peg sideways. Randomize peg and goal positions.", "window-open-v1": "Push and open a window. Randomize window positions.", "window-close-v1": "Push and close a window. Randomize window positions."}, "ordered_task_list": null}, "replay_buffer": {"target": "mtrl.replay_buffer.ReplayBuffer", "env_obs_shape": null, "action_shape": null, "capacity": 5000000, "batch_size": 1280}, "logger": {"target": "mtrl.logger.Logger", "logger_dir": "${setup.save_dir}", "use_tb": false}, "metrics": {"train": [["episode", "E", "int", "average"], ["step", "S", "int", "average"], ["duration", "D", "time", "average"], ["hours", "T", "time", "average"], ["episode_reward", "R", "float", "average"], ["success", "Su", "float", "average"], ["batch_reward", "BR", "float", "average"], ["actor_loss", "ALOSS", "float", "average"], ["critic_loss", "CLOSS", "float", "average"], ["ae_loss", "RLOSS", "float", "average"], ["ae_transition_loss", null, "float", "average"], ["reward_loss", null, "float", "average"], ["actor_target_entropy", null, "float", "average"], ["actor_entropy", null, "float", "average"], ["alpha_loss", null, "float", "average"], ["alphavalue", null, "float", "average"], ["contrastive_loss", "MLOSS", "float", "average"], ["max_rat", "MR", "float", "average"], ["env_index", "ENV", "str", "constant"], ["episode_reward_envindex", "R_", "float", "average"], ["success_envindex", "Su_", "float", "average"], ["envindex", "ENV_", "str", "constant"], ["batch_reward_agentindex", null, "float", "average"], ["critic_loss_agentindex", "AGENT_", "float", "average"], ["actor_distilled_agent_loss_agentindex", null, "float", "average"], ["actor_loss_agentindex", null, "float", "average"], ["actor_target_entropy_agentindex", null, "float", "average"], ["actor_entropy_agentindex", null, "float", "average"], ["alpha_loss_agentindex", null, "float", "average"], ["alpha_value_agentindex", null, "float", "average"], ["ae_loss_agentindex", null, "float", "average"], ["info_nce_loss", "IN", "float", "average"], ["accuracy", null, "float", "average"]], "eval": [["episode", "E", "int", "average"], ["step", "S", "int", "average"], ["episode_reward", "R", "float", "average"], ["env_index", "ENV", "str", "constant"], ["success", "Su", "float", "average"], ["episode_reward_envindex", "R_", "float", "average"], ["success_envindex", "Su_", "float", "average"], ["envindex", "ENV_", "str", "constant"], ["batch_reward_agentindex", "AGENT_", "float", "average"]]}, "logbook": {"target": "ml_logger.logbook.make_config", "write_to_console": false, "logger_dir": "${setup.save_dir}", "create_multiple_log_files": false}, "status": "RUNNING", "logbook_id": "0", "logbook_timestamp": "07:59:47PM CDT Mar 13, 2024", "logbook_type": "metadata"} Traceback (most recent call last): File "_mt19937.pyx", line 178, in numpy.random._mt19937.MT19937._legacy_seeding TypeError: 'str' object cannot be interpreted as an integer
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/hydra/_internal/utils.py", line 198, in run_and_report return func() File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/hydra/_internal/utils.py", line 347, in
lambda: hydra.run(
File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/hydra/_internal/hydra.py", line 107, in run
return run_job(
File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/hydra/core/utils.py", line 128, in run_job
ret.return_value = task_function(task_cfg)
File "/home/research/lanier.m/Desktop/CMTA-main/scripts/../main.py", line 14, in launch
return run(config)
File "/home/research/lanier.m/Desktop/CMTA-main/mtrl/app/run.py", line 37, in run
experiment_utils.prepare_and_run(config=config)
File "/home/research/lanier.m/Desktop/CMTA-main/mtrl/experiment/utils.py", line 20, in prepare_and_run
set_seed(seed=config.setup.seed)
File "/home/research/lanier.m/Desktop/CMTA-main/mtrl/utils/utils.py", line 89, in set_seed
np.random.seed(seed)
File "mtrand.pyx", line 244, in numpy.random.mtrand.RandomState.seed
File "_mt19937.pyx", line 166, in numpy.random._mt19937.MT19937._legacy_seeding
File "_mt19937.pyx", line 186, in numpy.random._mt19937.MT19937._legacy_seeding
TypeError: Cannot cast scalar from dtype('<U1') to dtype('int64') according to the rule 'safe'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/research/lanier.m/Desktop/CMTA-main/scripts/../main.py", line 18, in
launch()
File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/hydra/main.py", line 32, in decorated_main
_run_hydra(
File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/hydra/_internal/utils.py", line 346, in _run_hydra
run_and_report(
File "/home/research/lanier.m/miniconda3/envs/FairRL/lib/python3.9/site-packages/hydra/_internal/utils.py", line 237, in run_and_report
assert mdl is not None
AssertionError