haosulab / ManiSkill2-Learn

Apache License 2.0
80 stars 16 forks source link

ImportError: cannot import name 'DenseVolume' from 'warp.sim.model' #8

Open MDMLab223 opened 1 year ago

MDMLab223 commented 1 year ago

Compile

Version information

mani-skill2                   0.4.2
maniskill2-learn              1.8.0b0
warp-lang                     0.4.3

Compile command python -m warp_maniskill.build_lib --cuda_path /usr/local/cuda-11.3 --mode debug

Result:

Building /home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/warp_maniskill/warp/bin/warp.so
g++ -O0 -g -D_DEBUG -DWP_CPU -DWP_DISABLE_CUDA=0 -fPIC --std=c++11 -fkeep-inline-functions -I"/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/warp/native"  -I"/usr/local/cuda-11.3/include" -c "/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/warp_maniskill/warp/native/warp.cpp" -o "/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/warp_maniskill/warp/native/warp.cpp.o"
build took 1511.33 ms
"/usr/local/cuda-11.3/bin/nvcc" -g -G -O0 --compiler-options -fPIC -D_DEBUG -D_ITERATOR_DEBUG_LEVEL=0 -line-info -gencode=arch=compute_52,code=compute_52 -gencode=arch=compute_70,code=compute_70 -DWP_CUDA -I"/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/warp/native" -o "/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/warp_maniskill/warp/native/warp.cu.o" -c "/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/warp_maniskill/warp/native/warp.cu"
/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/warp_maniskill/warp/native/intersect_adj.h(119): warning: variable "adj_11" was declared but never referenced

/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/warp_maniskill/warp/native/intersect_adj.h(120): warning: variable "adj_12" was declared but never referenced

/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/warp_maniskill/warp/native/intersect_adj.h(121): warning: variable "adj_13" was declared but never referenced

/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/warp_maniskill/warp/native/intersect_adj.h(119): warning: variable "adj_11" was declared but never referenced

/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/warp_maniskill/warp/native/intersect_adj.h(120): warning: variable "adj_12" was declared but never referenced

/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/warp_maniskill/warp/native/intersect_adj.h(121): warning: variable "adj_13" was declared but never referenced

build_cuda took 8265.88 ms
g++ -shared -Wl,-rpath,'$ORIGIN' -Wl,--no-undefined -o '/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/warp_maniskill/warp/bin/warp.so' "/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/warp_maniskill/warp/native/warp.cpp.o" "/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/warp_maniskill/warp/native/warp.cu.o" -L"/usr/local/cuda-11.3/lib64" -lcudart_static -lnvrtc -lpthread -ldl -lrt
link took 87.10 ms

RUN

Command:

CUDA_VISIBLE_DEVICES=0 python maniskill2_learn/apis/run_rl.py configs/brl/bc/pointnet_soft_body.py \
            --work-dir ./ --gpu-ids 0 \
            --cfg-options "env_cfg.env_name=Excavate-v0" "env_cfg.obs_mode=pointcloud" \
            "env_cfg.control_mode=pd_joint_delta_pos" \
            "eval_cfg.num=100" "eval_cfg.num_procs=4" "eval_cfg.save_traj=False" "eval_cfg.save_video=True" \
            --evaluation --resume-from maniskill2_learn_pretrained_models_videos/Excavate_pcd/model_final.ckpt

Result:

CUDA_VISIBLE_DEVICES=0 python maniskill2_learn/apis/run_rl.py configs/brl/bc/pointnet_soft_body.py \
            --work-dir ./ --gpu-ids 0 \
            --cfg-options "env_cfg.env_name=Excavate-v0" "env_cfg.obs_mode=pointcloud" \
            "env_cfg.control_mode=pd_joint_delta_pos" \
            "eval_cfg.num=100" "eval_cfg.num_procs=4" "eval_cfg.save_traj=False" "eval_cfg.save_video=True" \
            --evaluation --resume-from maniskill2_learn_pretrained_models_videos/Excavate_pcd/model_final.ckpt
maniskill2_learn - (run_rl.py:179) - INFO - 2023-04-12,21:09:22 - Get 1 checkpoint ['maniskill2_learn_pretrained_models_videos/Excavate_pcd/model_final.ckpt'].
maniskill2_learn - (run_rl.py:180) - INFO - 2023-04-12,21:09:22 - Check checkpoint ['maniskill2_learn_pretrained_models_videos/Excavate_pcd/model_final.ckpt']!
Excavate-v0-eval - (run_rl.py:346) - INFO - 2023-04-12,21:09:23 - Config:
agent_cfg = dict(
    type='BC',
    batch_size=256,
    actor_cfg=dict(
        type='ContinuousActor',
        head_cfg=dict(
            type='GaussianHead',
            init_log_std=-0.5,
            clip_return=True,
            predict_std=False),
        nn_cfg=dict(
            type='Visuomotor',
            visual_nn_cfg=dict(
                type='PointNet',
                feat_dim='pcd_all_channel',
                mlp_spec=[64, 128, 512],
                feature_transform=[]),
            mlp_cfg=dict(
                type='LinearMLP',
                norm_cfg=None,
                mlp_spec=['512 + agent_shape', 256, 256, 'action_shape'],
                inactivated_output=True,
                zero_init_output=True)),
        optim_cfg=dict(type='Adam', lr=0.0003)))
env_cfg = dict(
    type='gym',
    env_name='Excavate-v0',
    unwrapped=False,
    obs_mode='pointcloud',
    control_mode='pd_joint_delta_pos',
    device='cuda:0')
replay_cfg = dict(
    type='ReplayMemory',
    capacity=-1,
    num_samples=-1,
    keys=['obs', 'actions', 'dones', 'episode_dones'],
    buffer_filenames=['SOME_DEMO_FILE'])
train_cfg = dict(
    on_policy=False,
    total_steps=50000,
    warm_steps=0,
    n_steps=0,
    n_updates=500,
    n_eval=50000,
    n_checkpoint=50000)
eval_cfg = dict(
    type='Evaluation',
    num=100,
    num_procs=4,
    use_hidden_state=False,
    save_traj=False,
    save_video=True,
    use_log=False)
work_dir = None
resume_from = [
    'maniskill2_learn_pretrained_models_videos/Excavate_pcd/model_final.ckpt'
]
expert_replay_cfg = None
recent_traj_replay_cfg = None
rollout_cfg = None

Excavate-v0-eval - (run_rl.py:347) - INFO - 2023-04-12,21:09:23 - Set random seed to 698036777
Excavate-v0-eval - (run_rl.py:383) - INFO - 2023-04-12,21:09:23 - Build evaluation!
Excavate-v0-eval - (run_rl.py:392) - INFO - 2023-04-12,21:09:23 - Building evaluation: eval_cfg: {'type': 'Evaluation', 'num': 100, 'num_procs': 4, 'use_hidden_state': False, 'save_traj': False, 'save_video': True, 'use_log': False, 'env_cfg': {'type': 'gym', 'env_name': 'Excavate-v0', 'unwrapped': False, 'obs_mode': 'pointcloud', 'control_mode': 'pd_joint_delta_pos', 'device': 'cuda:0'}}
Evaluation-Excavate-v0-eval - (evaluation.py:540) - INFO - 2023-04-12,21:09:23 - Evaluation environments have seed in [903776726, 903776730)!
Excavate-v0-eval - (run_rl.py:402) - INFO - 2023-04-12,21:09:23 - Get obs shape!
Traceback (most recent call last):
  File "maniskill2_learn/apis/run_rl.py", line 487, in <module>
    main()
  File "maniskill2_learn/apis/run_rl.py", line 452, in main
    run_one_process(0, 1, args, cfg)
  File "maniskill2_learn/apis/run_rl.py", line 410, in run_one_process
    env_params = get_env_info(cfg.env_cfg)
  File "/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/ManiSkill2-Learn/maniskill2_learn/env/env_utils.py", line 83, in get_env_info
    vec_env = build_vec_env(env_cfg.copy()) if vec_env is None else vec_env
  File "/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/ManiSkill2-Learn/maniskill2_learn/env/env_utils.py", line 211, in build_vec_env
    import_env()
  File "/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/ManiSkill2-Learn/maniskill2_learn/env/env_utils.py", line 17, in import_env
    import mani_skill2.envs
  File "/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/mani_skill2/envs/__init__.py", line 4, in <module>
    from .mpm import *
  File "/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/mani_skill2/envs/mpm/__init__.py", line 2, in <module>
    from . import excavate_env
  File "/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/mani_skill2/envs/mpm/excavate_env.py", line 5, in <module>
    from mani_skill2.envs.mpm.base_env import MPMBaseEnv
  File "/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/mani_skill2/envs/mpm/base_env.py", line 26, in <module>
    from warp_maniskill.mpm.mpm_simulator import (
  File "/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/warp_maniskill/mpm/mpm_simulator.py", line 3, in <module>
    from mpm.mpm_model import MPMModelBuilder, mpm_collide, Mesh, DenseVolume
  File "/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/warp_maniskill/mpm/mpm_model.py", line 1, in <module>
    from warp.sim.model import Model, ModelBuilder, Vec3, Mesh, DenseVolume
ImportError: cannot import name 'DenseVolume' from 'warp.sim.model' (/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/warp/sim/model.py)
xuanlinli17 commented 1 year ago

Could you try interactive python: CUDA_VISIBLE_DEVICES=0 python and run the following:

import mani_skill2.envs, gym
env=gym.make('Excavate-v0', obs_mode='pointcloud')
obs=env.reset()
MDMLab223 commented 1 year ago

Command:

import mani_skill2.envs, gym

Result:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/mani_skill2/envs/__init__.py", line 4, in <module>
    from .mpm import *
  File "/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/mani_skill2/envs/mpm/__init__.py", line 2, in <module>
    from . import excavate_env
  File "/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/mani_skill2/envs/mpm/excavate_env.py", line 5, in <module>
    from mani_skill2.envs.mpm.base_env import MPMBaseEnv
  File "/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/mani_skill2/envs/mpm/base_env.py", line 26, in <module>
    from warp_maniskill.mpm.mpm_simulator import (
  File "/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/warp_maniskill/mpm/mpm_simulator.py", line 3, in <module>
    from mpm.mpm_model import MPMModelBuilder, mpm_collide, Mesh, DenseVolume
  File "/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/warp_maniskill/mpm/mpm_model.py", line 1, in <module>
    from warp.sim.model import Model, ModelBuilder, Vec3, Mesh, DenseVolume
ImportError: cannot import name 'DenseVolume' from 'warp.sim.model' (/home/rl/anaconda3/envs/mani38/lib/python3.8/site-packages/warp/sim/model.py)
xuanlinli17 commented 1 year ago

Could you reinstall maniskill2 from scratch in a new conda environment? This should be maniskill2 install problem instead of maniskill2-learn.

Also did you pip install warp? The warp referred by this command is different from the warp used in maniskill2, so you need to pip uninstall warp and then install maniskill2 warp.

xuanlinli17 commented 1 year ago

Hi MDMLab223,

Has the issue been resolved yet?

Noietch commented 7 months ago

i have the same question and what is the warp version?