diffneusim 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- diffneusim/__init__.py +1 -0
- diffneusim/_cache.py +42 -0
- diffneusim/_paths.py +5 -0
- diffneusim/bindings/rew14_ext.cu +115 -0
- diffneusim/bindings/soft14_capi.cpp +443 -0
- diffneusim/bindings/soft14_engine_ext.cu +596 -0
- diffneusim/bindings/soft_capi.cpp +782 -0
- diffneusim/bindings/soft_engine_ext.cu +495 -0
- diffneusim/core/cpu_engine/build.sh +40 -0
- diffneusim/core/cpu_engine/fiber/cuda_runtime.h +445 -0
- diffneusim/core/cpu_engine/x14_cpu.cpp +283 -0
- diffneusim/core/diff/dual.h +126 -0
- diffneusim/core/include/diffneusim/macros.h +35 -0
- diffneusim/core/kin/kinematic_tree.h +273 -0
- diffneusim/core/math/so3.h +182 -0
- diffneusim/core/soft/adj/out_adj.h +102 -0
- diffneusim/core/soft/adj/rnea_adj.h +425 -0
- diffneusim/core/soft/adj/rows_adj.h +439 -0
- diffneusim/core/soft/adj/rows_functor.h +89 -0
- diffneusim/core/soft/adj/rows_lanes.h +443 -0
- diffneusim/core/soft/adj/shell_adj.h +243 -0
- diffneusim/core/soft/adj/tree_adj.h +356 -0
- diffneusim/core/soft/collide.h +183 -0
- diffneusim/core/soft/gpu/adj14.cuh +233 -0
- diffneusim/core/soft/gpu/adj14_mus.cuh +98 -0
- diffneusim/core/soft/gpu/adj_shell.cuh +50 -0
- diffneusim/core/soft/gpu/adj_tab.cuh +49 -0
- diffneusim/core/soft/gpu/body14.cuh +47 -0
- diffneusim/core/soft/gpu/chol_rn.cuh +458 -0
- diffneusim/core/soft/gpu/chol_small.cuh +123 -0
- diffneusim/core/soft/gpu/chol_split.cuh +193 -0
- diffneusim/core/soft/gpu/engine_launch.cuh +263 -0
- diffneusim/core/soft/gpu/fk_rn.cuh +109 -0
- diffneusim/core/soft/gpu/generated/body_019e20820f86_mmfloor.cuh +28 -0
- diffneusim/core/soft/gpu/generated/body_62f77a4bb16b_mmfloor.cuh +52 -0
- diffneusim/core/soft/gpu/generated/body_77dbb7213f26_mmfloor_rampsb3l_n6t12.cuh +28 -0
- diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rampsb3l_n6t12.cuh +28 -0
- diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rhlsd05_n6t12.cuh +28 -0
- diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rhlsdef_n6t12.cuh +28 -0
- diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rhlsmjd_n6t12.cuh +28 -0
- diffneusim/core/soft/gpu/generated/body_a1e8b196b2cd_mmfloor_rampsb3l_n6t12.cuh +52 -0
- diffneusim/core/soft/gpu/generated/body_a944653edd64_mmfloor.cuh +25 -0
- diffneusim/core/soft/gpu/generated/body_a944653edd64_mmfloor_rampsb3l_n6t12.cuh +25 -0
- diffneusim/core/soft/gpu/generated/g1_soft_5db44fd45286.cuh +74 -0
- diffneusim/core/soft/gpu/generated/split_62f77a4bb16b_mmfloor.cuh +18 -0
- diffneusim/core/soft/gpu/generated/split_a1e8b196b2cd_mmfloor_rampsb3l_n6t12.cuh +18 -0
- diffneusim/core/soft/gpu/generated/x14_soft_019e20820f86_mmfloor.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_62f77a4bb16b_mmfloor.cuh +129 -0
- diffneusim/core/soft/gpu/generated/x14_soft_77dbb7213f26_mmfloor_rampsb3l_n6t12.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rampsb3l_n6t12.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rhlsd05_n6t12.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rhlsdef_n6t12.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rhlsmjd_n6t12.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_a1e8b196b2cd_mmfloor_rampsb3l_n6t12.cuh +129 -0
- diffneusim/core/soft/gpu/generated/x14_soft_a944653edd64_mmfloor.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_a944653edd64_mmfloor_rampsb3l_n6t12.cuh +123 -0
- diffneusim/core/soft/gpu/k_mus.cuh +1038 -0
- diffneusim/core/soft/gpu/k_mus_host.cuh +377 -0
- diffneusim/core/soft/gpu/k_pre.cuh +52 -0
- diffneusim/core/soft/gpu/kernel_p.cuh +490 -0
- diffneusim/core/soft/gpu/kp14.cuh +465 -0
- diffneusim/core/soft/gpu/l2v2.cuh +367 -0
- diffneusim/core/soft/gpu/l2x14.cuh +319 -0
- diffneusim/core/soft/gpu/l3.cuh +1483 -0
- diffneusim/core/soft/gpu/model_view.cuh +48 -0
- diffneusim/core/soft/gpu/mus_case_fits.h +15 -0
- diffneusim/core/soft/gpu/mus_classes.h +182 -0
- diffneusim/core/soft/gpu/mus_row_cf.h +44 -0
- diffneusim/core/soft/gpu/rew14.cuh +177 -0
- diffneusim/core/soft/gpu/rows_ctab.cuh +44 -0
- diffneusim/core/soft/gpu/tree_m.cuh +247 -0
- diffneusim/core/soft/gpu/x14_engine_kernels.cuh +260 -0
- diffneusim/core/soft/gpu/x14_rowcf.h +14 -0
- diffneusim/core/soft/hand.h +124 -0
- diffneusim/core/soft/impedance.h +115 -0
- diffneusim/core/soft/jvp.h +202 -0
- diffneusim/core/soft/kin.h +250 -0
- diffneusim/core/soft/muscle.h +1208 -0
- diffneusim/core/soft/newton.h +371 -0
- diffneusim/core/soft/rows.h +176 -0
- diffneusim/core/soft/step.h +188 -0
- diffneusim/core/soft/tape.h +313 -0
- diffneusim/core/soft/x14/collide14.h +69 -0
- diffneusim/core/soft/x14/jvp14.h +182 -0
- diffneusim/core/soft/x14/law14.h +453 -0
- diffneusim/core/soft/x14adj/collide14_adj.h +134 -0
- diffneusim/core/soft/x14adj/passive14_adj.h +162 -0
- diffneusim/core/soft/x14adj/reward14.h +484 -0
- diffneusim/core/soft/x14adj/rows14_adj.h +400 -0
- diffneusim/core/soft/x14adj/scan14.h +349 -0
- diffneusim/core/soft/x14adj/shell14_adj.h +122 -0
- diffneusim/core/soft/x14adj/sweep14.h +255 -0
- diffneusim/core/soft/x14adj/tree14_adj.h +500 -0
- diffneusim/core/soft/x14adj/x14adj_common.h +96 -0
- diffneusim/data/mirror/H1622v2k_geyer_hfdeq.npz +0 -0
- diffneusim/data/mirror/H1622v2k_hfd.npz +0 -0
- diffneusim/data/mirror/H1622v2k_millard_hfdeq.npz +0 -0
- diffneusim/data/mirror/fullbody_contact.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_p2str.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_p2str_rigid.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_calf2_pe.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_axfix.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_axfixlegs01.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_jd01.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_jd01legs.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_jd01lumbar.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_lumbfix.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_lumbfixlegs01.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1a.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n2.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_rom23.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_hinge.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1a.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n2.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_rom23.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_lspine_girdle_osimeq.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_lspine_girdle_millard.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_lspine_girdle_osimeq.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_compound_g14eq.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30_hip30.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30_hip30_luispe.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30_hip30_trunk0701.npz +0 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_axfix.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_axfixlegs01.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_jd01.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_jd01legs.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_jd01lumbar.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_lumbfix.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_lumbfixlegs01.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_n1.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_n1a.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_n2.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_rom23.json +91 -0
- diffneusim/data/reference/musclemimic/myofullbody_mimic_sites.json +261 -0
- diffneusim/data/reference/pose3/pose3_scone.json +305 -0
- diffneusim/data/reference/pose3/pose3_scone.txt +3 -0
- diffneusim/data/reference/pose3/pose3_scone_gait.npz +0 -0
- diffneusim/data/reference/pose3/pose3_scone_mirror.npz +0 -0
- diffneusim/data/reference/pose3/pose3_scone_stand.npz +0 -0
- diffneusim/data/reference/x016run/MD5SUMS +241 -0
- diffneusim/data/reference/x016run/x016run_states.txt +240 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_r3.npz +0 -0
- diffneusim/data/state_prior/lumbar_poly_fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc.npz +0 -0
- diffneusim/engine/__init__.py +0 -0
- diffneusim/engine/build_tag.py +52 -0
- diffneusim/engine/case_tables.py +46 -0
- diffneusim/engine/d16_body.py +80 -0
- diffneusim/engine/engine14.py +367 -0
- diffneusim/engine/gen_split.py +159 -0
- diffneusim/engine/hand_format.py +69 -0
- diffneusim/engine/live14.py +149 -0
- diffneusim/engine/phase_b_tree.py +137 -0
- diffneusim/engine/soft14.py +130 -0
- diffneusim/engine/soft_capi.py +373 -0
- diffneusim/engine/soft_engine.py +165 -0
- diffneusim/engine/step14.py +132 -0
- diffneusim/engine/tape_format.py +89 -0
- diffneusim/engine/x14cpu.py +163 -0
- diffneusim/env/__init__.py +0 -0
- diffneusim/env/absent.py +20 -0
- diffneusim/env/cpu14.py +105 -0
- diffneusim/env/e0loop14.py +224 -0
- diffneusim/env/env14.py +568 -0
- diffneusim/env/kin_contact14.py +193 -0
- diffneusim/env/mimic_sites_x14.json +366 -0
- diffneusim/env/old_count.py +78 -0
- diffneusim/env/rew14.py +114 -0
- diffneusim/env/rew14_hook.py +105 -0
- diffneusim/g1/__init__.py +1 -0
- diffneusim/g1/arm_a2.py +165 -0
- diffneusim/g1/arm_a3.py +576 -0
- diffneusim/g1/read_a3.py +79 -0
- diffneusim/g1/rg1_read.py +89 -0
- diffneusim/model/__init__.py +66 -0
- diffneusim/model/case.py +17 -0
- diffneusim/model/dnmodel.py +79 -0
- diffneusim/model/fuse_fixed.py +281 -0
- diffneusim/model/monitor.py +834 -0
- diffneusim/models/BODIES.toml +48 -0
- diffneusim/models/MANIFEST.toml +979 -0
- diffneusim/models/cases/G290/case.bin +0 -0
- diffneusim/models/cases/G290/case.json +1 -0
- diffneusim/models/cases/G356-SRC/case.bin +0 -0
- diffneusim/models/cases/G356-SRC/case.json +1 -0
- diffneusim/models/cases/G416/case.bin +0 -0
- diffneusim/models/cases/G416/case.json +1 -0
- diffneusim/models/cases/M290C-SRC/case.bin +0 -0
- diffneusim/models/cases/M290C-SRC/case.json +1 -0
- diffneusim/models/cases/M290R-SRC/case.bin +0 -0
- diffneusim/models/cases/M290R-SRC/case.json +1 -0
- diffneusim/models/cases/M356C-SRC/case.bin +0 -0
- diffneusim/models/cases/M356C-SRC/case.json +1 -0
- diffneusim/models/cases/M356R-SRC/case.bin +0 -0
- diffneusim/models/cases/M356R-SRC/case.json +1 -0
- diffneusim/models/cases/M416C-SRC/case.bin +0 -0
- diffneusim/models/cases/M416C-SRC/case.json +1 -0
- diffneusim/models/derived/d16_expanded_62f77a4bb16b1e67_mmfloor.xml +673 -0
- diffneusim/models/derived/d16_expanded_a1e8b196b2cd7b3c_mmfloor.xml +673 -0
- diffneusim/models/derived/d16_soft_law_019e20820f8633b9_mmfloor.json +7844 -0
- diffneusim/models/derived/d16_soft_law_62f77a4bb16b1e67_mmfloor.json +16855 -0
- diffneusim/models/derived/d16_soft_law_77dbb7213f26e821_mmfloor_rampsb3l_n6t12.json +7883 -0
- diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rampsb3l_n6t12.json +7883 -0
- diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rhlsd05_n6t12.json +7868 -0
- diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rhlsdef_n6t12.json +7868 -0
- diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rhlsmjd_n6t12.json +7868 -0
- diffneusim/models/derived/d16_soft_law_a1e8b196b2cd7b3c_mmfloor_rampsb3l_n6t12.json +16894 -0
- diffneusim/models/derived/d16_soft_law_a944653edd642082_mmfloor.json +12655 -0
- diffneusim/models/derived/d16_soft_law_a944653edd642082_mmfloor_rampsb3l_n6t12.json +12700 -0
- diffneusim/models/derived/unitree_g1_soft_law.json +15580 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.dnmodel +28913 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid.dnmodel +29202 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_axfixlegs01.dnmodel +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.dnmodel +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.dnmodel +46970 -0
- diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.dnmodel +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.dnmodel +38570 -0
- diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid.dnmodel +38923 -0
- diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.dnmodel +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1_qk.txt +1 -0
- diffneusim/models/fullbody_meshes/1mc.stl +0 -0
- diffneusim/models/fullbody_meshes/2distph.stl +0 -0
- diffneusim/models/fullbody_meshes/2mc.stl +0 -0
- diffneusim/models/fullbody_meshes/2midph.stl +0 -0
- diffneusim/models/fullbody_meshes/2proxph.stl +0 -0
- diffneusim/models/fullbody_meshes/3distph.stl +0 -0
- diffneusim/models/fullbody_meshes/3mc.stl +0 -0
- diffneusim/models/fullbody_meshes/3midph.stl +0 -0
- diffneusim/models/fullbody_meshes/3proxph.stl +0 -0
- diffneusim/models/fullbody_meshes/4distph.stl +0 -0
- diffneusim/models/fullbody_meshes/4mc.stl +0 -0
- diffneusim/models/fullbody_meshes/4midph.stl +0 -0
- diffneusim/models/fullbody_meshes/4proxph.stl +0 -0
- diffneusim/models/fullbody_meshes/5distph.stl +0 -0
- diffneusim/models/fullbody_meshes/5mc.stl +0 -0
- diffneusim/models/fullbody_meshes/5midph.stl +0 -0
- diffneusim/models/fullbody_meshes/5proxph.stl +0 -0
- diffneusim/models/fullbody_meshes/NOTICE +2 -0
- diffneusim/models/fullbody_meshes/capitate.stl +0 -0
- diffneusim/models/fullbody_meshes/clavicle.stl +0 -0
- diffneusim/models/fullbody_meshes/hamate.stl +0 -0
- diffneusim/models/fullbody_meshes/hat_cervical.stl +0 -0
- diffneusim/models/fullbody_meshes/hat_jaw.stl +0 -0
- diffneusim/models/fullbody_meshes/hat_skull.stl +0 -0
- diffneusim/models/fullbody_meshes/humerus.stl +0 -0
- diffneusim/models/fullbody_meshes/l_bofoot.stl +0 -0
- diffneusim/models/fullbody_meshes/l_femur.stl +0 -0
- diffneusim/models/fullbody_meshes/l_fibula.stl +0 -0
- diffneusim/models/fullbody_meshes/l_foot.stl +0 -0
- diffneusim/models/fullbody_meshes/l_patella.stl +0 -0
- diffneusim/models/fullbody_meshes/l_pelvis.stl +0 -0
- diffneusim/models/fullbody_meshes/l_talus.stl +0 -0
- diffneusim/models/fullbody_meshes/l_tibia.stl +0 -0
- diffneusim/models/fullbody_meshes/lumbar1.stl +0 -0
- diffneusim/models/fullbody_meshes/lumbar2.stl +0 -0
- diffneusim/models/fullbody_meshes/lumbar3.stl +0 -0
- diffneusim/models/fullbody_meshes/lumbar4.stl +0 -0
- diffneusim/models/fullbody_meshes/lumbar5.stl +0 -0
- diffneusim/models/fullbody_meshes/lunate.stl +0 -0
- diffneusim/models/fullbody_meshes/pisiform.stl +0 -0
- diffneusim/models/fullbody_meshes/r_bofoot.stl +0 -0
- diffneusim/models/fullbody_meshes/r_femur.stl +0 -0
- diffneusim/models/fullbody_meshes/r_fibula.stl +0 -0
- diffneusim/models/fullbody_meshes/r_foot.stl +0 -0
- diffneusim/models/fullbody_meshes/r_patella.stl +0 -0
- diffneusim/models/fullbody_meshes/r_pelvis.stl +0 -0
- diffneusim/models/fullbody_meshes/r_talus.stl +0 -0
- diffneusim/models/fullbody_meshes/r_tibia.stl +0 -0
- diffneusim/models/fullbody_meshes/radius.stl +0 -0
- diffneusim/models/fullbody_meshes/sacrum.stl +0 -0
- diffneusim/models/fullbody_meshes/scaphoid.stl +0 -0
- diffneusim/models/fullbody_meshes/scapula.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic10_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic11_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic12_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic1_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic2_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic3_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic4_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic5_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic6_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic7_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic8_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic9_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thorax.stl +0 -0
- diffneusim/models/fullbody_meshes/thumbdist.stl +0 -0
- diffneusim/models/fullbody_meshes/thumbprox.stl +0 -0
- diffneusim/models/fullbody_meshes/trapezium.stl +0 -0
- diffneusim/models/fullbody_meshes/trapezoid.stl +0 -0
- diffneusim/models/fullbody_meshes/triquetrum.stl +0 -0
- diffneusim/models/fullbody_meshes/ulna.stl +0 -0
- diffneusim/models/source/myo_fullbody/UPSTREAM.md +91 -0
- diffneusim/models/source/myoleg/UPSTREAM.md +52 -0
- diffneusim/models/source/unitree_g1/LICENSE.mjlab +202 -0
- diffneusim/models/source/unitree_g1/UPSTREAM.md +38 -0
- diffneusim/models/source/unitree_g1/assets/head_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_ankle_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_ankle_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_elbow_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_hip_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_hip_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_hip_yaw_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_knee_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_rubber_hand.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_shoulder_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_shoulder_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_shoulder_yaw_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_wrist_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_wrist_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_wrist_yaw_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/logo_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/pelvis.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/pelvis_contour_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_ankle_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_ankle_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_elbow_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_hip_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_hip_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_hip_yaw_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_knee_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_rubber_hand.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_shoulder_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_shoulder_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_shoulder_yaw_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_wrist_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_wrist_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_wrist_yaw_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/torso_link_rev_1_0.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/waist_roll_link_rev_1_0.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/waist_yaw_link_rev_1_0.STL +0 -0
- diffneusim/models/source/unitree_g1/dump_mjlab_reference.py +30 -0
- diffneusim/models/source/unitree_g1/g1.xml +308 -0
- diffneusim/models/source/unitree_g1/g1_constants.py +298 -0
- diffneusim/models/source/unitree_g1/mjlab_compiled_reference.json +857 -0
- diffneusim/models/unitree_g1.dnmodel +4393 -0
- diffneusim/models/unitree_g1_selfcol.dnmodel +20824 -0
- diffneusim/rl/__init__.py +2 -0
- diffneusim/rl/dynsyn_layer.py +146 -0
- diffneusim/rl/footstep_plan.py +337 -0
- diffneusim/rl/g1_bm_env.py +572 -0
- diffneusim/rl/g1_bm_eval.py +168 -0
- diffneusim/rl/g1_bm_fused.py +275 -0
- diffneusim/rl/g1_bm_ppo.py +622 -0
- diffneusim/rl/g1_bm_sapo.py +551 -0
- diffneusim/rl/g1_ppo.py +395 -0
- diffneusim/rl/g1_sapo_soft.py +240 -0
- diffneusim/rl/g1_soft_env.py +452 -0
- diffneusim/rl/g1_soft_grad.py +145 -0
- diffneusim/rl/geyer_curves_torch.py +108 -0
- diffneusim/rl/gpu_fullbody_vec_env.py +1241 -0
- diffneusim/rl/imitation.py +2027 -0
- diffneusim/rl/imitation_reward_v2.py +248 -0
- diffneusim/rl/imitation_reward_v3.py +349 -0
- diffneusim/rl/latent_task.py +175 -0
- diffneusim/rl/llc_reward.py +316 -0
- diffneusim/rl/millard_curves_torch.py +154 -0
- diffneusim/rl/mirror_symmetry.py +212 -0
- diffneusim/rl/model_path.py +35 -0
- diffneusim/rl/mvae_recon.py +123 -0
- diffneusim/rl/nets_shac.py +599 -0
- diffneusim/rl/reset_pool.py +154 -0
- diffneusim/rl/sapo_capture.py +873 -0
- diffneusim/rl/sapo_vec.py +1051 -0
- diffneusim/rl/shac_vec.py +346 -0
- diffneusim/rl/state_prior.py +151 -0
- diffneusim/rl/step_library.py +105 -0
- diffneusim/rl/task_walk_env.py +1793 -0
- diffneusim/rl/task_walk_reward.py +3300 -0
- diffneusim/run.py +23 -0
- diffneusim/run_env.py +46 -0
- diffneusim/tasks/__init__.py +147 -0
- diffneusim/tasks/legacy_names.py +63 -0
- diffneusim/tasks/paths.py +79 -0
- diffneusim/tasks/settings.py +202 -0
- diffneusim/third_party/instantmimic_947430ee/LICENSE +202 -0
- diffneusim/third_party/instantmimic_947430ee/NOTICE +19 -0
- diffneusim/third_party/instantmimic_947430ee/README.md +31 -0
- diffneusim/third_party/instantmimic_947430ee/instantmimic/envs/unitree_g1/tasks/beyondmimic_tracking/benchmark_protocol.py +106 -0
- diffneusim/third_party/instantmimic_947430ee/instantmimic/envs/unitree_g1/tasks/beyondmimic_tracking/metrics.py +214 -0
- diffneusim/third_party/instantmimic_947430ee/instantmimic/envs/unitree_g1/tasks/beyondmimic_tracking/reference.py +513 -0
- diffneusim/third_party/instantmimic_947430ee/instantmimic/motion/quaternion.py +193 -0
- diffneusim/train/__init__.py +0 -0
- diffneusim/train/eval_ckpt.py +239 -0
- diffneusim/train/eval_mimic.py +133 -0
- diffneusim/train/gait_report.py +203 -0
- diffneusim/train/gcot_chain.py +51 -0
- diffneusim/train/levers.py +135 -0
- diffneusim/train/masked_reset.py +314 -0
- diffneusim/train/rl_algorithm_suite.py +917 -0
- diffneusim/train/train14.py +240 -0
- diffneusim/train/train_tw14.py +674 -0
- diffneusim/viz/__init__.py +5 -0
- diffneusim/viz/__main__.py +41 -0
- diffneusim/viz/camera.py +115 -0
- diffneusim/viz/dnrec.py +118 -0
- diffneusim/viz/dnrec_io.py +686 -0
- diffneusim/viz/hud.py +565 -0
- diffneusim/viz/meshes.py +458 -0
- diffneusim/viz/play.py +237 -0
- diffneusim/viz/record.py +74 -0
- diffneusim/viz/render.py +1402 -0
- diffneusim/viz/renderer.py +268 -0
- diffneusim/viz/rl_env_render.py +635 -0
- diffneusim/viz/snapshot.py +54 -0
- diffneusim/viz/strobe.py +124 -0
- diffneusim/viz/to_mp4.py +58 -0
- diffneusim/viz/ui.py +481 -0
- diffneusim/viz/viewer.py +2086 -0
- diffneusim-1.0.0.dist-info/METADATA +226 -0
- diffneusim-1.0.0.dist-info/RECORD +682 -0
- diffneusim-1.0.0.dist-info/WHEEL +5 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSE +201 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/BSD-3-Clause-NC-ARMS-hand-wrist-4.3.txt +20 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/BSD-3-Clause-NC-MoBL-ARMS.txt +25 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/CC-BY-3.0-OpenSim-geometry.txt +25 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Christophy2012-lumbarspine.txt +10 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Lai2017-model-high-flex.txt +10 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Lee2015-hand_muscle.txt +11 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Rajagopal2016-full_body.txt +11 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Uhlrich2022-fbmodpassivecal.txt +10 -0
- diffneusim-1.0.0.dist-info/licenses/NOTICE +274 -0
- diffneusim-1.0.0.dist-info/top_level.txt +1 -0
diffneusim/g1/arm_a3.py
ADDED
|
@@ -0,0 +1,576 @@
|
|
|
1
|
+
"""A3's runner (tools/g1_seconds/PREREG_A3.md): InstantMimic's BeyondMimic side-kick task on our engine (g1_bm_env.BMTrack in its
|
|
2
|
+
differentiable mode, through the G1 adjoint) trained by OUR first-order trainer (g1_bm_sapo.SapoBM: SAPO with the knobs and EMA).
|
|
3
|
+
arm_a2.py's pattern, with A2's clock, checkpoints and scoring unchanged:
|
|
4
|
+
clock CLOCK_MONOTONIC_RAW with a device sync after every update; EVERY update counts, the first included (nothing excluded but
|
|
5
|
+
the checkpoint saves and the scoring, which InstantMimic's accounting excludes too)
|
|
6
|
+
update one H-step BPTT window of every world, the actor step, the temperature step, the critic regression (one window per update)
|
|
7
|
+
checkpoints every --ckpt-every updates (default 100): the trainer's snapshot (actor, its EMA shadow, critic, optimisers, normalisers),
|
|
8
|
+
saved after the clock stops, with the active seconds
|
|
9
|
+
scoring after training, in the same warm process: InstantMimic's evaluate protocol (g1_bm_eval.evaluate) on every checkpoint, a
|
|
10
|
+
fresh evaluate-mode env per checkpoint with the same seed (1,024 worlds, sampling start, pushes off, observation and reset
|
|
11
|
+
noise on, the run's DR), seeded right before the reset, as A2; the EMA actor's mean first (the primary), then the raw actor's
|
|
12
|
+
output <out>/train.jsonl (per update: the stats, the gradient-health counts grad_clipped / grad_nonfinite / grad_rows, windows),
|
|
13
|
+
<out>/checkpoint_iter_<N>.pt, <out>/eval.jsonl (per checkpoint and actor: iteration, active_s, which, their metrics),
|
|
14
|
+
<out>/meta.json
|
|
15
|
+
python tools/g1_seconds/arm_a3.py --npz <their side kick npz> --out DIR [--seed 42] [--n 1024] [--H 64] [--iters 3000]
|
|
16
|
+
[--kappa 2.0] [--ship/--nodr] [--cpu] [--dry] [--no-eval] [--eval-n 1024] [--score ema,raw]
|
|
17
|
+
[--easy-every 10 --easy-dense-until 1000 --easy-sparse-every 100 --easy-score ema,raw] (PREREG_E1, outside the clock)
|
|
18
|
+
score-only (the review / line 23, 11-11: a run killed at its chain's cap before its in-process scoring): the SAME scoring loop (score()
|
|
19
|
+
below) on <out>/checkpoint_iter_*.pt in iteration order, in one warm process; seed, ship, H and the config from <out>/meta.json, each
|
|
20
|
+
checkpoint's active_s from its own dict; rows marked scored_after_run; then read_a3's three criteria. Refuses an existing eval file.
|
|
21
|
+
python tools/g1_seconds/arm_a3.py --out DIR --score-only [--dry] [--cpu] [--eval-n 1024] [--score ema,raw] [--eval-file eval.jsonl]
|
|
22
|
+
(--score-only --dry: the chain's CHECK_ONLY; meta.json read, every checkpoint loaded on the CPU and checked, no engine)"""
|
|
23
|
+
import argparse
|
|
24
|
+
import faulthandler
|
|
25
|
+
import json
|
|
26
|
+
import os
|
|
27
|
+
import pathlib
|
|
28
|
+
import sys
|
|
29
|
+
import time
|
|
30
|
+
|
|
31
|
+
import torch
|
|
32
|
+
|
|
33
|
+
# (3a) was: sys.path.insert(0, str(ROOT / "python"))
|
|
34
|
+
from diffneusim.rl import g1_bm_env as B # noqa: E402
|
|
35
|
+
from diffneusim.rl import g1_soft_env as G # noqa: E402
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def raw_now():
|
|
39
|
+
return time.clock_gettime(time.CLOCK_MONOTONIC_RAW)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def check_aflags(bad, n, H, max_frac):
|
|
43
|
+
"""Session the overflow fix (c): the adjoint's kShellBadRecord world-steps in one update (a substep whose tape record overflowed, its
|
|
44
|
+
VJP the identity of the forward's hold). Fail fast above max_frac of the update's n x H world-steps (the review's tentative 1%); below,
|
|
45
|
+
the update is kept (those worlds' gradient is the hold's, finite). Returns the fraction."""
|
|
46
|
+
frac = bad / float(n * H)
|
|
47
|
+
assert frac <= max_frac, (f"the adjoint flagged {bad} of {n * H} world-steps with kShellBadRecord ({100 * frac:.2f}% > "
|
|
48
|
+
f"{100 * max_frac:.2f}%): overflowed tape records, stopping")
|
|
49
|
+
return frac
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
EASY_N, EASY_STEPS, EASY_PASS = 32, 296, 0.9 # PREREG_E1: a0_neu.sh's BENCH (num_envs 32, steps 296, success_rate 0.9)
|
|
53
|
+
EASY_SIGMA = 1e-6 # PREREG_E1 Amendment 1: each benchmark world's start perturbation, N(0, sigma)
|
|
54
|
+
RG1_SECONDARY = { # PREREG_RG1 Amendment 2 (secondary readouts, the same rows): each with the 29 / 32 perturbed rule
|
|
55
|
+
"mpkpe_107": lambda r: r["mpkpe"] <= 0.107, # BeyondMimic's published MPKPE (mjlab's 107 mm)
|
|
56
|
+
"primary_thresholds": lambda r: (r["mpkpe"] <= 0.120 and r["r_mpkpe"] <= 0.033 and r["ee_pos_error"] <= 0.052 # the ship tables'
|
|
57
|
+
and r["ee_ori_error"] <= 0.180), # PRIMARY thresholds (benchmark_protocol.py)
|
|
58
|
+
}
|
|
59
|
+
RG1_SECONDARY_EVERY = 50 # after the primary pass, the remaining secondary rules every 50 updates / iterations
|
|
60
|
+
RG1_MPKPE_BAR = 0.0805 # PREREG_RG1: the worst of A1c's three crossing MPKPEs (80.5 / 49.6 / 72.4 mm, night chain
|
|
61
|
+
# 11-10 on their file, g1_soft_eval's MPKPE), so every A1c crossing met it
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class ActionPathProbe:
|
|
65
|
+
"""The training-path check (the review, RUN290's lesson) for an action-mapping knob: a ONE-SHOT wrapper on the training env's
|
|
66
|
+
lawmap.ctrl, the call BMTrack.step makes with the PD target. On the first training step (update 1, eager, before any capture) it
|
|
67
|
+
recovers the base pose the env really used (target - action x scale + encoder bias) and compares it with the command frame's
|
|
68
|
+
reference pose and with the default pose; then it removes itself. read() returns the two max abs differences and the verdict, and
|
|
69
|
+
asserts the base matches the mode the run was launched in (residual or default)."""
|
|
70
|
+
|
|
71
|
+
def __init__(self, env, residual):
|
|
72
|
+
self.env, self.residual, self.res, self.lm = env, bool(residual), None, env.lm
|
|
73
|
+
orig = env.lm.ctrl
|
|
74
|
+
|
|
75
|
+
def ctrl(target):
|
|
76
|
+
if self.res is None:
|
|
77
|
+
e = self.env
|
|
78
|
+
with torch.no_grad():
|
|
79
|
+
base = target.detach() - e.action.detach() * e.action_scale + e.encoder_bias
|
|
80
|
+
ref = e.m.joint_pos[e.time].to(base.dtype)
|
|
81
|
+
self.res = dict(d_reference=float((base - ref).abs().max()), d_default=float((base - e.q_default).abs().max()))
|
|
82
|
+
del self.lm.ctrl # one shot: the lawmap's own method again, before any capture
|
|
83
|
+
return orig(target)
|
|
84
|
+
env.lm.ctrl = ctrl
|
|
85
|
+
|
|
86
|
+
def skip(self, reason):
|
|
87
|
+
"""stand down before any step (a captured resume: the first step runs inside the capture, where the probe's host read is a
|
|
88
|
+
synchronizing call); the resumed run's mode is the original run's own, from its meta.json"""
|
|
89
|
+
assert self.res is None, "the probe already fired"
|
|
90
|
+
del self.lm.ctrl
|
|
91
|
+
self.res = dict(skipped=reason)
|
|
92
|
+
|
|
93
|
+
def read(self):
|
|
94
|
+
assert self.res is not None, "the probe saw no training step"
|
|
95
|
+
if "skipped" in self.res:
|
|
96
|
+
return dict(self.res, residual=self.residual)
|
|
97
|
+
r = dict(self.res, residual=self.residual)
|
|
98
|
+
want, other = ("d_reference", "d_default") if self.residual else ("d_default", "d_reference")
|
|
99
|
+
assert r[want] <= 1e-5 < r[other] or r[want] <= 1e-5 and r[other] <= 1e-5, ("the training env's PD base is not the launched mode's", r)
|
|
100
|
+
return r
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class EasyTrack(B.BMTrack):
|
|
104
|
+
"""PREREG_E1 Amendment 1 (the review, the design rule that an unavoidable asymmetry goes against us): our engine's deterministic-start
|
|
105
|
+
worlds are bitwise identical (one rollout), MuJoCo Warp's diverge (its contact rows follow an atomic counter). So every world's
|
|
106
|
+
reference reset gets its own fixed perturbation, N(0, sigma) on the root position, the joint positions and every velocity (the
|
|
107
|
+
root quaternion kept), drawn ONCE from a dedicated generator seeded with the run's seed: the same perturbation at every benchmark
|
|
108
|
+
call and every checkpoint, and no draw from the global RNG. Applied after their perturb_reference_state, so the frames, the
|
|
109
|
+
command and the observation of the reset all see it (BMTrack._reset_worlds refreshes the frames after this call)."""
|
|
110
|
+
|
|
111
|
+
def __init__(self, *args, sigma, noise_seed, **kw):
|
|
112
|
+
super().__init__(*args, **kw)
|
|
113
|
+
g = torch.Generator(device="cpu").manual_seed(int(noise_seed))
|
|
114
|
+
dq = sigma * torch.randn(self.n, G.NQ, generator=g, dtype=torch.float64)
|
|
115
|
+
dq[:, 3:7] = 0.0
|
|
116
|
+
dv = sigma * torch.randn(self.n, G.NV, generator=g, dtype=torch.float64)
|
|
117
|
+
self.start_dq, self.start_dv = dq.to(self.dev, self.dt), dv.to(self.dev, self.dt)
|
|
118
|
+
|
|
119
|
+
def _write_reference_state(self, mask):
|
|
120
|
+
super()._write_reference_state(mask)
|
|
121
|
+
mk = mask.view(-1, 1)
|
|
122
|
+
self.qpos = torch.where(mk, self.qpos + self.start_dq, self.qpos)
|
|
123
|
+
self.qvel = torch.where(mk, self.qvel + self.start_dv, self.qvel)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
@torch.no_grad()
|
|
127
|
+
def easy_bench(env, act, steps=EASY_STEPS, mpkpe=False):
|
|
128
|
+
"""PREREG_E1's easy rule, their trainer benchmark's (InstantMimic 947430ee, train/benchmark_runner.py:850-912 with validity and
|
|
129
|
+
success 'full_horizon'; the rate at :719-722), as A0-nodr's 11-10 first pass ran it (a0_neu.sh's BENCH): every world reset to frame
|
|
130
|
+
0 with no reset or observation noise and no DR or pushes (the env given), the mean action, and a world FAILS when it is done
|
|
131
|
+
(terminated or truncated) at a step count below `steps`; success_rate = the worlds never failed / all worlds. Stops early once
|
|
132
|
+
every world has failed (the rest cannot change the rate). Draws no RNG: the CPU and CUDA generator states are asserted unchanged.
|
|
133
|
+
mpkpe=True (PREREG_RG1) also accumulates their BeyondMimic metrics over the same rollouts, as their evaluate does (g1_bm_eval: the
|
|
134
|
+
reference snapshotted before each step, the robot state after it, their accumulator with the env's dones; at step `steps` every
|
|
135
|
+
world still running is closed as truncated): MPKPE and r_mpkpe are their per-episode time means over each world's steps, then the
|
|
136
|
+
mean over the worlds."""
|
|
137
|
+
cpu0 = torch.get_rng_state()
|
|
138
|
+
cu0 = torch.cuda.get_rng_state_all() if torch.cuda.is_available() else []
|
|
139
|
+
actor = env.reset_all()["actor"]
|
|
140
|
+
alive = torch.ones(env.n, dtype=torch.bool, device=actor.device)
|
|
141
|
+
first_fail, k = None, 0
|
|
142
|
+
acc = None
|
|
143
|
+
if mpkpe:
|
|
144
|
+
from diffneusim.rl import g1_bm_eval as E
|
|
145
|
+
acc = E.BeyondMimicBenchmarkAccumulator(num_envs=env.n, end_effector_indices=env.benchmark_end_effector_indices, device=actor.device)
|
|
146
|
+
for k in range(1, steps + 1):
|
|
147
|
+
ref = E._check_reference(env.snapshot_benchmark_reference(), env.n, env.act_dim) if acc is not None else None
|
|
148
|
+
out = env.step(act(actor))
|
|
149
|
+
done = out["terminated"] | out["truncated"]
|
|
150
|
+
if acc is not None:
|
|
151
|
+
rob = E._check_robot(env.get_benchmark_robot_state(), env.n, env.act_dim)
|
|
152
|
+
acc.update(reference=ref, robot_body_position_world=rob["body_position_world"],
|
|
153
|
+
robot_body_quaternion_world=rob["body_quaternion_world"], robot_joint_velocity=rob["joint_velocity"])
|
|
154
|
+
acc.mark_dones(terminated=out["terminated"], truncated=out["truncated"] | (k == steps))
|
|
155
|
+
if k < steps:
|
|
156
|
+
if first_fail is None and bool((alive & done).any()):
|
|
157
|
+
first_fail = k
|
|
158
|
+
alive = alive & ~done
|
|
159
|
+
if not bool(alive.any()):
|
|
160
|
+
break
|
|
161
|
+
actor = out["actor"]
|
|
162
|
+
assert torch.equal(torch.get_rng_state(), cpu0), "the easy benchmark drew from the CPU RNG"
|
|
163
|
+
assert all(torch.equal(a, b) for a, b in zip(torch.cuda.get_rng_state_all() if cu0 else [], cu0)), "it drew from the CUDA RNG"
|
|
164
|
+
ns = int(alive.sum().item())
|
|
165
|
+
r = dict(success_rate=ns / env.n, n_success=ns, n=int(env.n), steps_run=k, first_fail_step=first_fail)
|
|
166
|
+
if acc is not None:
|
|
167
|
+
assert bool(acc.done.all()), "a world left open by the easy benchmark's accumulator"
|
|
168
|
+
m = acc.finalize()
|
|
169
|
+
r.update({k: float(v) for k, v in m.items() if isinstance(v, (int, float))}) # their metrics: mpkpe, r_mpkpe, ee errors, ...
|
|
170
|
+
return r
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
class Easy:
|
|
174
|
+
"""PREREG_E1's in-run easy benchmark, outside the clock (as their benchmark time is outside their active time): every `every`
|
|
175
|
+
updates up to `dense_until`, then every `sparse_every`, each actor in `which` until its first pass (success_rate >= EASY_PASS).
|
|
176
|
+
Rows go to <out>/easy.jsonl: it, active_s, which, the rule's counts, wall_s."""
|
|
177
|
+
|
|
178
|
+
def __init__(self, env, agent, which, every, dense_until, sparse_every, path, rows=(), mpkpe_bar=None, acts=None, on_pass=None,
|
|
179
|
+
secondary=None, secondary_every=None):
|
|
180
|
+
"""mpkpe_bar (PREREG_RG1): the pass also needs MPKPE <= the bar on the same rollouts. acts: {name: mean-action function} (default:
|
|
181
|
+
agent.act_mean(o, which=name), SapoBM's). on_pass(name, it, active_s): called once at each actor's first pass (the crossing
|
|
182
|
+
checkpoint)."""
|
|
183
|
+
self.env, self.agent, self.which, self.path = env, agent, list(which), path
|
|
184
|
+
self.every, self.dense_until, self.sparse_every = int(every), int(dense_until), int(sparse_every)
|
|
185
|
+
self.mpkpe_bar, self.on_pass = mpkpe_bar, on_pass
|
|
186
|
+
self.acts = acts or {w: (lambda o, _w=w: agent.act_mean(o, which=_w)) for w in self.which}
|
|
187
|
+
assert set(self.which) <= set(self.acts), (self.which, sorted(self.acts))
|
|
188
|
+
self.passed = {r["which"] for r in rows if r["passed"]}
|
|
189
|
+
# PREREG_RG1 Amendment 2: secondary rules {name: predicate on a row}, each also needing the rate; an actor past its primary pass
|
|
190
|
+
# keeps being benchmarked every `secondary_every` until every secondary rule has crossed once
|
|
191
|
+
self.secondary, self.secondary_every = dict(secondary or {}), int(secondary_every or 0)
|
|
192
|
+
self.sec_passed = {(r["which"], k) for r in rows for k, v in r.get("secondary", {}).items() if v}
|
|
193
|
+
|
|
194
|
+
def _sec_open(self, w):
|
|
195
|
+
return [k for k in self.secondary if (w, k) not in self.sec_passed]
|
|
196
|
+
|
|
197
|
+
def passes(self, r):
|
|
198
|
+
return r["success_rate"] >= EASY_PASS and (self.mpkpe_bar is None or r["mpkpe"] <= self.mpkpe_bar)
|
|
199
|
+
|
|
200
|
+
def due(self, it):
|
|
201
|
+
k = self.every if it <= self.dense_until else self.sparse_every
|
|
202
|
+
out = [w for w in self.which if w not in self.passed] if it % k == 0 else []
|
|
203
|
+
if self.secondary_every and it % self.secondary_every == 0:
|
|
204
|
+
out += [w for w in self.which if w in self.passed and self._sec_open(w) and w not in out]
|
|
205
|
+
return out
|
|
206
|
+
|
|
207
|
+
def run(self, it, active_s):
|
|
208
|
+
todo = self.due(it)
|
|
209
|
+
with open(self.path, "a") as f:
|
|
210
|
+
for w in todo:
|
|
211
|
+
t0 = raw_now()
|
|
212
|
+
r = easy_bench(self.env, self.acts[w], mpkpe=self.mpkpe_bar is not None)
|
|
213
|
+
ok = self.passes(r)
|
|
214
|
+
sec = {k: bool(r["success_rate"] >= EASY_PASS and f(r)) for k, f in self.secondary.items()}
|
|
215
|
+
for k, v in sec.items():
|
|
216
|
+
if v:
|
|
217
|
+
self.sec_passed.add((w, k))
|
|
218
|
+
row = dict(it=it, active_s=active_s, which=w, **r, passed=ok, mpkpe_bar=self.mpkpe_bar, wall_s=raw_now() - t0,
|
|
219
|
+
**({"secondary": sec} if self.secondary else {}))
|
|
220
|
+
f.write(json.dumps(row) + "\n")
|
|
221
|
+
f.flush()
|
|
222
|
+
if ok and w not in self.passed:
|
|
223
|
+
self.passed.add(w)
|
|
224
|
+
print(f"EASY PASS {w} at update {it}, active {active_s:.2f} s: {json.dumps(r)}", flush=True)
|
|
225
|
+
if self.on_pass is not None:
|
|
226
|
+
self.on_pass(w, it, active_s)
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
def score(agent, ckpts, m, lm, ev_law, eval_n, ship, dev, dt, es, which, path, extra=None, com_dr=False, com_scale=1.0, residual=False):
|
|
230
|
+
"""The scoring loop, shared by the in-process path and --score-only: per checkpoint the policy loaded, then per actor a fresh
|
|
231
|
+
evaluate-mode env with the same seed (the same DR draws), seeded right before the reset, as their evaluate.py."""
|
|
232
|
+
from diffneusim.rl import g1_bm_eval as E
|
|
233
|
+
with open(path, "w") as f:
|
|
234
|
+
for it, act_s, p in ckpts:
|
|
235
|
+
agent.load_policy(torch.load(p, weights_only=False)["snapshot"])
|
|
236
|
+
for w in which:
|
|
237
|
+
ev_env = B.BMTrack(ev_law, m, lm, eval_n, ship=ship, device=dev, dtype=dt, seed=es, sampling="start", pushes=False,
|
|
238
|
+
com_dr=com_dr, com_scale=com_scale, residual=residual) # the run's DR, as their evaluate takes the checkpoint's (the CoM draw included)
|
|
239
|
+
E.set_seed(es)
|
|
240
|
+
t0 = raw_now()
|
|
241
|
+
r = E.evaluate(ev_env, lambda o, _w=w: agent.act_mean(o, which=_w))
|
|
242
|
+
f.write(json.dumps(dict(iteration=it, active_s=act_s, which=w, eval_wall_s=raw_now() - t0, **r, **(extra or {})),
|
|
243
|
+
default=float) + "\n")
|
|
244
|
+
f.flush()
|
|
245
|
+
print(f"iter {it} active {act_s:.1f} s {w}: {json.dumps(r, default=float)[:200]}", flush=True)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
def read_criteria(out):
|
|
249
|
+
"""read_a3's three crossing rules (PREREG_A3 Amendment 1) on <out>/eval.jsonl, printed one line per actor."""
|
|
250
|
+
here = str(pathlib.Path(__file__).resolve().parent) # explicit: python -I (3.11+) does not put the script's directory on sys.path
|
|
251
|
+
if here not in sys.path:
|
|
252
|
+
sys.path.insert(0, here)
|
|
253
|
+
from diffneusim.g1 import read_a3
|
|
254
|
+
for w, res in read_a3.read(out).items():
|
|
255
|
+
print("READ_A3 " + json.dumps(dict(which=w, primary=res["primary"], secondary=res["secondary"], third=res["third"]), default=float),
|
|
256
|
+
flush=True)
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
def score_only(a, which):
|
|
260
|
+
"""--out alone suffices: seed, ship, n, H, the npz and the config come from <out>/meta.json; train.jsonl is never needed (a run killed
|
|
261
|
+
at its cap ends mid-run, with no final s_per_iter line)."""
|
|
262
|
+
out = pathlib.Path(a.out)
|
|
263
|
+
meta = json.loads((out / "meta.json").read_text())
|
|
264
|
+
npz = a.npz or meta["npz"]
|
|
265
|
+
assert pathlib.Path(npz).is_file(), f"the motion {npz} (from {'--npz' if a.npz else 'meta.json'}) is not a file"
|
|
266
|
+
ef = out / a.eval_file
|
|
267
|
+
assert not (ef.exists() and ef.stat().st_size > 0), f"{ef} exists: score-only never overwrites an eval file"
|
|
268
|
+
ckpts = []
|
|
269
|
+
for p in out.glob("checkpoint_iter_*.pt"):
|
|
270
|
+
ck = torch.load(p, weights_only=False, map_location="cpu" if (a.dry or a.cpu) else None)
|
|
271
|
+
assert int(ck["it"]) == int(p.stem.rsplit("_", 1)[1]) and ck["seed"] == meta["seed"] and ck["ship"] == meta["ship"], p
|
|
272
|
+
sn = ck["snapshot"]
|
|
273
|
+
assert {"actor", "actor_ema", "obs_rms", "A", "cfg"} <= set(sn) and sn["actor_ema"] is not None, f"{p}: not a SapoBM snapshot"
|
|
274
|
+
assert sn["cfg"]["H"] == meta["H"] and sn["A"].numel() == 29, p
|
|
275
|
+
ckpts.append((int(ck["it"]), float(ck["active_s"]), p))
|
|
276
|
+
ckpts.sort()
|
|
277
|
+
assert ckpts, f"no checkpoint_iter_*.pt in {out}"
|
|
278
|
+
if a.dry:
|
|
279
|
+
print(f"SCORE-ONLY DRY ok: {out}: {len(ckpts)} checkpoints load on the CPU, iterations {ckpts[0][0]}-{ckpts[-1][0]} (active "
|
|
280
|
+
f"{ckpts[-1][1]:.1f} s), seed {meta['seed']}, ship {meta['ship']}, n {meta['n']}, H {meta['H']}, score {which}, npz {npz}, "
|
|
281
|
+
f"eval file {ef.name} absent", flush=True)
|
|
282
|
+
return
|
|
283
|
+
from diffneusim.rl import g1_bm_sapo as S
|
|
284
|
+
dev = "cpu" if a.cpu else "cuda"
|
|
285
|
+
dt = torch.float64 if a.cpu else torch.float32
|
|
286
|
+
lm = G.LawMap(device=dev)
|
|
287
|
+
m = G.Motion(npz, lm, device=dev, dtype=dt)
|
|
288
|
+
eval_law = ((lambda k: G.CpuLaw(B.ROBOT_BODIES)) if a.cpu else
|
|
289
|
+
(lambda k: G.GpuLaw(k, B.ROBOT_BODIES, com_dr=bool(meta.get("com_dr", False))))) # the COMDR build when the run drew
|
|
290
|
+
n_agent = 2 # the agent only holds the policy; its env gives the dims and the action box
|
|
291
|
+
cfg = dict(meta["cfg"], n_env=n_agent)
|
|
292
|
+
env = B.BMTrack(eval_law(n_agent), m, lm, n_agent, ship=meta["ship"], device=dev, dtype=dt, seed=meta["seed"])
|
|
293
|
+
agent = S.SapoBM(env, cfg, seed=meta["seed"])
|
|
294
|
+
print(f"SCORE-ONLY {out}: {len(ckpts)} checkpoints, iterations {ckpts[0][0]}-{ckpts[-1][0]}, seed {meta['seed']}, ship {meta['ship']}, "
|
|
295
|
+
f"score {which}", flush=True)
|
|
296
|
+
score(agent, ckpts, m, lm, eval_law(a.eval_n), a.eval_n, meta["ship"], dev, dt, a.eval_seed or meta["seed"], which, ef,
|
|
297
|
+
extra=dict(scored_after_run=True, note="scored after the run (killed at the cap)"), com_dr=bool(meta.get("com_dr", False)), com_scale=float(meta.get("com_scale", 1.0)),
|
|
298
|
+
residual=bool(meta.get("residual", False)))
|
|
299
|
+
if a.eval_file == "eval.jsonl":
|
|
300
|
+
read_criteria(out)
|
|
301
|
+
print("A3 SCORE-ONLY DONE")
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
def main():
|
|
305
|
+
ap = argparse.ArgumentParser()
|
|
306
|
+
ap.add_argument("--npz", default=None, help="their side kick npz (required to train; score-only reads it from meta.json)")
|
|
307
|
+
ap.add_argument("--out", required=True)
|
|
308
|
+
ap.add_argument("--seed", type=int, default=42)
|
|
309
|
+
ap.add_argument("--n", type=int, default=1024)
|
|
310
|
+
ap.add_argument("--H", type=int, default=64)
|
|
311
|
+
ap.add_argument("--iters", type=int, default=3000)
|
|
312
|
+
ap.add_argument("--decay-iters", type=int, default=None, help="the linear lr decay's length (default: the trainer's CFG)")
|
|
313
|
+
ap.add_argument("--actor-lr", type=float, default=None, help="the actor's initial lr (default: the trainer's CFG, 2e-3); hub 13's s9")
|
|
314
|
+
ap.add_argument("--kappa", type=float, default=None, help="the per-env action-gradient clip factor (default: CFG's, E0's 2)")
|
|
315
|
+
ap.add_argument("--ckpt-every", type=int, default=100)
|
|
316
|
+
ap.add_argument("--nodr", action="store_true", help="the nodr variant (default: ship)")
|
|
317
|
+
ap.add_argument("--com-dr", action="store_true", help="InstantMimic's torso CoM draw in the ship DR (hub 13, 11-11; BMTrack com_dr: "
|
|
318
|
+
"needs a law with set_anchor_ipos_offset, session C's engine piece); the scorer env draws it too")
|
|
319
|
+
ap.add_argument("--residual", action="store_true", help="R-G1: residual actions (BMTrack residual: the command frame's "
|
|
320
|
+
"reference pose + action x their scale); every env of the run (training, scorer, easy benchmark) takes it")
|
|
321
|
+
ap.add_argument("--com-scale", type=float, default=1.0, help="gate knob: scales the CoM draw (0 must equal a --com-dr-off run)")
|
|
322
|
+
ap.add_argument("--cpu", action="store_true", help="the f64 CPU Jacobian law (a smoke at small n and H; no timing meaning)")
|
|
323
|
+
ap.add_argument("--dry", action="store_true", help="CHECK_ONLY: imports, the law map, the motion, the config; no engine")
|
|
324
|
+
ap.add_argument("--no-eval", action="store_true")
|
|
325
|
+
ap.add_argument("--eval-n", type=int, default=1024)
|
|
326
|
+
ap.add_argument("--eval-seed", type=int, default=None, help="default: the training seed (their evaluate.py takes the run's seed)")
|
|
327
|
+
ap.add_argument("--score", default="ema,raw", help="which actors each checkpoint is scored with, in order (ema = the primary)")
|
|
328
|
+
ap.add_argument("--reward-scale", type=float, default=None, help="diagnostic: the return and the critic's targets see K x reward")
|
|
329
|
+
ap.add_argument("--alpha-fixed", type=float, default=None, help="diagnostic: a fixed temperature, no temperature step")
|
|
330
|
+
ap.add_argument("--action-box", type=float, default=None, help="diagnostic: A_j = V for every joint (default: the model rule)")
|
|
331
|
+
ap.add_argument("--target-entropy", default=None, choices=("per_dim", "noise"),
|
|
332
|
+
help="diagnostic: 'noise' = LONG13's target from an action noise of --action-noise action units per joint")
|
|
333
|
+
ap.add_argument("--action-noise", type=float, default=None, help="with --target-entropy noise (default 0.1, SuperMimic Table A.5)")
|
|
334
|
+
ap.add_argument("--init-alpha", type=float, default=None, help="the temperature's start (default: CFG's 0.1)")
|
|
335
|
+
ap.add_argument("--segments", type=int, default=None, help="the window's autograd / CUDA-graph segments (default 1)")
|
|
336
|
+
ap.add_argument("--overflow-done", action="store_true", help="overflow-as-done (C's design, hub 13 11-11): an overflowed world is "
|
|
337
|
+
"truncated at that step and reset; default off")
|
|
338
|
+
ap.add_argument("--aflag-max-frac", type=float, default=0.01, help="fail fast when the adjoint's kShellBadRecord world-steps exceed "
|
|
339
|
+
"this fraction of an update's n x H (session C's overflow fix; the hub's tentative 1%%)")
|
|
340
|
+
ap.add_argument("--critic-iters", type=int, default=None, help="the critic's regression iterations per update (default: CFG's 4; "
|
|
341
|
+
"the minibatches per iteration unchanged)")
|
|
342
|
+
ap.add_argument("--capture", action="store_true", help="capture the window as a CUDA graph after update 1 (outside the clock, as "
|
|
343
|
+
"A1c / A2c; update 1 stays eager and on the clock); every later update replays it, the rest of the update eager")
|
|
344
|
+
ap.add_argument("--capture-warmup", type=int, default=2)
|
|
345
|
+
ap.add_argument("--fused", action="store_true", help="the old name of the default (the unification, 11-11: the compiled path IS "
|
|
346
|
+
"BMTrack.step, compile=True); accepted so old job lines run unchanged; refused with --eager")
|
|
347
|
+
ap.add_argument("--eager", action="store_true", help="opt out of the compiled training env (the user's rule 11-11: speed-ups are the "
|
|
348
|
+
"default); --cpu runs eager too (a Mac smoke; the compiled path's CPU equivalence is tools/g1_seconds/unify_eager_gate.py)")
|
|
349
|
+
ap.add_argument("--resume", action="store_true", help="continue <out>'s run from its resume.pt (the last checkpoint): every agent "
|
|
350
|
+
"and env tensor and both RNGs restored, active time carried; with --capture it captures before the first update")
|
|
351
|
+
ap.add_argument("--score-only", action="store_true", help="score <out>'s saved checkpoints (a run killed before its scoring)")
|
|
352
|
+
ap.add_argument("--eval-file", default="eval.jsonl", help="the eval rows' file name in <out> (score-only; the tests use another)")
|
|
353
|
+
ap.add_argument("--easy-every", type=int, default=0, help="PREREG_E1: the easy benchmark (easy_bench: 32 worlds from frame 0, no "
|
|
354
|
+
"noise, no DR or pushes, 296 steps) every K updates outside the clock, each actor until its first pass (0: off)")
|
|
355
|
+
ap.add_argument("--easy-dense-until", type=int, default=1000, help="after this update the easy benchmark runs every --easy-sparse-every")
|
|
356
|
+
ap.add_argument("--easy-sparse-every", type=int, default=100)
|
|
357
|
+
ap.add_argument("--easy-score", default="ema,raw", help="the actors the easy benchmark scores, in order")
|
|
358
|
+
ap.add_argument("--easy-mpkpe-bar", type=float, default=None, help="PREREG_RG1: the pass also needs MPKPE <= this (m) on the same "
|
|
359
|
+
"rollouts; arm_a3.RG1_MPKPE_BAR = 0.0805; at each actor's first pass, crossing_<actor>.pt is saved")
|
|
360
|
+
a = ap.parse_args()
|
|
361
|
+
from diffneusim.rl import g1_bm_sapo as S
|
|
362
|
+
cfg = dict(S.CFG, n_env=a.n, H=a.H)
|
|
363
|
+
if a.decay_iters is not None:
|
|
364
|
+
cfg["decay_iters"] = a.decay_iters
|
|
365
|
+
if a.actor_lr is not None:
|
|
366
|
+
cfg["actor_lr"] = a.actor_lr
|
|
367
|
+
if a.kappa is not None:
|
|
368
|
+
cfg["action_grad_clip"] = a.kappa
|
|
369
|
+
for k, v in (("reward_scale", a.reward_scale), ("alpha_fixed", a.alpha_fixed), ("action_box", a.action_box),
|
|
370
|
+
("target_entropy", a.target_entropy), ("action_noise", a.action_noise), ("init_alpha", a.init_alpha),
|
|
371
|
+
("segments", a.segments), ("critic_iterations", a.critic_iters)):
|
|
372
|
+
if v is not None: # recorded in cfg, so meta.json, resume and score-only carry it
|
|
373
|
+
cfg[k] = v
|
|
374
|
+
which = [w.strip() for w in a.score.split(",") if w.strip()]
|
|
375
|
+
assert which and all(w in ("ema", "raw") for w in which), a.score
|
|
376
|
+
if a.score_only:
|
|
377
|
+
score_only(a, which)
|
|
378
|
+
return
|
|
379
|
+
if a.resume: # everything from the run's own records: meta.json and resume.pt
|
|
380
|
+
meta = json.loads((pathlib.Path(a.out) / "meta.json").read_text())
|
|
381
|
+
a.npz, a.seed, a.n, a.H, a.nodr = meta["npz"], meta["seed"], meta["n"], meta["H"], not meta["ship"]
|
|
382
|
+
assert not a.com_dr or meta.get("com_dr", False), "--com-dr on a run recorded without it"
|
|
383
|
+
a.com_dr, a.com_scale = bool(meta.get("com_dr", False)), float(meta.get("com_scale", 1.0))
|
|
384
|
+
assert not a.residual or meta.get("residual", False), "--residual on a run recorded without it"
|
|
385
|
+
a.residual = bool(meta.get("residual", False))
|
|
386
|
+
assert "compiled" in meta, "a run recorded before the unification (no 'compiled' in meta.json) resumes on its own commit"
|
|
387
|
+
assert not (a.eager and meta["compiled"]), "--eager on a run recorded compiled"
|
|
388
|
+
a.eager = not bool(meta["compiled"])
|
|
389
|
+
a.ckpt_every = int(meta["ckpt_every"])
|
|
390
|
+
cfg = dict(meta["cfg"])
|
|
391
|
+
assert not a.overflow_done or meta.get("overflow_done", False), "--overflow-done on a run recorded without it"
|
|
392
|
+
a.overflow_done = bool(meta.get("overflow_done", False))
|
|
393
|
+
e = meta.get("easy") # PREREG_E1: the easy benchmark's settings come from the run's record too
|
|
394
|
+
assert not a.easy_every or e, "--easy-every on a run recorded without it"
|
|
395
|
+
if e:
|
|
396
|
+
a.easy_every, a.easy_dense_until, a.easy_sparse_every, a.easy_score = e["every"], e["dense_until"], e["sparse_every"], ",".join(e["which"])
|
|
397
|
+
a.easy_mpkpe_bar = e.get("mpkpe_bar")
|
|
398
|
+
assert a.npz, "--npz is required to train"
|
|
399
|
+
lm0 = G.LawMap()
|
|
400
|
+
m0 = G.Motion(a.npz, lm0)
|
|
401
|
+
if a.dry:
|
|
402
|
+
print(f"DRY ok: {m0.T} frames, {len(lm0.joints)} joints, cfg {json.dumps(cfg, default=str)}, score {which}, com_dr {a.com_dr}, residual {a.residual}, easy every {a.easy_every} "
|
|
403
|
+
f"(dense to {a.easy_dense_until}, then {a.easy_sparse_every}; {a.easy_score}), out {a.out}"
|
|
404
|
+
+ (" (resume)" if a.resume else ""))
|
|
405
|
+
return
|
|
406
|
+
faulthandler.enable() # a fault in the driver still leaves the Python stack in the log
|
|
407
|
+
out = pathlib.Path(a.out)
|
|
408
|
+
out.mkdir(parents=True, exist_ok=True)
|
|
409
|
+
dev = "cpu" if a.cpu else "cuda"
|
|
410
|
+
dt = torch.float64 if a.cpu else torch.float32
|
|
411
|
+
sync = (lambda: None) if a.cpu else torch.cuda.synchronize
|
|
412
|
+
lm = G.LawMap(device=dev)
|
|
413
|
+
m = G.Motion(a.npz, lm, device=dev, dtype=dt)
|
|
414
|
+
from diffneusim.rl import g1_soft_grad as D
|
|
415
|
+
train_law = D.CpuJacLaw(B.ROBOT_BODIES, slots=a.H) if a.cpu else G.GpuLaw(a.n, B.ROBOT_BODIES, slots=a.H, tape=True, com_dr=a.com_dr)
|
|
416
|
+
eval_law = (lambda k: G.CpuLaw(B.ROBOT_BODIES)) if a.cpu else (lambda k: G.GpuLaw(k, B.ROBOT_BODIES, com_dr=a.com_dr))
|
|
417
|
+
ship = not a.nodr
|
|
418
|
+
dn_path = os.environ.get("DN_PATH", "fused") # the package's one switch: paper = what the paper's G1 runs did (eager + capture)
|
|
419
|
+
assert dn_path in ("fused", "paper"), f"DN_PATH={dn_path!r}: fused or paper"
|
|
420
|
+
if dn_path == "paper" and not a.resume:
|
|
421
|
+
assert not a.fused, "DN_PATH=paper with --fused"
|
|
422
|
+
a.eager, a.capture = True, a.capture or not a.cpu
|
|
423
|
+
assert not (a.fused and a.eager), "--fused (the old name of the default compiled path) with --eager"
|
|
424
|
+
print("[path] G1: " + ("paper-exact (eager + CUDA-graph capture, as the paper's runs; DN_PATH=paper)" if dn_path == "paper" and a.eager
|
|
425
|
+
else "eager (--eager or a CPU run)" if a.eager or a.cpu else "fused (compiled; 1.52x the paper's eager + capture route, not bitwise with it)"), flush=True)
|
|
426
|
+
from diffneusim.run_env import describe as env_line, run_env
|
|
427
|
+
renv = run_env() # recorded in meta.json (a resume: in its resumed_from entry)
|
|
428
|
+
print(env_line(renv), flush=True)
|
|
429
|
+
compiled = not a.eager and not a.cpu # the unification: one env, the compiled step IS BMTrack.step (session C, 11-11)
|
|
430
|
+
env = B.BMTrack(train_law, m, lm, a.n, ship=ship, device=dev, dtype=dt, seed=a.seed, differentiable=True, horizon=a.H, com_dr=a.com_dr,
|
|
431
|
+
com_scale=a.com_scale, residual=a.residual, overflow_done=a.overflow_done, compile=compiled)
|
|
432
|
+
if compiled:
|
|
433
|
+
from diffneusim.rl import g1_bm_fused as FU
|
|
434
|
+
compile_s = FU.warm_compile(env) if compiled else None # before SapoBM (which seeds the RNG) and before the clock
|
|
435
|
+
easy_which = [w.strip() for w in a.easy_score.split(",") if w.strip()]
|
|
436
|
+
assert easy_which and all(w in ("ema", "raw") for w in easy_which), a.easy_score
|
|
437
|
+
easy_cfg = (dict(every=a.easy_every, dense_until=a.easy_dense_until, sparse_every=a.easy_sparse_every, which=easy_which, n=EASY_N,
|
|
438
|
+
steps=EASY_STEPS, pass_rate=EASY_PASS, start_sigma=EASY_SIGMA, noise_seed=a.seed, mpkpe_bar=a.easy_mpkpe_bar)
|
|
439
|
+
if a.easy_every else None)
|
|
440
|
+
# PREREG_E1: the easy benchmark's env (never DR, whatever the run's) is built HERE, before SapoBM: BMTrack's constructor seeds the
|
|
441
|
+
# global RNG and draws its push timers, and SapoBM re-seeds it, so the training draws are those of a run without it
|
|
442
|
+
easy_env = (EasyTrack(eval_law(EASY_N), m, lm, EASY_N, ship=False, device=dev, dtype=dt, seed=a.seed, sampling="start", pushes=False,
|
|
443
|
+
obs_noise=False, reset_noise=False, sigma=EASY_SIGMA, noise_seed=a.seed, residual=a.residual) if easy_cfg else None)
|
|
444
|
+
agent = S.SapoBM(env, cfg, seed=a.seed)
|
|
445
|
+
probe = ActionPathProbe(env, a.residual)
|
|
446
|
+
active, first, resumed_from = 0.0, 1, None
|
|
447
|
+
if a.resume:
|
|
448
|
+
rs = torch.load(out / "resume.pt", weights_only=False)
|
|
449
|
+
assert rs["seed"] == a.seed and rs["ship"] == ship and int(rs["it"]) < a.iters, (rs["it"], a.iters)
|
|
450
|
+
agent._start_window() # allocates the static S and the start observation, then everything is overwritten
|
|
451
|
+
agent.restore_all(rs["state"])
|
|
452
|
+
active, first, resumed_from = float(rs["active_s"]), int(rs["it"]) + 1, int(rs["it"])
|
|
453
|
+
assert agent.it == resumed_from
|
|
454
|
+
# train.jsonl stays one history: the crashed segment's file is kept whole as train.jsonl.seg<k>, and the rows up to the resume point
|
|
455
|
+
# are carried into the new train.jsonl (a cut last line, the crash's mid-write, is never carried)
|
|
456
|
+
k = len(list(out.glob("train.jsonl.seg*")))
|
|
457
|
+
old = out / "train.jsonl"
|
|
458
|
+
seg = out / f"train.jsonl.seg{k}"
|
|
459
|
+
old.rename(seg)
|
|
460
|
+
tt = seg.read_text()
|
|
461
|
+
lines = [x for x in tt.splitlines() if x.strip()]
|
|
462
|
+
if tt and not tt.endswith("\n"):
|
|
463
|
+
lines = lines[:-1]
|
|
464
|
+
keep = [x for x in lines if json.loads(x)["it"] <= resumed_from]
|
|
465
|
+
assert [json.loads(x)["it"] for x in keep] == list(range(1, resumed_from + 1)), "train.jsonl lacks rows before the resume point"
|
|
466
|
+
old.write_text("".join(x + "\n" for x in keep))
|
|
467
|
+
meta = json.loads((out / "meta.json").read_text())
|
|
468
|
+
meta.setdefault("resumed_from", []).append(dict(it=resumed_from, active_s=active, segment_file=seg.name, iters=a.iters,
|
|
469
|
+
mode="captured" if a.capture else "eager", run_env=renv))
|
|
470
|
+
meta["iters"] = a.iters
|
|
471
|
+
assert bool(meta["compiled"]) == compiled, ("the resumed run's compile mode", meta["compiled"], compiled)
|
|
472
|
+
meta.setdefault("compile_s_resumes", []).append(compile_s)
|
|
473
|
+
if easy_cfg: # easy.jsonl as train.jsonl: the segment kept whole, its rows to the resume point carried
|
|
474
|
+
ef, eseg = out / "easy.jsonl", out / f"easy.jsonl.seg{k}"
|
|
475
|
+
et = ef.read_text() if ef.exists() else ""
|
|
476
|
+
if ef.exists():
|
|
477
|
+
ef.rename(eseg)
|
|
478
|
+
el = [x for x in et.splitlines() if x.strip()]
|
|
479
|
+
if et and not et.endswith("\n"):
|
|
480
|
+
el = el[:-1]
|
|
481
|
+
ef.write_text("".join(x + "\n" for x in el if json.loads(x)["it"] <= resumed_from))
|
|
482
|
+
else:
|
|
483
|
+
meta = dict(seed=a.seed, n=a.n, H=a.H, iters=a.iters, ckpt_every=a.ckpt_every, ship=ship, npz=a.npz, overflow_done=bool(a.overflow_done),
|
|
484
|
+
gpu="cpu" if a.cpu else torch.cuda.get_device_name(),
|
|
485
|
+
torch=torch.__version__, run_env=renv, cfg=cfg, A=agent.A.tolist(), score=which, mode="captured" if a.capture else "eager",
|
|
486
|
+
compiled=compiled, env="BMTrack", compile_s=compile_s, easy=easy_cfg,
|
|
487
|
+
inductor_deterministic=bool(env.compile_deterministic) if compiled else None, # as the warm compile saw it
|
|
488
|
+
com_dr=bool(a.com_dr), com_scale=float(a.com_scale), residual=bool(a.residual),
|
|
489
|
+
note=("CoM draw on (theirs, once per world); " if a.com_dr else "CoM draw absent (favours us); ")
|
|
490
|
+
+ "self-contact substitute stricter than theirs; the same env and scorer as A2")
|
|
491
|
+
(out / "meta.json").write_text(json.dumps(meta, indent=1, default=str))
|
|
492
|
+
easy = None
|
|
493
|
+
if easy_cfg:
|
|
494
|
+
ep = out / "easy.jsonl"
|
|
495
|
+
assert a.resume or not (ep.exists() and ep.stat().st_size > 0), f"{ep} exists: a fresh run never appends to another's easy rows"
|
|
496
|
+
def crossing(w, it_, act_s): # PREREG_RG1: the crossing policy for sim2sim, outside the clock
|
|
497
|
+
torch.save(dict(snapshot=agent.checkpoint(), it=it_, active_s=act_s, which=w, seed=a.seed, ship=ship, residual=a.residual),
|
|
498
|
+
out / f"crossing_{w}.pt")
|
|
499
|
+
easy = Easy(easy_env, agent, easy_cfg["which"], easy_cfg["every"], easy_cfg["dense_until"], easy_cfg["sparse_every"], ep,
|
|
500
|
+
rows=[json.loads(x) for x in ep.read_text().splitlines() if x.strip()] if ep.exists() else (),
|
|
501
|
+
mpkpe_bar=easy_cfg.get("mpkpe_bar"), on_pass=crossing,
|
|
502
|
+
secondary=RG1_SECONDARY if easy_cfg.get("mpkpe_bar") is not None else None, secondary_every=RG1_SECONDARY_EVERY)
|
|
503
|
+
log = open(out / "train.jsonl", "a")
|
|
504
|
+
if a.resume and a.capture: # a resumed run captures before its first update (outside the clock)
|
|
505
|
+
assert not a.cpu, "capture needs CUDA"
|
|
506
|
+
probe.skip("captured resume: the first step runs inside the capture; the mode is the resumed run's own (meta.json)")
|
|
507
|
+
agent.capture(warmup=a.capture_warmup)
|
|
508
|
+
train_law.read_aflags() # the warm-ups' adjoint counts are not an update's
|
|
509
|
+
for it in range(first, a.iters + 1):
|
|
510
|
+
sync(); t0 = raw_now()
|
|
511
|
+
s = agent.iteration()
|
|
512
|
+
sync()
|
|
513
|
+
active += raw_now() - t0
|
|
514
|
+
if it == 1 and compile_s is not None:
|
|
515
|
+
s["compile_s"] = compile_s # the compiled env's warm compile, before the clock
|
|
516
|
+
if it == first: # the training-path check of the action mapping (a host read, outside the clock)
|
|
517
|
+
pr = dict(probe.read(), it=it)
|
|
518
|
+
print("TRAINING PATH action base: " + json.dumps(pr), flush=True)
|
|
519
|
+
(out / f"probe_it{it}.json").write_text(json.dumps(pr) + "\n") # its own file: train rows stay comparable across A/Bs
|
|
520
|
+
# the launch pipeline's instrument (the review 11-11): wall time at the end of this process's first update, outside the
|
|
521
|
+
# clock; fetch.py reports commit -> runner START -> FIRST_UPDATE from it. One line per process, the same format in every trainer
|
|
522
|
+
print(f"FIRST_UPDATE {time.strftime('%Y-%m-%dT%H:%M:%S%z')} it={it}", flush=True)
|
|
523
|
+
if not a.cpu: # the review, 11-11: the engine's flag bits for this update, from the env's per-world
|
|
524
|
+
# accumulators (overflow-as-done: BMTrack reads and zeroes the engine's word after every step): the OR of all bits, the
|
|
525
|
+
# worlds with kFlagOverflow (1, nefc > NR: the step not solved, its tape record invalid) and kFlagHandOverflow (256, an L2
|
|
526
|
+
# capacity exceeded), and the overflowed world-steps; one host read, outside the clock
|
|
527
|
+
s["eng_flags_or"], s["ovf_world_steps"] = env.read_overflow()
|
|
528
|
+
s["eng_overflow_worlds"], s["eng_hand_overflow_worlds"] = env.last_overflow_worlds
|
|
529
|
+
if a.overflow_done: # the trainer's count of the env's truncations (SapoBM's "overflow") is the env's own count
|
|
530
|
+
assert s["overflow"] == s["ovf_world_steps"], (f"update {it}: the trainer saw {s['overflow']} overflowed world-steps, "
|
|
531
|
+
f"the env counted {s['ovf_world_steps']}")
|
|
532
|
+
if not a.cpu: # the adjoint's overflow flags for this update (a host read, outside the clock)
|
|
533
|
+
s["aflag_bad"], s["aflag_or"] = train_law.read_aflags()
|
|
534
|
+
s["aflag_frac"] = check_aflags(s["aflag_bad"], a.n, a.H, a.aflag_max_frac)
|
|
535
|
+
if it == 1 and a.capture:
|
|
536
|
+
assert not a.cpu, "capture needs CUDA"
|
|
537
|
+
sync(); tc = raw_now()
|
|
538
|
+
agent.capture(warmup=a.capture_warmup) # outside the clock (setup), as InstantMimic excludes its compile and capture
|
|
539
|
+
sync(); s["capture_setup_s"] = raw_now() - tc
|
|
540
|
+
train_law.read_aflags() # the capture's warm-ups ran the adjoint: their counts are not an update's
|
|
541
|
+
if not a.cpu: # the trainer's peak device memory so far (a host query, outside the clock)
|
|
542
|
+
s["peak_alloc_gib"] = torch.cuda.max_memory_allocated() / 2 ** 30
|
|
543
|
+
row = dict(it=it, active_s=active, **{k: v for k, v in s.items() if isinstance(v, (int, float))})
|
|
544
|
+
if resumed_from is not None:
|
|
545
|
+
row["resumed_from"] = resumed_from
|
|
546
|
+
log.write(json.dumps(row) + "\n")
|
|
547
|
+
if it % 50 == 0: # durable every 50 updates (a fault loses at most 50 rows); outside the clock
|
|
548
|
+
log.flush(); os.fsync(log.fileno())
|
|
549
|
+
if it % a.ckpt_every == 0:
|
|
550
|
+
p = out / f"checkpoint_iter_{it}.pt"
|
|
551
|
+
torch.save(dict(snapshot=agent.checkpoint(), it=it, active_s=active, seed=a.seed, ship=ship), p)
|
|
552
|
+
tmp = out / "resume.pt.tmp" # the rolling resume state, replaced atomically (a crash mid-write keeps the old one)
|
|
553
|
+
torch.save(dict(state=agent.snapshot_all(bufs=False), it=it, active_s=active, seed=a.seed, ship=ship), tmp)
|
|
554
|
+
os.replace(tmp, out / "resume.pt")
|
|
555
|
+
log.flush(); os.fsync(log.fileno())
|
|
556
|
+
if easy is not None and easy.due(it): # PREREG_E1: outside the clock, after the update's records and checkpoint
|
|
557
|
+
easy.run(it, active)
|
|
558
|
+
log.close()
|
|
559
|
+
print(json.dumps(dict(iterations=a.iters, active_s=active, s_per_iter=active / max(1, a.iters - first + 1),
|
|
560
|
+
resumed_from=resumed_from)))
|
|
561
|
+
if a.no_eval:
|
|
562
|
+
return
|
|
563
|
+
del env, train_law
|
|
564
|
+
ckpts = [] # every segment's checkpoints (a resumed run scores the earlier ones too)
|
|
565
|
+
for q in out.glob("checkpoint_iter_*.pt"):
|
|
566
|
+
ck = torch.load(q, weights_only=False, map_location="cpu")
|
|
567
|
+
ckpts.append((int(ck["it"]), float(ck["active_s"]), q))
|
|
568
|
+
ckpts.sort()
|
|
569
|
+
score(agent, ckpts, m, lm, eval_law(a.eval_n), a.eval_n, ship, dev, dt, a.eval_seed or a.seed, which, out / "eval.jsonl", com_dr=a.com_dr, com_scale=a.com_scale,
|
|
570
|
+
residual=a.residual)
|
|
571
|
+
read_criteria(out)
|
|
572
|
+
print("A3 DONE")
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
if __name__ == "__main__":
|
|
576
|
+
main()
|