unitree_rl_gym icon indicating copy to clipboard operation
unitree_rl_gym copied to clipboard

fail to load pre_trained model using sim2sim code

Open zzerann opened this issue 1 year ago • 1 comments

when I run the code, the problem is "python deploy/deploy_mujoco/deploy_mujoco.py g1.yaml 1 terminate called after throwing an instance of 'c10::Error' what(): isTuple()INTERNAL ASSERT FAILED at "../aten/src/ATen/core/ivalue_inl.h":1400, please report a bug to PyTorch. Expected Tuple but got String Exception raised from toTuple at ../aten/src/ATen/core/ivalue_inl.h:1400 (most recent call first): frame #0: c10::Error::Error(c10::SourceLocation, std::string) + 0x42 (0x7fdd83f24d62 in /home/zeran/miniconda3/envs/myenv/lib/python3.8/site-packages/torch/lib/libc10.so) frame #1: c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::string const&) + 0x5b (0x7fdd83f2168b in /home/zeran/miniconda3/envs/myenv/lib/python3.8/site-packages/torch/lib/libc10.so) frame #2: c10::detail::torchInternalAssertFail(char const*, char const*, unsigned int, char const*, std::string const&) + 0x3e (0x7fdd83f21bbe in /home/zeran/miniconda3/envs/myenv/lib/python3.8/site-packages/torch/lib/libc10.so) frame #3: + 0x3c8ed27 (0x7fddcb4a2d27 in /home/zeran/miniconda3/envs/myenv/lib/python3.8/site-packages/torch/lib/libtorch_cpu.so) frame #4: + 0x3c8fdc5 (0x7fddcb4a3dc5 in /home/zeran/miniconda3/envs/myenv/lib/python3.8/site-packages/torch/lib/libtorch_cpu.so) frame #5: torch::jit::SourceRange::highlight(std::ostream&) const + 0x36 (0x7fddc8b32976 in /home/zeran/miniconda3/envs/myenv/lib/python3.8/site-packages/torch/lib/libtorch_cpu.so) frame #6: torch::jit::ErrorReport::what() const + 0x2c5 (0x7fddc8b15885 in /home/zeran/miniconda3/envs/myenv/lib/python3.8/site-packages/torch/lib/libtorch_cpu.so) frame #7: + 0x2994ce (0x7fde4a8ed4ce in /home/zeran/miniconda3/envs/myenv/lib/python3.8/site-packages/torch/lib/libtorch_python.so) frame #8: + 0x2a7a85 (0x7fde4a8fba85 in /home/zeran/miniconda3/envs/myenv/lib/python3.8/site-packages/torch/lib/libtorch_python.so) frame #18: python() [0x5a5da1] frame #19: python() [0x5a4daf] frame #20: python() [0x45c624] frame #22: python() [0x44fcae] frame #24: __libc_start_main + 0xf3 (0x7fde8360f083 in /lib/x86_64-linux-gnu/libc.so.6) frame #25: python() [0x579f8d]

已放弃 (核心已转储) " and I debugging the code which I found out it comes from loading the model "m = mujoco.MjModel.from_xml_path(xml_path) d = mujoco.MjData(m) m.opt.timestep = simulation_dt print(1) # load policy policy = torch.jit.load(policy_path) print(22222222222)"

zzerann avatar Dec 03 '24 08:12 zzerann

The pytorch I am using is torch2.3.1+cu121

craipy-hub avatar Dec 03 '24 08:12 craipy-hub

Im also getting an error when running sim2sim pipeline, not sure what is the fix?

I updated the checkpoint in the g1.yaml. The same checkpoint works on isaacgym

python deploy/deploy_mujoco/deploy_mujoco.py g1.yaml

Traceback

Traceback (most recent call last):
  File "deploy/deploy_mujoco/deploy_mujoco.py", line 77, in <module>
    policy = torch.jit.load(policy_path)
  File "/home/youliang/miniconda3/envs/rl/lib/python3.8/site-packages/torch/jit/_serialization.py", line 158, in load
    cpp_module = torch._C.import_ir_module(cu, os.fspath(f), map_location, _extra_files, _restore_shapes)  # type: ignore[call-arg]
RuntimeError: PytorchStreamReader failed locating file constants.pkl: file not found

youliangtan avatar Jan 22 '25 00:01 youliangtan

you need to first play that checkpoint using legged gym and there will be a new .pt model outputted in the exported folder. Using this model for sim2sim

zzerann avatar Jan 22 '25 01:01 zzerann

you need to first play that checkpoint using legged gym and there will be a new .pt model outputted in the exported folder. Using this model for sim2sim

Hello,Can you explain this step in detail?

Rorschach7771 avatar Mar 10 '25 04:03 Rorschach7771