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.
Files changed (682) hide show
  1. diffneusim/__init__.py +1 -0
  2. diffneusim/_cache.py +42 -0
  3. diffneusim/_paths.py +5 -0
  4. diffneusim/bindings/rew14_ext.cu +115 -0
  5. diffneusim/bindings/soft14_capi.cpp +443 -0
  6. diffneusim/bindings/soft14_engine_ext.cu +596 -0
  7. diffneusim/bindings/soft_capi.cpp +782 -0
  8. diffneusim/bindings/soft_engine_ext.cu +495 -0
  9. diffneusim/core/cpu_engine/build.sh +40 -0
  10. diffneusim/core/cpu_engine/fiber/cuda_runtime.h +445 -0
  11. diffneusim/core/cpu_engine/x14_cpu.cpp +283 -0
  12. diffneusim/core/diff/dual.h +126 -0
  13. diffneusim/core/include/diffneusim/macros.h +35 -0
  14. diffneusim/core/kin/kinematic_tree.h +273 -0
  15. diffneusim/core/math/so3.h +182 -0
  16. diffneusim/core/soft/adj/out_adj.h +102 -0
  17. diffneusim/core/soft/adj/rnea_adj.h +425 -0
  18. diffneusim/core/soft/adj/rows_adj.h +439 -0
  19. diffneusim/core/soft/adj/rows_functor.h +89 -0
  20. diffneusim/core/soft/adj/rows_lanes.h +443 -0
  21. diffneusim/core/soft/adj/shell_adj.h +243 -0
  22. diffneusim/core/soft/adj/tree_adj.h +356 -0
  23. diffneusim/core/soft/collide.h +183 -0
  24. diffneusim/core/soft/gpu/adj14.cuh +233 -0
  25. diffneusim/core/soft/gpu/adj14_mus.cuh +98 -0
  26. diffneusim/core/soft/gpu/adj_shell.cuh +50 -0
  27. diffneusim/core/soft/gpu/adj_tab.cuh +49 -0
  28. diffneusim/core/soft/gpu/body14.cuh +47 -0
  29. diffneusim/core/soft/gpu/chol_rn.cuh +458 -0
  30. diffneusim/core/soft/gpu/chol_small.cuh +123 -0
  31. diffneusim/core/soft/gpu/chol_split.cuh +193 -0
  32. diffneusim/core/soft/gpu/engine_launch.cuh +263 -0
  33. diffneusim/core/soft/gpu/fk_rn.cuh +109 -0
  34. diffneusim/core/soft/gpu/generated/body_019e20820f86_mmfloor.cuh +28 -0
  35. diffneusim/core/soft/gpu/generated/body_62f77a4bb16b_mmfloor.cuh +52 -0
  36. diffneusim/core/soft/gpu/generated/body_77dbb7213f26_mmfloor_rampsb3l_n6t12.cuh +28 -0
  37. diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rampsb3l_n6t12.cuh +28 -0
  38. diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rhlsd05_n6t12.cuh +28 -0
  39. diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rhlsdef_n6t12.cuh +28 -0
  40. diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rhlsmjd_n6t12.cuh +28 -0
  41. diffneusim/core/soft/gpu/generated/body_a1e8b196b2cd_mmfloor_rampsb3l_n6t12.cuh +52 -0
  42. diffneusim/core/soft/gpu/generated/body_a944653edd64_mmfloor.cuh +25 -0
  43. diffneusim/core/soft/gpu/generated/body_a944653edd64_mmfloor_rampsb3l_n6t12.cuh +25 -0
  44. diffneusim/core/soft/gpu/generated/g1_soft_5db44fd45286.cuh +74 -0
  45. diffneusim/core/soft/gpu/generated/split_62f77a4bb16b_mmfloor.cuh +18 -0
  46. diffneusim/core/soft/gpu/generated/split_a1e8b196b2cd_mmfloor_rampsb3l_n6t12.cuh +18 -0
  47. diffneusim/core/soft/gpu/generated/x14_soft_019e20820f86_mmfloor.cuh +123 -0
  48. diffneusim/core/soft/gpu/generated/x14_soft_62f77a4bb16b_mmfloor.cuh +129 -0
  49. diffneusim/core/soft/gpu/generated/x14_soft_77dbb7213f26_mmfloor_rampsb3l_n6t12.cuh +123 -0
  50. diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rampsb3l_n6t12.cuh +123 -0
  51. diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rhlsd05_n6t12.cuh +123 -0
  52. diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rhlsdef_n6t12.cuh +123 -0
  53. diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rhlsmjd_n6t12.cuh +123 -0
  54. diffneusim/core/soft/gpu/generated/x14_soft_a1e8b196b2cd_mmfloor_rampsb3l_n6t12.cuh +129 -0
  55. diffneusim/core/soft/gpu/generated/x14_soft_a944653edd64_mmfloor.cuh +123 -0
  56. diffneusim/core/soft/gpu/generated/x14_soft_a944653edd64_mmfloor_rampsb3l_n6t12.cuh +123 -0
  57. diffneusim/core/soft/gpu/k_mus.cuh +1038 -0
  58. diffneusim/core/soft/gpu/k_mus_host.cuh +377 -0
  59. diffneusim/core/soft/gpu/k_pre.cuh +52 -0
  60. diffneusim/core/soft/gpu/kernel_p.cuh +490 -0
  61. diffneusim/core/soft/gpu/kp14.cuh +465 -0
  62. diffneusim/core/soft/gpu/l2v2.cuh +367 -0
  63. diffneusim/core/soft/gpu/l2x14.cuh +319 -0
  64. diffneusim/core/soft/gpu/l3.cuh +1483 -0
  65. diffneusim/core/soft/gpu/model_view.cuh +48 -0
  66. diffneusim/core/soft/gpu/mus_case_fits.h +15 -0
  67. diffneusim/core/soft/gpu/mus_classes.h +182 -0
  68. diffneusim/core/soft/gpu/mus_row_cf.h +44 -0
  69. diffneusim/core/soft/gpu/rew14.cuh +177 -0
  70. diffneusim/core/soft/gpu/rows_ctab.cuh +44 -0
  71. diffneusim/core/soft/gpu/tree_m.cuh +247 -0
  72. diffneusim/core/soft/gpu/x14_engine_kernels.cuh +260 -0
  73. diffneusim/core/soft/gpu/x14_rowcf.h +14 -0
  74. diffneusim/core/soft/hand.h +124 -0
  75. diffneusim/core/soft/impedance.h +115 -0
  76. diffneusim/core/soft/jvp.h +202 -0
  77. diffneusim/core/soft/kin.h +250 -0
  78. diffneusim/core/soft/muscle.h +1208 -0
  79. diffneusim/core/soft/newton.h +371 -0
  80. diffneusim/core/soft/rows.h +176 -0
  81. diffneusim/core/soft/step.h +188 -0
  82. diffneusim/core/soft/tape.h +313 -0
  83. diffneusim/core/soft/x14/collide14.h +69 -0
  84. diffneusim/core/soft/x14/jvp14.h +182 -0
  85. diffneusim/core/soft/x14/law14.h +453 -0
  86. diffneusim/core/soft/x14adj/collide14_adj.h +134 -0
  87. diffneusim/core/soft/x14adj/passive14_adj.h +162 -0
  88. diffneusim/core/soft/x14adj/reward14.h +484 -0
  89. diffneusim/core/soft/x14adj/rows14_adj.h +400 -0
  90. diffneusim/core/soft/x14adj/scan14.h +349 -0
  91. diffneusim/core/soft/x14adj/shell14_adj.h +122 -0
  92. diffneusim/core/soft/x14adj/sweep14.h +255 -0
  93. diffneusim/core/soft/x14adj/tree14_adj.h +500 -0
  94. diffneusim/core/soft/x14adj/x14adj_common.h +96 -0
  95. diffneusim/data/mirror/H1622v2k_geyer_hfdeq.npz +0 -0
  96. diffneusim/data/mirror/H1622v2k_hfd.npz +0 -0
  97. diffneusim/data/mirror/H1622v2k_millard_hfdeq.npz +0 -0
  98. diffneusim/data/mirror/fullbody_contact.npz +0 -0
  99. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard.npz +0 -0
  100. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_p2str.npz +0 -0
  101. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_p2str_rigid.npz +0 -0
  102. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.npz +0 -0
  103. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid.npz +0 -0
  104. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq.npz +0 -0
  105. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin.npz +0 -0
  106. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_calf2_pe.npz +0 -0
  107. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc.npz +0 -0
  108. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_axfix.npz +0 -0
  109. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_axfixlegs01.npz +0 -0
  110. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_jd01.npz +0 -0
  111. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_jd01legs.npz +0 -0
  112. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_jd01lumbar.npz +0 -0
  113. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_lumbfix.npz +0 -0
  114. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_lumbfixlegs01.npz +0 -0
  115. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.npz +0 -0
  116. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1a.npz +0 -0
  117. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n2.npz +0 -0
  118. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_rom23.npz +0 -0
  119. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair.npz +0 -0
  120. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc.npz +0 -0
  121. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_hinge.npz +0 -0
  122. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.npz +0 -0
  123. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1a.npz +0 -0
  124. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n2.npz +0 -0
  125. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_rom23.npz +0 -0
  126. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_lspine_girdle_osimeq.npz +0 -0
  127. diffneusim/data/mirror/fullbody_contact_spinecoupled_lspine_girdle_millard.npz +0 -0
  128. diffneusim/data/mirror/fullbody_contact_spinecoupled_lspine_girdle_osimeq.npz +0 -0
  129. diffneusim/data/mirror/myoleg26_3d_compound_g14eq.npz +0 -0
  130. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq.npz +0 -0
  131. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose.npz +0 -0
  132. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin.npz +0 -0
  133. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30.npz +0 -0
  134. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30_hip30.npz +0 -0
  135. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30_hip30_luispe.npz +0 -0
  136. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30_hip30_trunk0701.npz +0 -0
  137. diffneusim/data/muscle_fit/wang_mass_volume_14t.json +91 -0
  138. diffneusim/data/muscle_fit/wang_mass_volume_14t_axfix.json +91 -0
  139. diffneusim/data/muscle_fit/wang_mass_volume_14t_axfixlegs01.json +91 -0
  140. diffneusim/data/muscle_fit/wang_mass_volume_14t_jd01.json +91 -0
  141. diffneusim/data/muscle_fit/wang_mass_volume_14t_jd01legs.json +91 -0
  142. diffneusim/data/muscle_fit/wang_mass_volume_14t_jd01lumbar.json +91 -0
  143. diffneusim/data/muscle_fit/wang_mass_volume_14t_lumbfix.json +91 -0
  144. diffneusim/data/muscle_fit/wang_mass_volume_14t_lumbfixlegs01.json +91 -0
  145. diffneusim/data/muscle_fit/wang_mass_volume_14t_n1.json +91 -0
  146. diffneusim/data/muscle_fit/wang_mass_volume_14t_n1a.json +91 -0
  147. diffneusim/data/muscle_fit/wang_mass_volume_14t_n2.json +91 -0
  148. diffneusim/data/muscle_fit/wang_mass_volume_14t_rom23.json +91 -0
  149. diffneusim/data/reference/musclemimic/myofullbody_mimic_sites.json +261 -0
  150. diffneusim/data/reference/pose3/pose3_scone.json +305 -0
  151. diffneusim/data/reference/pose3/pose3_scone.txt +3 -0
  152. diffneusim/data/reference/pose3/pose3_scone_gait.npz +0 -0
  153. diffneusim/data/reference/pose3/pose3_scone_mirror.npz +0 -0
  154. diffneusim/data/reference/pose3/pose3_scone_stand.npz +0 -0
  155. diffneusim/data/reference/x016run/MD5SUMS +241 -0
  156. diffneusim/data/reference/x016run/x016run_states.txt +240 -0
  157. diffneusim/data/reference/x016run/x016run_v3p00_s0_l0.npz +0 -0
  158. diffneusim/data/reference/x016run/x016run_v3p00_s0_l1.npz +0 -0
  159. diffneusim/data/reference/x016run/x016run_v3p00_s0_l2.npz +0 -0
  160. diffneusim/data/reference/x016run/x016run_v3p00_s0_l3.npz +0 -0
  161. diffneusim/data/reference/x016run/x016run_v3p00_s0_r0.npz +0 -0
  162. diffneusim/data/reference/x016run/x016run_v3p00_s0_r1.npz +0 -0
  163. diffneusim/data/reference/x016run/x016run_v3p00_s0_r2.npz +0 -0
  164. diffneusim/data/reference/x016run/x016run_v3p00_s0_r3.npz +0 -0
  165. diffneusim/data/reference/x016run/x016run_v3p00_s1_l0.npz +0 -0
  166. diffneusim/data/reference/x016run/x016run_v3p00_s1_l1.npz +0 -0
  167. diffneusim/data/reference/x016run/x016run_v3p00_s1_l2.npz +0 -0
  168. diffneusim/data/reference/x016run/x016run_v3p00_s1_l3.npz +0 -0
  169. diffneusim/data/reference/x016run/x016run_v3p00_s1_r0.npz +0 -0
  170. diffneusim/data/reference/x016run/x016run_v3p00_s1_r1.npz +0 -0
  171. diffneusim/data/reference/x016run/x016run_v3p00_s1_r2.npz +0 -0
  172. diffneusim/data/reference/x016run/x016run_v3p00_s1_r3.npz +0 -0
  173. diffneusim/data/reference/x016run/x016run_v3p00_s2_l0.npz +0 -0
  174. diffneusim/data/reference/x016run/x016run_v3p00_s2_l1.npz +0 -0
  175. diffneusim/data/reference/x016run/x016run_v3p00_s2_l2.npz +0 -0
  176. diffneusim/data/reference/x016run/x016run_v3p00_s2_l3.npz +0 -0
  177. diffneusim/data/reference/x016run/x016run_v3p00_s2_r0.npz +0 -0
  178. diffneusim/data/reference/x016run/x016run_v3p00_s2_r1.npz +0 -0
  179. diffneusim/data/reference/x016run/x016run_v3p00_s2_r2.npz +0 -0
  180. diffneusim/data/reference/x016run/x016run_v3p00_s2_r3.npz +0 -0
  181. diffneusim/data/reference/x016run/x016run_v3p00_s3_l0.npz +0 -0
  182. diffneusim/data/reference/x016run/x016run_v3p00_s3_l1.npz +0 -0
  183. diffneusim/data/reference/x016run/x016run_v3p00_s3_l2.npz +0 -0
  184. diffneusim/data/reference/x016run/x016run_v3p00_s3_l3.npz +0 -0
  185. diffneusim/data/reference/x016run/x016run_v3p00_s3_r0.npz +0 -0
  186. diffneusim/data/reference/x016run/x016run_v3p00_s3_r1.npz +0 -0
  187. diffneusim/data/reference/x016run/x016run_v3p00_s3_r2.npz +0 -0
  188. diffneusim/data/reference/x016run/x016run_v3p00_s3_r3.npz +0 -0
  189. diffneusim/data/reference/x016run/x016run_v3p00_s4_l0.npz +0 -0
  190. diffneusim/data/reference/x016run/x016run_v3p00_s4_l1.npz +0 -0
  191. diffneusim/data/reference/x016run/x016run_v3p00_s4_l2.npz +0 -0
  192. diffneusim/data/reference/x016run/x016run_v3p00_s4_l3.npz +0 -0
  193. diffneusim/data/reference/x016run/x016run_v3p00_s4_r0.npz +0 -0
  194. diffneusim/data/reference/x016run/x016run_v3p00_s4_r1.npz +0 -0
  195. diffneusim/data/reference/x016run/x016run_v3p00_s4_r2.npz +0 -0
  196. diffneusim/data/reference/x016run/x016run_v3p00_s4_r3.npz +0 -0
  197. diffneusim/data/reference/x016run/x016run_v3p00_s5_l0.npz +0 -0
  198. diffneusim/data/reference/x016run/x016run_v3p00_s5_l1.npz +0 -0
  199. diffneusim/data/reference/x016run/x016run_v3p00_s5_l2.npz +0 -0
  200. diffneusim/data/reference/x016run/x016run_v3p00_s5_l3.npz +0 -0
  201. diffneusim/data/reference/x016run/x016run_v3p00_s5_r0.npz +0 -0
  202. diffneusim/data/reference/x016run/x016run_v3p00_s5_r1.npz +0 -0
  203. diffneusim/data/reference/x016run/x016run_v3p00_s5_r2.npz +0 -0
  204. diffneusim/data/reference/x016run/x016run_v3p00_s5_r3.npz +0 -0
  205. diffneusim/data/reference/x016run/x016run_v3p00_s6_l0.npz +0 -0
  206. diffneusim/data/reference/x016run/x016run_v3p00_s6_l1.npz +0 -0
  207. diffneusim/data/reference/x016run/x016run_v3p00_s6_l2.npz +0 -0
  208. diffneusim/data/reference/x016run/x016run_v3p00_s6_l3.npz +0 -0
  209. diffneusim/data/reference/x016run/x016run_v3p00_s6_r0.npz +0 -0
  210. diffneusim/data/reference/x016run/x016run_v3p00_s6_r1.npz +0 -0
  211. diffneusim/data/reference/x016run/x016run_v3p00_s6_r2.npz +0 -0
  212. diffneusim/data/reference/x016run/x016run_v3p00_s6_r3.npz +0 -0
  213. diffneusim/data/reference/x016run/x016run_v3p00_s7_l0.npz +0 -0
  214. diffneusim/data/reference/x016run/x016run_v3p00_s7_l1.npz +0 -0
  215. diffneusim/data/reference/x016run/x016run_v3p00_s7_l2.npz +0 -0
  216. diffneusim/data/reference/x016run/x016run_v3p00_s7_l3.npz +0 -0
  217. diffneusim/data/reference/x016run/x016run_v3p00_s7_r0.npz +0 -0
  218. diffneusim/data/reference/x016run/x016run_v3p00_s7_r1.npz +0 -0
  219. diffneusim/data/reference/x016run/x016run_v3p00_s7_r2.npz +0 -0
  220. diffneusim/data/reference/x016run/x016run_v3p00_s7_r3.npz +0 -0
  221. diffneusim/data/reference/x016run/x016run_v3p25_s0_l0.npz +0 -0
  222. diffneusim/data/reference/x016run/x016run_v3p25_s0_l1.npz +0 -0
  223. diffneusim/data/reference/x016run/x016run_v3p25_s0_l2.npz +0 -0
  224. diffneusim/data/reference/x016run/x016run_v3p25_s0_l3.npz +0 -0
  225. diffneusim/data/reference/x016run/x016run_v3p25_s0_r0.npz +0 -0
  226. diffneusim/data/reference/x016run/x016run_v3p25_s0_r1.npz +0 -0
  227. diffneusim/data/reference/x016run/x016run_v3p25_s0_r2.npz +0 -0
  228. diffneusim/data/reference/x016run/x016run_v3p25_s0_r3.npz +0 -0
  229. diffneusim/data/reference/x016run/x016run_v3p25_s1_l0.npz +0 -0
  230. diffneusim/data/reference/x016run/x016run_v3p25_s1_l1.npz +0 -0
  231. diffneusim/data/reference/x016run/x016run_v3p25_s1_l2.npz +0 -0
  232. diffneusim/data/reference/x016run/x016run_v3p25_s1_l3.npz +0 -0
  233. diffneusim/data/reference/x016run/x016run_v3p25_s1_r0.npz +0 -0
  234. diffneusim/data/reference/x016run/x016run_v3p25_s1_r1.npz +0 -0
  235. diffneusim/data/reference/x016run/x016run_v3p25_s1_r2.npz +0 -0
  236. diffneusim/data/reference/x016run/x016run_v3p25_s1_r3.npz +0 -0
  237. diffneusim/data/reference/x016run/x016run_v3p25_s2_l0.npz +0 -0
  238. diffneusim/data/reference/x016run/x016run_v3p25_s2_l1.npz +0 -0
  239. diffneusim/data/reference/x016run/x016run_v3p25_s2_l2.npz +0 -0
  240. diffneusim/data/reference/x016run/x016run_v3p25_s2_l3.npz +0 -0
  241. diffneusim/data/reference/x016run/x016run_v3p25_s2_r0.npz +0 -0
  242. diffneusim/data/reference/x016run/x016run_v3p25_s2_r1.npz +0 -0
  243. diffneusim/data/reference/x016run/x016run_v3p25_s2_r2.npz +0 -0
  244. diffneusim/data/reference/x016run/x016run_v3p25_s2_r3.npz +0 -0
  245. diffneusim/data/reference/x016run/x016run_v3p25_s3_l0.npz +0 -0
  246. diffneusim/data/reference/x016run/x016run_v3p25_s3_l1.npz +0 -0
  247. diffneusim/data/reference/x016run/x016run_v3p25_s3_l2.npz +0 -0
  248. diffneusim/data/reference/x016run/x016run_v3p25_s3_l3.npz +0 -0
  249. diffneusim/data/reference/x016run/x016run_v3p25_s3_r0.npz +0 -0
  250. diffneusim/data/reference/x016run/x016run_v3p25_s3_r1.npz +0 -0
  251. diffneusim/data/reference/x016run/x016run_v3p25_s3_r2.npz +0 -0
  252. diffneusim/data/reference/x016run/x016run_v3p25_s3_r3.npz +0 -0
  253. diffneusim/data/reference/x016run/x016run_v3p25_s4_l0.npz +0 -0
  254. diffneusim/data/reference/x016run/x016run_v3p25_s4_l1.npz +0 -0
  255. diffneusim/data/reference/x016run/x016run_v3p25_s4_l2.npz +0 -0
  256. diffneusim/data/reference/x016run/x016run_v3p25_s4_l3.npz +0 -0
  257. diffneusim/data/reference/x016run/x016run_v3p25_s4_r0.npz +0 -0
  258. diffneusim/data/reference/x016run/x016run_v3p25_s4_r1.npz +0 -0
  259. diffneusim/data/reference/x016run/x016run_v3p25_s4_r2.npz +0 -0
  260. diffneusim/data/reference/x016run/x016run_v3p25_s4_r3.npz +0 -0
  261. diffneusim/data/reference/x016run/x016run_v3p25_s5_l0.npz +0 -0
  262. diffneusim/data/reference/x016run/x016run_v3p25_s5_l1.npz +0 -0
  263. diffneusim/data/reference/x016run/x016run_v3p25_s5_l2.npz +0 -0
  264. diffneusim/data/reference/x016run/x016run_v3p25_s5_l3.npz +0 -0
  265. diffneusim/data/reference/x016run/x016run_v3p25_s5_r0.npz +0 -0
  266. diffneusim/data/reference/x016run/x016run_v3p25_s5_r1.npz +0 -0
  267. diffneusim/data/reference/x016run/x016run_v3p25_s5_r2.npz +0 -0
  268. diffneusim/data/reference/x016run/x016run_v3p25_s5_r3.npz +0 -0
  269. diffneusim/data/reference/x016run/x016run_v3p25_s6_l0.npz +0 -0
  270. diffneusim/data/reference/x016run/x016run_v3p25_s6_l1.npz +0 -0
  271. diffneusim/data/reference/x016run/x016run_v3p25_s6_l2.npz +0 -0
  272. diffneusim/data/reference/x016run/x016run_v3p25_s6_l3.npz +0 -0
  273. diffneusim/data/reference/x016run/x016run_v3p25_s6_r0.npz +0 -0
  274. diffneusim/data/reference/x016run/x016run_v3p25_s6_r1.npz +0 -0
  275. diffneusim/data/reference/x016run/x016run_v3p25_s6_r2.npz +0 -0
  276. diffneusim/data/reference/x016run/x016run_v3p25_s6_r3.npz +0 -0
  277. diffneusim/data/reference/x016run/x016run_v3p25_s7_l0.npz +0 -0
  278. diffneusim/data/reference/x016run/x016run_v3p25_s7_l1.npz +0 -0
  279. diffneusim/data/reference/x016run/x016run_v3p25_s7_l2.npz +0 -0
  280. diffneusim/data/reference/x016run/x016run_v3p25_s7_l3.npz +0 -0
  281. diffneusim/data/reference/x016run/x016run_v3p25_s7_r0.npz +0 -0
  282. diffneusim/data/reference/x016run/x016run_v3p25_s7_r1.npz +0 -0
  283. diffneusim/data/reference/x016run/x016run_v3p25_s7_r2.npz +0 -0
  284. diffneusim/data/reference/x016run/x016run_v3p25_s7_r3.npz +0 -0
  285. diffneusim/data/reference/x016run/x016run_v3p50_s0_l0.npz +0 -0
  286. diffneusim/data/reference/x016run/x016run_v3p50_s0_l1.npz +0 -0
  287. diffneusim/data/reference/x016run/x016run_v3p50_s0_l2.npz +0 -0
  288. diffneusim/data/reference/x016run/x016run_v3p50_s0_l3.npz +0 -0
  289. diffneusim/data/reference/x016run/x016run_v3p50_s0_r0.npz +0 -0
  290. diffneusim/data/reference/x016run/x016run_v3p50_s0_r1.npz +0 -0
  291. diffneusim/data/reference/x016run/x016run_v3p50_s0_r2.npz +0 -0
  292. diffneusim/data/reference/x016run/x016run_v3p50_s0_r3.npz +0 -0
  293. diffneusim/data/reference/x016run/x016run_v3p50_s1_l0.npz +0 -0
  294. diffneusim/data/reference/x016run/x016run_v3p50_s1_l1.npz +0 -0
  295. diffneusim/data/reference/x016run/x016run_v3p50_s1_l2.npz +0 -0
  296. diffneusim/data/reference/x016run/x016run_v3p50_s1_l3.npz +0 -0
  297. diffneusim/data/reference/x016run/x016run_v3p50_s1_r0.npz +0 -0
  298. diffneusim/data/reference/x016run/x016run_v3p50_s1_r1.npz +0 -0
  299. diffneusim/data/reference/x016run/x016run_v3p50_s1_r2.npz +0 -0
  300. diffneusim/data/reference/x016run/x016run_v3p50_s1_r3.npz +0 -0
  301. diffneusim/data/reference/x016run/x016run_v3p50_s2_l0.npz +0 -0
  302. diffneusim/data/reference/x016run/x016run_v3p50_s2_l1.npz +0 -0
  303. diffneusim/data/reference/x016run/x016run_v3p50_s2_l2.npz +0 -0
  304. diffneusim/data/reference/x016run/x016run_v3p50_s2_l3.npz +0 -0
  305. diffneusim/data/reference/x016run/x016run_v3p50_s2_r0.npz +0 -0
  306. diffneusim/data/reference/x016run/x016run_v3p50_s2_r1.npz +0 -0
  307. diffneusim/data/reference/x016run/x016run_v3p50_s2_r2.npz +0 -0
  308. diffneusim/data/reference/x016run/x016run_v3p50_s2_r3.npz +0 -0
  309. diffneusim/data/reference/x016run/x016run_v3p50_s3_l0.npz +0 -0
  310. diffneusim/data/reference/x016run/x016run_v3p50_s3_l1.npz +0 -0
  311. diffneusim/data/reference/x016run/x016run_v3p50_s3_l2.npz +0 -0
  312. diffneusim/data/reference/x016run/x016run_v3p50_s3_l3.npz +0 -0
  313. diffneusim/data/reference/x016run/x016run_v3p50_s3_r0.npz +0 -0
  314. diffneusim/data/reference/x016run/x016run_v3p50_s3_r1.npz +0 -0
  315. diffneusim/data/reference/x016run/x016run_v3p50_s3_r2.npz +0 -0
  316. diffneusim/data/reference/x016run/x016run_v3p50_s3_r3.npz +0 -0
  317. diffneusim/data/reference/x016run/x016run_v3p50_s5_l0.npz +0 -0
  318. diffneusim/data/reference/x016run/x016run_v3p50_s5_l1.npz +0 -0
  319. diffneusim/data/reference/x016run/x016run_v3p50_s5_l2.npz +0 -0
  320. diffneusim/data/reference/x016run/x016run_v3p50_s5_l3.npz +0 -0
  321. diffneusim/data/reference/x016run/x016run_v3p50_s5_r0.npz +0 -0
  322. diffneusim/data/reference/x016run/x016run_v3p50_s5_r1.npz +0 -0
  323. diffneusim/data/reference/x016run/x016run_v3p50_s5_r2.npz +0 -0
  324. diffneusim/data/reference/x016run/x016run_v3p50_s5_r3.npz +0 -0
  325. diffneusim/data/reference/x016run/x016run_v3p50_s6_l0.npz +0 -0
  326. diffneusim/data/reference/x016run/x016run_v3p50_s6_l1.npz +0 -0
  327. diffneusim/data/reference/x016run/x016run_v3p50_s6_l2.npz +0 -0
  328. diffneusim/data/reference/x016run/x016run_v3p50_s6_l3.npz +0 -0
  329. diffneusim/data/reference/x016run/x016run_v3p50_s6_r0.npz +0 -0
  330. diffneusim/data/reference/x016run/x016run_v3p50_s6_r1.npz +0 -0
  331. diffneusim/data/reference/x016run/x016run_v3p50_s6_r2.npz +0 -0
  332. diffneusim/data/reference/x016run/x016run_v3p50_s6_r3.npz +0 -0
  333. diffneusim/data/reference/x016run/x016run_v3p50_s7_l0.npz +0 -0
  334. diffneusim/data/reference/x016run/x016run_v3p50_s7_l1.npz +0 -0
  335. diffneusim/data/reference/x016run/x016run_v3p50_s7_l2.npz +0 -0
  336. diffneusim/data/reference/x016run/x016run_v3p50_s7_l3.npz +0 -0
  337. diffneusim/data/reference/x016run/x016run_v3p50_s7_r0.npz +0 -0
  338. diffneusim/data/reference/x016run/x016run_v3p50_s7_r1.npz +0 -0
  339. diffneusim/data/reference/x016run/x016run_v3p50_s7_r2.npz +0 -0
  340. diffneusim/data/reference/x016run/x016run_v3p50_s7_r3.npz +0 -0
  341. diffneusim/data/reference/x016run/x016run_v3p75_s0_l0.npz +0 -0
  342. diffneusim/data/reference/x016run/x016run_v3p75_s0_l1.npz +0 -0
  343. diffneusim/data/reference/x016run/x016run_v3p75_s0_l2.npz +0 -0
  344. diffneusim/data/reference/x016run/x016run_v3p75_s0_l3.npz +0 -0
  345. diffneusim/data/reference/x016run/x016run_v3p75_s0_r0.npz +0 -0
  346. diffneusim/data/reference/x016run/x016run_v3p75_s0_r1.npz +0 -0
  347. diffneusim/data/reference/x016run/x016run_v3p75_s0_r2.npz +0 -0
  348. diffneusim/data/reference/x016run/x016run_v3p75_s0_r3.npz +0 -0
  349. diffneusim/data/reference/x016run/x016run_v3p75_s1_l0.npz +0 -0
  350. diffneusim/data/reference/x016run/x016run_v3p75_s1_l1.npz +0 -0
  351. diffneusim/data/reference/x016run/x016run_v3p75_s1_l2.npz +0 -0
  352. diffneusim/data/reference/x016run/x016run_v3p75_s1_l3.npz +0 -0
  353. diffneusim/data/reference/x016run/x016run_v3p75_s1_r0.npz +0 -0
  354. diffneusim/data/reference/x016run/x016run_v3p75_s1_r1.npz +0 -0
  355. diffneusim/data/reference/x016run/x016run_v3p75_s1_r2.npz +0 -0
  356. diffneusim/data/reference/x016run/x016run_v3p75_s1_r3.npz +0 -0
  357. diffneusim/data/reference/x016run/x016run_v3p75_s2_l0.npz +0 -0
  358. diffneusim/data/reference/x016run/x016run_v3p75_s2_l1.npz +0 -0
  359. diffneusim/data/reference/x016run/x016run_v3p75_s2_l2.npz +0 -0
  360. diffneusim/data/reference/x016run/x016run_v3p75_s2_l3.npz +0 -0
  361. diffneusim/data/reference/x016run/x016run_v3p75_s2_r0.npz +0 -0
  362. diffneusim/data/reference/x016run/x016run_v3p75_s2_r1.npz +0 -0
  363. diffneusim/data/reference/x016run/x016run_v3p75_s2_r2.npz +0 -0
  364. diffneusim/data/reference/x016run/x016run_v3p75_s2_r3.npz +0 -0
  365. diffneusim/data/reference/x016run/x016run_v3p75_s3_l0.npz +0 -0
  366. diffneusim/data/reference/x016run/x016run_v3p75_s3_l1.npz +0 -0
  367. diffneusim/data/reference/x016run/x016run_v3p75_s3_l2.npz +0 -0
  368. diffneusim/data/reference/x016run/x016run_v3p75_s3_l3.npz +0 -0
  369. diffneusim/data/reference/x016run/x016run_v3p75_s3_r0.npz +0 -0
  370. diffneusim/data/reference/x016run/x016run_v3p75_s3_r1.npz +0 -0
  371. diffneusim/data/reference/x016run/x016run_v3p75_s3_r2.npz +0 -0
  372. diffneusim/data/reference/x016run/x016run_v3p75_s3_r3.npz +0 -0
  373. diffneusim/data/reference/x016run/x016run_v3p75_s5_l0.npz +0 -0
  374. diffneusim/data/reference/x016run/x016run_v3p75_s5_l1.npz +0 -0
  375. diffneusim/data/reference/x016run/x016run_v3p75_s5_l2.npz +0 -0
  376. diffneusim/data/reference/x016run/x016run_v3p75_s5_l3.npz +0 -0
  377. diffneusim/data/reference/x016run/x016run_v3p75_s5_r0.npz +0 -0
  378. diffneusim/data/reference/x016run/x016run_v3p75_s5_r1.npz +0 -0
  379. diffneusim/data/reference/x016run/x016run_v3p75_s5_r2.npz +0 -0
  380. diffneusim/data/reference/x016run/x016run_v3p75_s5_r3.npz +0 -0
  381. diffneusim/data/reference/x016run/x016run_v3p75_s6_l0.npz +0 -0
  382. diffneusim/data/reference/x016run/x016run_v3p75_s6_l1.npz +0 -0
  383. diffneusim/data/reference/x016run/x016run_v3p75_s6_l2.npz +0 -0
  384. diffneusim/data/reference/x016run/x016run_v3p75_s6_l3.npz +0 -0
  385. diffneusim/data/reference/x016run/x016run_v3p75_s6_r0.npz +0 -0
  386. diffneusim/data/reference/x016run/x016run_v3p75_s6_r1.npz +0 -0
  387. diffneusim/data/reference/x016run/x016run_v3p75_s6_r2.npz +0 -0
  388. diffneusim/data/reference/x016run/x016run_v3p75_s6_r3.npz +0 -0
  389. diffneusim/data/reference/x016run/x016run_v3p75_s7_l0.npz +0 -0
  390. diffneusim/data/reference/x016run/x016run_v3p75_s7_l1.npz +0 -0
  391. diffneusim/data/reference/x016run/x016run_v3p75_s7_l2.npz +0 -0
  392. diffneusim/data/reference/x016run/x016run_v3p75_s7_l3.npz +0 -0
  393. diffneusim/data/reference/x016run/x016run_v3p75_s7_r0.npz +0 -0
  394. diffneusim/data/reference/x016run/x016run_v3p75_s7_r1.npz +0 -0
  395. diffneusim/data/reference/x016run/x016run_v3p75_s7_r2.npz +0 -0
  396. diffneusim/data/reference/x016run/x016run_v3p75_s7_r3.npz +0 -0
  397. diffneusim/data/state_prior/lumbar_poly_fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc.npz +0 -0
  398. diffneusim/engine/__init__.py +0 -0
  399. diffneusim/engine/build_tag.py +52 -0
  400. diffneusim/engine/case_tables.py +46 -0
  401. diffneusim/engine/d16_body.py +80 -0
  402. diffneusim/engine/engine14.py +367 -0
  403. diffneusim/engine/gen_split.py +159 -0
  404. diffneusim/engine/hand_format.py +69 -0
  405. diffneusim/engine/live14.py +149 -0
  406. diffneusim/engine/phase_b_tree.py +137 -0
  407. diffneusim/engine/soft14.py +130 -0
  408. diffneusim/engine/soft_capi.py +373 -0
  409. diffneusim/engine/soft_engine.py +165 -0
  410. diffneusim/engine/step14.py +132 -0
  411. diffneusim/engine/tape_format.py +89 -0
  412. diffneusim/engine/x14cpu.py +163 -0
  413. diffneusim/env/__init__.py +0 -0
  414. diffneusim/env/absent.py +20 -0
  415. diffneusim/env/cpu14.py +105 -0
  416. diffneusim/env/e0loop14.py +224 -0
  417. diffneusim/env/env14.py +568 -0
  418. diffneusim/env/kin_contact14.py +193 -0
  419. diffneusim/env/mimic_sites_x14.json +366 -0
  420. diffneusim/env/old_count.py +78 -0
  421. diffneusim/env/rew14.py +114 -0
  422. diffneusim/env/rew14_hook.py +105 -0
  423. diffneusim/g1/__init__.py +1 -0
  424. diffneusim/g1/arm_a2.py +165 -0
  425. diffneusim/g1/arm_a3.py +576 -0
  426. diffneusim/g1/read_a3.py +79 -0
  427. diffneusim/g1/rg1_read.py +89 -0
  428. diffneusim/model/__init__.py +66 -0
  429. diffneusim/model/case.py +17 -0
  430. diffneusim/model/dnmodel.py +79 -0
  431. diffneusim/model/fuse_fixed.py +281 -0
  432. diffneusim/model/monitor.py +834 -0
  433. diffneusim/models/BODIES.toml +48 -0
  434. diffneusim/models/MANIFEST.toml +979 -0
  435. diffneusim/models/cases/G290/case.bin +0 -0
  436. diffneusim/models/cases/G290/case.json +1 -0
  437. diffneusim/models/cases/G356-SRC/case.bin +0 -0
  438. diffneusim/models/cases/G356-SRC/case.json +1 -0
  439. diffneusim/models/cases/G416/case.bin +0 -0
  440. diffneusim/models/cases/G416/case.json +1 -0
  441. diffneusim/models/cases/M290C-SRC/case.bin +0 -0
  442. diffneusim/models/cases/M290C-SRC/case.json +1 -0
  443. diffneusim/models/cases/M290R-SRC/case.bin +0 -0
  444. diffneusim/models/cases/M290R-SRC/case.json +1 -0
  445. diffneusim/models/cases/M356C-SRC/case.bin +0 -0
  446. diffneusim/models/cases/M356C-SRC/case.json +1 -0
  447. diffneusim/models/cases/M356R-SRC/case.bin +0 -0
  448. diffneusim/models/cases/M356R-SRC/case.json +1 -0
  449. diffneusim/models/cases/M416C-SRC/case.bin +0 -0
  450. diffneusim/models/cases/M416C-SRC/case.json +1 -0
  451. diffneusim/models/derived/d16_expanded_62f77a4bb16b1e67_mmfloor.xml +673 -0
  452. diffneusim/models/derived/d16_expanded_a1e8b196b2cd7b3c_mmfloor.xml +673 -0
  453. diffneusim/models/derived/d16_soft_law_019e20820f8633b9_mmfloor.json +7844 -0
  454. diffneusim/models/derived/d16_soft_law_62f77a4bb16b1e67_mmfloor.json +16855 -0
  455. diffneusim/models/derived/d16_soft_law_77dbb7213f26e821_mmfloor_rampsb3l_n6t12.json +7883 -0
  456. diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rampsb3l_n6t12.json +7883 -0
  457. diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rhlsd05_n6t12.json +7868 -0
  458. diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rhlsdef_n6t12.json +7868 -0
  459. diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rhlsmjd_n6t12.json +7868 -0
  460. diffneusim/models/derived/d16_soft_law_a1e8b196b2cd7b3c_mmfloor_rampsb3l_n6t12.json +16894 -0
  461. diffneusim/models/derived/d16_soft_law_a944653edd642082_mmfloor.json +12655 -0
  462. diffneusim/models/derived/d16_soft_law_a944653edd642082_mmfloor_rampsb3l_n6t12.json +12700 -0
  463. diffneusim/models/derived/unitree_g1_soft_law.json +15580 -0
  464. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.dnmodel +28913 -0
  465. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_qk.txt +1 -0
  466. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid.dnmodel +29202 -0
  467. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid_qk.txt +1 -0
  468. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_axfixlegs01.dnmodel +1 -0
  469. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.dnmodel +1 -0
  470. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1_qk.txt +1 -0
  471. diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.dnmodel +46970 -0
  472. diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_qk.txt +1 -0
  473. diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.dnmodel +1 -0
  474. diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1_qk.txt +1 -0
  475. diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.dnmodel +38570 -0
  476. diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_qk.txt +1 -0
  477. diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid.dnmodel +38923 -0
  478. diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid_qk.txt +1 -0
  479. diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.dnmodel +1 -0
  480. diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1_qk.txt +1 -0
  481. diffneusim/models/fullbody_meshes/1mc.stl +0 -0
  482. diffneusim/models/fullbody_meshes/2distph.stl +0 -0
  483. diffneusim/models/fullbody_meshes/2mc.stl +0 -0
  484. diffneusim/models/fullbody_meshes/2midph.stl +0 -0
  485. diffneusim/models/fullbody_meshes/2proxph.stl +0 -0
  486. diffneusim/models/fullbody_meshes/3distph.stl +0 -0
  487. diffneusim/models/fullbody_meshes/3mc.stl +0 -0
  488. diffneusim/models/fullbody_meshes/3midph.stl +0 -0
  489. diffneusim/models/fullbody_meshes/3proxph.stl +0 -0
  490. diffneusim/models/fullbody_meshes/4distph.stl +0 -0
  491. diffneusim/models/fullbody_meshes/4mc.stl +0 -0
  492. diffneusim/models/fullbody_meshes/4midph.stl +0 -0
  493. diffneusim/models/fullbody_meshes/4proxph.stl +0 -0
  494. diffneusim/models/fullbody_meshes/5distph.stl +0 -0
  495. diffneusim/models/fullbody_meshes/5mc.stl +0 -0
  496. diffneusim/models/fullbody_meshes/5midph.stl +0 -0
  497. diffneusim/models/fullbody_meshes/5proxph.stl +0 -0
  498. diffneusim/models/fullbody_meshes/NOTICE +2 -0
  499. diffneusim/models/fullbody_meshes/capitate.stl +0 -0
  500. diffneusim/models/fullbody_meshes/clavicle.stl +0 -0
  501. diffneusim/models/fullbody_meshes/hamate.stl +0 -0
  502. diffneusim/models/fullbody_meshes/hat_cervical.stl +0 -0
  503. diffneusim/models/fullbody_meshes/hat_jaw.stl +0 -0
  504. diffneusim/models/fullbody_meshes/hat_skull.stl +0 -0
  505. diffneusim/models/fullbody_meshes/humerus.stl +0 -0
  506. diffneusim/models/fullbody_meshes/l_bofoot.stl +0 -0
  507. diffneusim/models/fullbody_meshes/l_femur.stl +0 -0
  508. diffneusim/models/fullbody_meshes/l_fibula.stl +0 -0
  509. diffneusim/models/fullbody_meshes/l_foot.stl +0 -0
  510. diffneusim/models/fullbody_meshes/l_patella.stl +0 -0
  511. diffneusim/models/fullbody_meshes/l_pelvis.stl +0 -0
  512. diffneusim/models/fullbody_meshes/l_talus.stl +0 -0
  513. diffneusim/models/fullbody_meshes/l_tibia.stl +0 -0
  514. diffneusim/models/fullbody_meshes/lumbar1.stl +0 -0
  515. diffneusim/models/fullbody_meshes/lumbar2.stl +0 -0
  516. diffneusim/models/fullbody_meshes/lumbar3.stl +0 -0
  517. diffneusim/models/fullbody_meshes/lumbar4.stl +0 -0
  518. diffneusim/models/fullbody_meshes/lumbar5.stl +0 -0
  519. diffneusim/models/fullbody_meshes/lunate.stl +0 -0
  520. diffneusim/models/fullbody_meshes/pisiform.stl +0 -0
  521. diffneusim/models/fullbody_meshes/r_bofoot.stl +0 -0
  522. diffneusim/models/fullbody_meshes/r_femur.stl +0 -0
  523. diffneusim/models/fullbody_meshes/r_fibula.stl +0 -0
  524. diffneusim/models/fullbody_meshes/r_foot.stl +0 -0
  525. diffneusim/models/fullbody_meshes/r_patella.stl +0 -0
  526. diffneusim/models/fullbody_meshes/r_pelvis.stl +0 -0
  527. diffneusim/models/fullbody_meshes/r_talus.stl +0 -0
  528. diffneusim/models/fullbody_meshes/r_tibia.stl +0 -0
  529. diffneusim/models/fullbody_meshes/radius.stl +0 -0
  530. diffneusim/models/fullbody_meshes/sacrum.stl +0 -0
  531. diffneusim/models/fullbody_meshes/scaphoid.stl +0 -0
  532. diffneusim/models/fullbody_meshes/scapula.stl +0 -0
  533. diffneusim/models/fullbody_meshes/thoracic10_s.stl +0 -0
  534. diffneusim/models/fullbody_meshes/thoracic11_s.stl +0 -0
  535. diffneusim/models/fullbody_meshes/thoracic12_s.stl +0 -0
  536. diffneusim/models/fullbody_meshes/thoracic1_s.stl +0 -0
  537. diffneusim/models/fullbody_meshes/thoracic2_s.stl +0 -0
  538. diffneusim/models/fullbody_meshes/thoracic3_s.stl +0 -0
  539. diffneusim/models/fullbody_meshes/thoracic4_s.stl +0 -0
  540. diffneusim/models/fullbody_meshes/thoracic5_s.stl +0 -0
  541. diffneusim/models/fullbody_meshes/thoracic6_s.stl +0 -0
  542. diffneusim/models/fullbody_meshes/thoracic7_s.stl +0 -0
  543. diffneusim/models/fullbody_meshes/thoracic8_s.stl +0 -0
  544. diffneusim/models/fullbody_meshes/thoracic9_s.stl +0 -0
  545. diffneusim/models/fullbody_meshes/thorax.stl +0 -0
  546. diffneusim/models/fullbody_meshes/thumbdist.stl +0 -0
  547. diffneusim/models/fullbody_meshes/thumbprox.stl +0 -0
  548. diffneusim/models/fullbody_meshes/trapezium.stl +0 -0
  549. diffneusim/models/fullbody_meshes/trapezoid.stl +0 -0
  550. diffneusim/models/fullbody_meshes/triquetrum.stl +0 -0
  551. diffneusim/models/fullbody_meshes/ulna.stl +0 -0
  552. diffneusim/models/source/myo_fullbody/UPSTREAM.md +91 -0
  553. diffneusim/models/source/myoleg/UPSTREAM.md +52 -0
  554. diffneusim/models/source/unitree_g1/LICENSE.mjlab +202 -0
  555. diffneusim/models/source/unitree_g1/UPSTREAM.md +38 -0
  556. diffneusim/models/source/unitree_g1/assets/head_link.STL +0 -0
  557. diffneusim/models/source/unitree_g1/assets/left_ankle_pitch_link.STL +0 -0
  558. diffneusim/models/source/unitree_g1/assets/left_ankle_roll_link.STL +0 -0
  559. diffneusim/models/source/unitree_g1/assets/left_elbow_link.STL +0 -0
  560. diffneusim/models/source/unitree_g1/assets/left_hip_pitch_link.STL +0 -0
  561. diffneusim/models/source/unitree_g1/assets/left_hip_roll_link.STL +0 -0
  562. diffneusim/models/source/unitree_g1/assets/left_hip_yaw_link.STL +0 -0
  563. diffneusim/models/source/unitree_g1/assets/left_knee_link.STL +0 -0
  564. diffneusim/models/source/unitree_g1/assets/left_rubber_hand.STL +0 -0
  565. diffneusim/models/source/unitree_g1/assets/left_shoulder_pitch_link.STL +0 -0
  566. diffneusim/models/source/unitree_g1/assets/left_shoulder_roll_link.STL +0 -0
  567. diffneusim/models/source/unitree_g1/assets/left_shoulder_yaw_link.STL +0 -0
  568. diffneusim/models/source/unitree_g1/assets/left_wrist_pitch_link.STL +0 -0
  569. diffneusim/models/source/unitree_g1/assets/left_wrist_roll_link.STL +0 -0
  570. diffneusim/models/source/unitree_g1/assets/left_wrist_yaw_link.STL +0 -0
  571. diffneusim/models/source/unitree_g1/assets/logo_link.STL +0 -0
  572. diffneusim/models/source/unitree_g1/assets/pelvis.STL +0 -0
  573. diffneusim/models/source/unitree_g1/assets/pelvis_contour_link.STL +0 -0
  574. diffneusim/models/source/unitree_g1/assets/right_ankle_pitch_link.STL +0 -0
  575. diffneusim/models/source/unitree_g1/assets/right_ankle_roll_link.STL +0 -0
  576. diffneusim/models/source/unitree_g1/assets/right_elbow_link.STL +0 -0
  577. diffneusim/models/source/unitree_g1/assets/right_hip_pitch_link.STL +0 -0
  578. diffneusim/models/source/unitree_g1/assets/right_hip_roll_link.STL +0 -0
  579. diffneusim/models/source/unitree_g1/assets/right_hip_yaw_link.STL +0 -0
  580. diffneusim/models/source/unitree_g1/assets/right_knee_link.STL +0 -0
  581. diffneusim/models/source/unitree_g1/assets/right_rubber_hand.STL +0 -0
  582. diffneusim/models/source/unitree_g1/assets/right_shoulder_pitch_link.STL +0 -0
  583. diffneusim/models/source/unitree_g1/assets/right_shoulder_roll_link.STL +0 -0
  584. diffneusim/models/source/unitree_g1/assets/right_shoulder_yaw_link.STL +0 -0
  585. diffneusim/models/source/unitree_g1/assets/right_wrist_pitch_link.STL +0 -0
  586. diffneusim/models/source/unitree_g1/assets/right_wrist_roll_link.STL +0 -0
  587. diffneusim/models/source/unitree_g1/assets/right_wrist_yaw_link.STL +0 -0
  588. diffneusim/models/source/unitree_g1/assets/torso_link_rev_1_0.STL +0 -0
  589. diffneusim/models/source/unitree_g1/assets/waist_roll_link_rev_1_0.STL +0 -0
  590. diffneusim/models/source/unitree_g1/assets/waist_yaw_link_rev_1_0.STL +0 -0
  591. diffneusim/models/source/unitree_g1/dump_mjlab_reference.py +30 -0
  592. diffneusim/models/source/unitree_g1/g1.xml +308 -0
  593. diffneusim/models/source/unitree_g1/g1_constants.py +298 -0
  594. diffneusim/models/source/unitree_g1/mjlab_compiled_reference.json +857 -0
  595. diffneusim/models/unitree_g1.dnmodel +4393 -0
  596. diffneusim/models/unitree_g1_selfcol.dnmodel +20824 -0
  597. diffneusim/rl/__init__.py +2 -0
  598. diffneusim/rl/dynsyn_layer.py +146 -0
  599. diffneusim/rl/footstep_plan.py +337 -0
  600. diffneusim/rl/g1_bm_env.py +572 -0
  601. diffneusim/rl/g1_bm_eval.py +168 -0
  602. diffneusim/rl/g1_bm_fused.py +275 -0
  603. diffneusim/rl/g1_bm_ppo.py +622 -0
  604. diffneusim/rl/g1_bm_sapo.py +551 -0
  605. diffneusim/rl/g1_ppo.py +395 -0
  606. diffneusim/rl/g1_sapo_soft.py +240 -0
  607. diffneusim/rl/g1_soft_env.py +452 -0
  608. diffneusim/rl/g1_soft_grad.py +145 -0
  609. diffneusim/rl/geyer_curves_torch.py +108 -0
  610. diffneusim/rl/gpu_fullbody_vec_env.py +1241 -0
  611. diffneusim/rl/imitation.py +2027 -0
  612. diffneusim/rl/imitation_reward_v2.py +248 -0
  613. diffneusim/rl/imitation_reward_v3.py +349 -0
  614. diffneusim/rl/latent_task.py +175 -0
  615. diffneusim/rl/llc_reward.py +316 -0
  616. diffneusim/rl/millard_curves_torch.py +154 -0
  617. diffneusim/rl/mirror_symmetry.py +212 -0
  618. diffneusim/rl/model_path.py +35 -0
  619. diffneusim/rl/mvae_recon.py +123 -0
  620. diffneusim/rl/nets_shac.py +599 -0
  621. diffneusim/rl/reset_pool.py +154 -0
  622. diffneusim/rl/sapo_capture.py +873 -0
  623. diffneusim/rl/sapo_vec.py +1051 -0
  624. diffneusim/rl/shac_vec.py +346 -0
  625. diffneusim/rl/state_prior.py +151 -0
  626. diffneusim/rl/step_library.py +105 -0
  627. diffneusim/rl/task_walk_env.py +1793 -0
  628. diffneusim/rl/task_walk_reward.py +3300 -0
  629. diffneusim/run.py +23 -0
  630. diffneusim/run_env.py +46 -0
  631. diffneusim/tasks/__init__.py +147 -0
  632. diffneusim/tasks/legacy_names.py +63 -0
  633. diffneusim/tasks/paths.py +79 -0
  634. diffneusim/tasks/settings.py +202 -0
  635. diffneusim/third_party/instantmimic_947430ee/LICENSE +202 -0
  636. diffneusim/third_party/instantmimic_947430ee/NOTICE +19 -0
  637. diffneusim/third_party/instantmimic_947430ee/README.md +31 -0
  638. diffneusim/third_party/instantmimic_947430ee/instantmimic/envs/unitree_g1/tasks/beyondmimic_tracking/benchmark_protocol.py +106 -0
  639. diffneusim/third_party/instantmimic_947430ee/instantmimic/envs/unitree_g1/tasks/beyondmimic_tracking/metrics.py +214 -0
  640. diffneusim/third_party/instantmimic_947430ee/instantmimic/envs/unitree_g1/tasks/beyondmimic_tracking/reference.py +513 -0
  641. diffneusim/third_party/instantmimic_947430ee/instantmimic/motion/quaternion.py +193 -0
  642. diffneusim/train/__init__.py +0 -0
  643. diffneusim/train/eval_ckpt.py +239 -0
  644. diffneusim/train/eval_mimic.py +133 -0
  645. diffneusim/train/gait_report.py +203 -0
  646. diffneusim/train/gcot_chain.py +51 -0
  647. diffneusim/train/levers.py +135 -0
  648. diffneusim/train/masked_reset.py +314 -0
  649. diffneusim/train/rl_algorithm_suite.py +917 -0
  650. diffneusim/train/train14.py +240 -0
  651. diffneusim/train/train_tw14.py +674 -0
  652. diffneusim/viz/__init__.py +5 -0
  653. diffneusim/viz/__main__.py +41 -0
  654. diffneusim/viz/camera.py +115 -0
  655. diffneusim/viz/dnrec.py +118 -0
  656. diffneusim/viz/dnrec_io.py +686 -0
  657. diffneusim/viz/hud.py +565 -0
  658. diffneusim/viz/meshes.py +458 -0
  659. diffneusim/viz/play.py +237 -0
  660. diffneusim/viz/record.py +74 -0
  661. diffneusim/viz/render.py +1402 -0
  662. diffneusim/viz/renderer.py +268 -0
  663. diffneusim/viz/rl_env_render.py +635 -0
  664. diffneusim/viz/snapshot.py +54 -0
  665. diffneusim/viz/strobe.py +124 -0
  666. diffneusim/viz/to_mp4.py +58 -0
  667. diffneusim/viz/ui.py +481 -0
  668. diffneusim/viz/viewer.py +2086 -0
  669. diffneusim-1.0.0.dist-info/METADATA +226 -0
  670. diffneusim-1.0.0.dist-info/RECORD +682 -0
  671. diffneusim-1.0.0.dist-info/WHEEL +5 -0
  672. diffneusim-1.0.0.dist-info/licenses/LICENSE +201 -0
  673. diffneusim-1.0.0.dist-info/licenses/LICENSES/BSD-3-Clause-NC-ARMS-hand-wrist-4.3.txt +20 -0
  674. diffneusim-1.0.0.dist-info/licenses/LICENSES/BSD-3-Clause-NC-MoBL-ARMS.txt +25 -0
  675. diffneusim-1.0.0.dist-info/licenses/LICENSES/CC-BY-3.0-OpenSim-geometry.txt +25 -0
  676. diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Christophy2012-lumbarspine.txt +10 -0
  677. diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Lai2017-model-high-flex.txt +10 -0
  678. diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Lee2015-hand_muscle.txt +11 -0
  679. diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Rajagopal2016-full_body.txt +11 -0
  680. diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Uhlrich2022-fbmodpassivecal.txt +10 -0
  681. diffneusim-1.0.0.dist-info/licenses/NOTICE +274 -0
  682. diffneusim-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,674 @@
1
+ """feat/d16-taskwalk's training driver: tools/rl_algorithm_suite.py train, run from the tree's root with a cell's env file sourced, plus,
2
+ installed right after make_algo with no trainer source edit (as tools/e0speed/learn/train14.py on the E0 branches):
3
+ - the D16 engine: env14.install_from_env (E0_ENGINE14=1, E0_TREE14 = this tree, E0_MUSCLE_CASE the body's case), with the line's switches
4
+ required ON and proved at every control step by env14's own asserts: E0_ENV14_ACT14 (the reward's activation is the engine's op, old_act 0),
5
+ E0_ENV14_KINLATCH (the mirror latch on the D16 contact set, old_contact 0), E0_ENV14_GROUND14 (the reset grounded on the D16 foot geoms),
6
+ E0_ENV14_NO_OLD (old_sim 0), E0_ENV14_EQUIL14 (the reset's fibres at the D16 equilibrium); E0_ENV14_REW14=0 (the fused node refuses
7
+ taskwalk);
8
+ - one reset of every world right after the install: the env's constructor reset them on the old path (the old grounding and the old
9
+ engine's fibre equilibrium) and SapoVec.train does not reset at its start (memory: construction-reset-runs-before-env14-install), so
10
+ without it every world's first episode would start from the old path's state. Asserted: one GROUND14 call for all n worlds.
11
+ The imitation ban (PLAN.md 1.2b) is asserted too: no kickstart (SAPO_KICKSTART_*), the clip reset only as ks14t's own (D16_TW_RESET=ks14t_clip,
12
+ the design's 11-10 direction: a reset pose is a state value), no other imitation channel, no imitation
13
+ (DN_IMITATION), and a warm start (SUITE_INIT_CKPT) only from a checkpoint of this line: its run_config.json must carry this line's
14
+ switches and no kickstart and no further warm start (the R cells start from their W parent). A clip RESET in the parent's run is allowed
15
+ (the design's 11-10 rule via the review: the reference motion is never tracked; a reset pose is a state value).
16
+ The brake is off (the review's decision (A)): TASKWALK_W_BRAKE and _END must be 0.
17
+ Every argument after the script's name goes to rl_algorithm_suite.py unchanged."""
18
+ import atexit
19
+ import json
20
+ import os
21
+ import pathlib
22
+ import sys
23
+ import time
24
+
25
+
26
+ def RAW():
27
+ """CLOCK_MONOTONIC_RAW (s): neu's CLOCK_MONOTONIC (perf_counter) is slewed 1-10% and its REALTIME (time.time, the suite's log) stepped
28
+ ~1 s every ~33 s (memory: neu-perf-counter-slow-since-1106); RAW is clean"""
29
+ return time.clock_gettime(time.CLOCK_MONOTONIC_RAW)
30
+
31
+
32
+ T_IMPORT = RAW()
33
+ from diffneusim._paths import ROOT as ROOT # (3a) the repo root
34
+ # (3a) was: sys.path[:0] = [str(ROOT / "tools"), str(ROOT / "tools" / "diagnostics")]
35
+ import torch # noqa: E402
36
+ from diffneusim.train import rl_algorithm_suite as S # noqa: E402
37
+
38
+ KS14T_CLIP = "data/reference/cmu/07_01_loop_fullbody_lspine_ref.npz" # ks14t's TASKWALK_INIT_REF (its env file), md5 9e7f5d93
39
+ # PREREG_S290 Amendment 14 (the review, 11-12): the sprint's RUNNING-state reset, CMU 09_01 (subject 9, a straight run, 3.83 m/s) retargeted
40
+ # onto the lspine body with the tool's RUN grounding (one height shift, the flight kept) and looped without the walk-only re-grounding;
41
+ # a state sampler only (the reward never reads it), drawn by the same RSI-with-noise path as the walking clip. The md5 is asserted.
42
+ RUN_CLIP = ("data/reference/cmu/09_01_loop_fullbody_lspine_ref.npz", "cb4efee048b013de335c63cbb3cf142d")
43
+ # RESET-MA / RESET-S11 (11-12, the review; the design's 19:37 "solve the crouch gait"): STRAIGHT-KNEED walking resets, the two lab-derived
44
+ # loops the 10-17 survey found human-like at mid-stance (docs-dev/analysis/20261017_0310_reset_pose_0701_vs_s11). On N1-290 (the env's own
45
+ # imitation-task mapping): MyoAssist 1.28 m/s, knee landing 5.3 / 40 % 2.2, stance knee > 15 deg in 22 % of frames; subject 11 1.25 m/s,
46
+ # 4.5 / 4.5, 42 % (07_01: 1.41 m/s, 27.2 / 17.2, 96 %). State samplers only, drawn by the same RSI-with-noise path; the md5 is asserted.
47
+ MYOASSIST_CLIP = ("data/reference/cmu/myoassist_loop_fullbody_lspine_ref.npz", "c1f5d9937e4ac86b9fdf1cf74b1dfc55")
48
+ S11_CLIP = ("data/reference/cmu/rajagopal_s11_loop_fullbody_lspine_ref.npz", "2c53864a04845f3a550efddd4fe549bf")
49
+ # The pinned running-state reset clips, by D16_TW_RESET value; each drawn exactly as run_clip (the same RSI-with-noise path, TASKWALK_INIT_REF
50
+ # set to its path, its md5 asserted). run_clip_1646 (11-14, the design's faster running): CMU 16_46 (subject 16, a run at
51
+ # 4.36 m/s, 176 steps/min, step 1.49 m) by 09_01's retarget path, tools/reference/make_run_clip_lspine.sh 16_46 0.55 (b6be53b3a).
52
+ RUN_CLIPS = {"run_clip": RUN_CLIP,
53
+ "run_clip_1646": ("data/reference/cmu/16_46_loop_fullbody_lspine_ref.npz", "0c2115d44dfe3fc096d2dac2051956ba"),
54
+ "myoassist_clip": MYOASSIST_CLIP, "s11_clip": S11_CLIP}
55
+ # The pinned start-state SETS, by D16_TW_RESET value (11-17; the design's word via the review: predictive walking without human-motion
56
+ # initialization, three hard-coded starts "like SCONE"). pose3_scone: tools/d16_taskwalk/pose3/make_pose3.py's three states (SCONE's gait
57
+ # start mapped onto this body, its left-right mirror, the standing keyframe at rest), each a 1-frame LOOP clip in the model's own chart. The
58
+ # list goes in TASKWALK_INIT_REF; imitation.rsi draws a clip per world with equal probability (DN_CLIP_DRAW=clip) and, on T = 1, returns
59
+ # that frame itself (no blend), then the same RSI noise, limit clamp, ground14 and EQUIL14 as every clip reset. The list and every listed
60
+ # clip are md5-pinned; no other source of starts is allowed with it.
61
+ POSE_SETS = {"pose3_scone": ("data/reference/pose3/pose3_scone.txt", "d7e267ddb8254f464f4dad118f7bc6a1",
62
+ {"data/reference/pose3/pose3_scone_gait.npz": "3ecf41dbabf85150418f46e3d0545e0f",
63
+ "data/reference/pose3/pose3_scone_mirror.npz": "eeeeb30d1837db46b0b47cae0038d57d",
64
+ "data/reference/pose3/pose3_scone_stand.npz": "be0d7f466203245783bb7435840d2175"})}
65
+ # The pinned start-state LISTS, by D16_TW_RESET value (11-23; PREREG_S290 Amendment 16's start (b), the review 15:25): a list of many
66
+ # 1-frame clips in the pose3 format, drawn exactly as a POSE_SETS list (DN_CLIP_DRAW=clip: a clip per world with equal probability, then
67
+ # the same RSI noise, limit clamp, ground14 and EQUIL14). The list's md5 and its MD5SUMS file's md5 are pinned here, and every listed clip's
68
+ # md5 must be the one in that MD5SUMS. x016run_states: 256 single-support frames of the x016.1 s5 RUNNING chain's sampled evals (links 1-4,
69
+ # 2.90-3.65 m/s; the 2 STALL records skipped: 240 clips), tools/d16_taskwalk/x016run_states.py.
70
+ STATE_LISTS = {"x016run_states": ("data/reference/x016run/x016run_states.txt", "cbd4d081fa32d55224d9256bb90fbc8f", "5428303d502f6d5eb5e62ae1e8c791cd")}
71
+ from diffneusim.tasks.paths import announce as _announce
72
+ _announce("walking trainer")
73
+ ON = ("E0_ENGINE14", "E0_ENV14_ACT14", "E0_ENV14_KINLATCH", "E0_ENV14_GROUND14", "E0_ENV14_NO_OLD", "E0_ENV14_EQUIL14", "DN_TASKWALK",
74
+ "DN_MIRROR_SYM")
75
+
76
+
77
+ def check_env():
78
+ """the line's switches, the imitation ban, the brake, the tree, a warm start's ancestry: every assert before any construction"""
79
+ for k in ON:
80
+ assert os.environ.get(k) == "1", f"{k} must be 1 in this line's env file (set explicitly, recorded in run_config)"
81
+ assert os.environ.get("E0_ENV14_REW14") == "0", "E0_ENV14_REW14 must be 0: the fused node refuses taskwalk"
82
+ for k in ("SAPO_KICKSTART_CKPT", "SAPO_KICKSTART_W", "SAPO_KICKSTART_EPOCHS"):
83
+ assert not os.environ.get(k), f"{k} is banned in this line (PLAN.md 1.2b: no reference motion in training)"
84
+ rs = os.environ.get("D16_TW_RESET", "keyframe")
85
+ assert rs in ("keyframe", "ks14t_clip", "diag_states", *RUN_CLIPS, *POSE_SETS, *STATE_LISTS), \
86
+ f"D16_TW_RESET={rs!r}: keyframe, ks14t_clip, diag_states (eval only) or one of {list(RUN_CLIPS) + list(POSE_SETS) + list(STATE_LISTS)}"
87
+ if rs == "diag_states":
88
+ # (11-23; the review / 00:1x, the start-transient analysis) EVAL ONLY: the start states are a list of 1-frame clips cut from a record
89
+ # (GCOT 6.5 ep8450's own steady running, speedc/eval/steady_clips.py), drawn exactly as a POSE_SETS list (DN_CLIP_DRAW=clip, the same
90
+ # RSI noise, clamp, ground14 and EQUIL14). Refused in training (only eval_tw14 / eval_tw14_batched run it), without D16_TW_DIAG=steady_start,
91
+ # unless the list's md5 is D16_TW_DIAG_LIST_MD5 and every listed clip's md5 is the one in the MD5SUMS beside the list.
92
+ import hashlib
93
+ assert False, "D16_TW_RESET=diag_states needs D16_TW_DIAG=steady_start (an eval-only diagnostic)"
94
+ assert pathlib.Path(sys.argv[0]).name in ("eval_tw14.py", "eval_tw14_batched.py"), f"D16_TW_RESET=diag_states is EVAL ONLY, not {sys.argv[0]}"
95
+ lst = pathlib.Path(os.environ["TASKWALK_INIT_REF"])
96
+ got = hashlib.md5(lst.read_bytes()).hexdigest()
97
+ assert got == None, f"{lst}: md5 {got}, D16_TW_DIAG_LIST_MD5 {None!r}"
98
+ sums = dict(reversed(ln.split()) for ln in (lst.parent / "MD5SUMS").read_text().splitlines() if ln.strip())
99
+ for c in (ln.strip() for ln in lst.read_text().splitlines() if ln.strip()):
100
+ got = hashlib.md5(pathlib.Path(c).read_bytes()).hexdigest()
101
+ assert sums.get(pathlib.Path(c).name) == got, f"{c}: md5 {got}, MD5SUMS {sums.get(pathlib.Path(c).name)}"
102
+ for k in ("TASKWALK_INIT_REF_START", "TASKWALK_RSI_MIX_STEPS"):
103
+ assert not os.environ.get(k), f"diag_states: the listed states only ({k})"
104
+ elif rs == "keyframe":
105
+ assert not os.environ.get("TASKWALK_INIT_REF"), "TASKWALK_INIT_REF without D16_TW_RESET=ks14t_clip / a run clip"
106
+ elif rs == "ks14t_clip":
107
+ assert os.environ.get("TASKWALK_INIT_REF") == KS14T_CLIP, (os.environ.get("TASKWALK_INIT_REF"), KS14T_CLIP)
108
+ elif rs in STATE_LISTS:
109
+ import hashlib
110
+ lst, pin, sums_pin = STATE_LISTS[rs]
111
+ assert os.environ.get("TASKWALK_INIT_REF") == lst, (rs, os.environ.get("TASKWALK_INIT_REF"), lst)
112
+ got = hashlib.md5(pathlib.Path(lst).read_bytes()).hexdigest()
113
+ assert got == pin, f"{lst}: md5 {got}, pinned {pin}"
114
+ sp = pathlib.Path(lst).parent / "MD5SUMS"
115
+ got = hashlib.md5(sp.read_bytes()).hexdigest()
116
+ assert got == sums_pin, f"{sp}: md5 {got}, pinned {sums_pin}"
117
+ sums = dict(reversed(ln.split()) for ln in sp.read_text().splitlines() if ln.strip())
118
+ listed = [ln.strip() for ln in pathlib.Path(lst).read_text().splitlines() if ln.strip()]
119
+ assert listed and len(listed) == len(set(listed)), f"{lst}: empty or a clip listed twice"
120
+ for c in listed:
121
+ got = hashlib.md5(pathlib.Path(c).read_bytes()).hexdigest()
122
+ assert sums.get(pathlib.Path(c).name) == got, f"{c}: md5 {got}, MD5SUMS {sums.get(pathlib.Path(c).name)}"
123
+ for k in ("TASKWALK_INIT_REF_START", "TASKWALK_RSI_MIX_STEPS"):
124
+ assert not os.environ.get(k), f"{rs}: the pinned list only, no RSI pool curriculum ({k})"
125
+ elif rs in POSE_SETS:
126
+ import hashlib
127
+ lst, pin, clips = POSE_SETS[rs]
128
+ assert os.environ.get("TASKWALK_INIT_REF") == lst, (rs, os.environ.get("TASKWALK_INIT_REF"), lst)
129
+ got = hashlib.md5(pathlib.Path(lst).read_bytes()).hexdigest()
130
+ assert got == pin, f"{lst}: md5 {got}, pinned {pin}"
131
+ listed = [ln.strip() for ln in pathlib.Path(lst).read_text().splitlines() if ln.strip()]
132
+ assert listed == list(clips), f"{lst} lists {listed}, pinned {list(clips)}"
133
+ for c, m in clips.items():
134
+ got = hashlib.md5(pathlib.Path(c).read_bytes()).hexdigest()
135
+ assert got == m, f"{c}: md5 {got}, pinned {m}"
136
+ for k in ("TASKWALK_INIT_REF_START", "TASKWALK_RSI_MIX_STEPS"):
137
+ assert not os.environ.get(k), f"{rs}: the pinned set only, no RSI pool curriculum ({k})"
138
+ else:
139
+ import hashlib
140
+ clip, pin = RUN_CLIPS[rs]
141
+ assert os.environ.get("TASKWALK_INIT_REF") == clip, (rs, os.environ.get("TASKWALK_INIT_REF"), clip)
142
+ got = hashlib.md5(pathlib.Path(clip).read_bytes()).hexdigest()
143
+ assert got == pin, f"{clip}: md5 {got}, pinned {pin}"
144
+ for k in ("TASKWALK_STATE_PRIOR_FILE", "TASKWALK_PHASE_PRIOR_FILE", "DN_OUT_BIAS_FILE", "DN_SVD_BASIS", "TASKWALK_TRACK",
145
+ "TASKWALK_W_TRACK", "DN_IM_MIMIC"):
146
+ assert not os.environ.get(k) or os.environ.get(k) == "0", f"{k} is banned in this line (an imitation channel; the review's Low item)"
147
+ assert os.environ.get("DN_IMITATION", "0") == "0", "DN_IMITATION is banned in this line"
148
+ for k in ("TASKWALK_W_BRAKE", "TASKWALK_W_BRAKE_END"):
149
+ assert float(os.environ.get(k, "0")) == 0.0, f"{k}: the brake is off (hub 13's decision (A), a stated difference from ks14t)"
150
+ assert pathlib.Path(os.environ["E0_TREE14"]).resolve() == ROOT.resolve(), "E0_TREE14 must be this tree (one engine source)"
151
+ if os.environ.get("SUITE_INIT_CKPT"): # the R cells: the W parent's checkpoint, whose own run had no reference motion in its training
152
+ import json
153
+ _ck = pathlib.Path(os.environ["SUITE_INIT_CKPT"]).resolve()
154
+ assert _ck.parent.name == "ckpt", f"{_ck}: a suite checkpoint lives in <run>/ckpt/ (SUITE_SAVE_CKPTS)"
155
+ from diffneusim.tasks.legacy_names import translate as _legacy
156
+ _prc = json.loads((_ck.parent.parent / "run_config.json").read_text())
157
+ _prc["env_vars"] = _legacy(_prc["env_vars"]) # a paper run's record carries the development names (MYOLEG_* / JINSIMUL_*); read them as this package's
158
+ _rc = _prc["env_vars"]
159
+ for k in ON:
160
+ assert _rc.get(k) == "1", f"SUITE_INIT_CKPT's run had {k}={_rc.get(k)!r}: not a checkpoint of this line"
161
+ if os.environ.get("D16_TW_CHAIN") == "S290":
162
+ # PREREG_S290 (11-11): ONE further warm start allowed, R290 ep2000's Polyak shadow. The start is R290's checkpoint with only
163
+ # "actor" replaced by its own "actor_ema" (every other entry equal, asserted against the original, which D16_TW_CHAIN_SRC names
164
+ # and whose md5 is pinned); R290's run had no kickstart and no imitation, and its own warm start is W290b ep2000, whose
165
+ # ancestry R290's check_env passed when it trained.
166
+ import hashlib
167
+ import torch
168
+ src = pathlib.Path(os.environ["D16_TW_CHAIN_SRC"]).resolve()
169
+ md5 = hashlib.md5(src.read_bytes()).hexdigest()
170
+ assert md5 == "3e3b6eab1193b90881eedfacba5375a7", f"D16_TW_CHAIN S290 refuses {src} (md5 {md5})"
171
+ A, B = torch.load(src, map_location="cpu", weights_only=False), torch.load(_ck, map_location="cpu", weights_only=False)
172
+ assert set(A) == set(B) and "actor_ema" in A, (sorted(A), sorted(B))
173
+ def eq(x, y):
174
+ if torch.is_tensor(x):
175
+ return torch.is_tensor(y) and x.shape == y.shape and torch.equal(x, y)
176
+ if isinstance(x, dict):
177
+ return isinstance(y, dict) and set(x) == set(y) and all(eq(x[t], y[t]) for t in x)
178
+ if isinstance(x, (list, tuple)):
179
+ return isinstance(y, (list, tuple)) and len(x) == len(y) and all(eq(u, v) for u, v in zip(x, y))
180
+ return x == y
181
+ assert eq(B["actor"], A["actor_ema"]) and not eq(A["actor"], A["actor_ema"]), "the start's actor is not R290's shadow"
182
+ assert all(eq(A[k], B[k]) for k in A if k != "actor"), "the start differs from R290 ep2000 beyond the actor"
183
+ assert not _rc.get("SAPO_KICKSTART_CKPT") and str(_rc.get("SUITE_INIT_CKPT", "")).endswith("W290b_run/ckpt/fullbody_sapo_ep2000.pt"), _rc.get("SUITE_INIT_CKPT")
184
+ elif os.environ.get("D16_TW_CHAIN") == "GCOT":
185
+ # the GCOT warm-start chain (11-22; a design direction): the parent may itself be a chain link; gcot_chain.parent_ok
186
+ # asserts its run had no kickstart / imitation, was a cold root or a GCOT link, and the same change set except the speed schedule
187
+ # (3a) was: sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent)) # this file's folder also under e5_launch's runpy
188
+ from diffneusim.train import gcot_chain
189
+ _ok, _why = gcot_chain.parent_ok(_prc, dict(os.environ), sys.argv)
190
+ assert _ok, f"D16_TW_CHAIN=GCOT refuses {_ck}: {_why}"
191
+ print(f"[tw14] GCOT chain: parent {_ck} accepted ({_why})", flush=True)
192
+ else:
193
+ for k in ("SAPO_KICKSTART_CKPT", "SUITE_INIT_CKPT"):
194
+ assert not _rc.get(k), f"SUITE_INIT_CKPT's run had {k}: imitation (or a further warm start) in its ancestry"
195
+
196
+
197
+ orig_make_algo = S.make_algo
198
+
199
+
200
+ def install(env, steps_num):
201
+ """env14 on the env with the line's switches, then every world reset on the D16 path; returns env14's object"""
202
+ # (3a) was: sys.path.insert(0, str(ROOT / "tools" / "d16" / "e0train14"))
203
+ from diffneusim.env import env14
204
+ e14 = env14.install_from_env(env, steps_num)
205
+ assert e14 is not None and e14.equil_on and not e14.rew14_on, (e14, getattr(e14, "equil_on", None), getattr(e14, "rew14_on", None))
206
+ assert env14.ACT14 and env14.KINLATCH and env14.GROUND14 and env14.NO_OLD
207
+ with torch.no_grad():
208
+ env._reset_envs(None) # every world from the D16 path's reset (see the docstring)
209
+ assert e14.count["ground14"] == 1 and e14.count["old_sim"] == 0, dict(e14.count)
210
+ print(f"[tw14] env14 installed on {env.num_envs} worlds, every world reset on the D16 path; counts {dict(e14.count)}; D16_BODY "
211
+ f"{os.environ.get('D16_BODY', '(14x)')}; case {os.environ['E0_MUSCLE_CASE']}", flush=True)
212
+ return e14
213
+
214
+
215
+ EMA = os.environ.get("LEARN_EMA", "0") == "1"
216
+
217
+
218
+ def install_ema(algo):
219
+ """LEARN_EMA=1: the Polyak-averaged actor, a SHADOW for evaluation only, ported verbatim from the driver (tools/e0speed/learn/train14.py
220
+ on main): decay min(0.999, (1 + n) / (10 + n)) per actor update, built at the FIRST actor step (after the suite's warm start has loaded
221
+ the actor) from SUITE_INIT_CKPT's actor_ema when it has one, with the counter continued from the absolute epoch, else from the loaded
222
+ actor. Training never reads it; the checkpoint carries it beside the raw actor (ckpt_payload below). Scored from an EMA copy of the
223
+ checkpoint (actor := actor_ema, as the r1_eval.sh) through eval_tw14.py unchanged."""
224
+ ema, st0, m = {}, algo.actor_opt.step, {"n": None}
225
+
226
+ def ema_init():
227
+ off = int(getattr(algo, "epoch_offset", 0))
228
+ ck = os.environ.get("SUITE_INIT_CKPT")
229
+ src = torch.load(ck, map_location="cpu", weights_only=False).get("actor_ema") if ck else None
230
+ if src is not None:
231
+ ema.update({k: v.to(algo.device).clone() for k, v in src.items()})
232
+ else:
233
+ ema.update({k: v.detach().clone() for k, v in algo.actor.state_dict().items() if v.is_floating_point()})
234
+ # TW14_EMA_RESTART=1 (11-22, the GCOT warm chain): a warm cell restarts the shadow's counter at 0, so the shadow it is scored from
235
+ # averages like a cold cell of the same length instead of over the parent's climb (time constant about n / 9 epochs at an absolute n)
236
+ m["n"] = 0 if (ck and os.environ.get("TW14_EMA_RESTART") == "1") else off
237
+ print(f"[tw14] ema shadow from {'the checkpoint actor_ema' if src is not None else 'the actor'}, counter {m['n']}"
238
+ f"{' (TW14_EMA_RESTART: restarted, absolute epoch ' + str(off) + ')' if m['n'] != off else ''}", flush=True)
239
+
240
+ def step(*x, **kw):
241
+ if m["n"] is None:
242
+ ema_init()
243
+ out = st0(*x, **kw)
244
+ d = min(0.999, (1 + m["n"]) / (10 + m["n"]))
245
+ with torch.no_grad():
246
+ for k, v in algo.actor.state_dict().items():
247
+ if k in ema:
248
+ ema[k].mul_(d).add_(v.detach(), alpha=1.0 - d)
249
+ m["n"] += 1
250
+ return out
251
+ algo.actor_opt.step = step
252
+ algo._learn_ema = ema
253
+
254
+
255
+ # THE DEFAULT PATH (the review for the design brief, 11-11: a speed-up lands once in the shared training path and is every run's default): the
256
+ # captured window (--tw1-capture) with the reset pool (--tw1-pool), both gated bitwise to the eager loop (TW1 S2a / S2b's gates; the
257
+ # Python-side schedules under replay: PREREG_CAPSCHED). On the CUDA backend; the CPU backend (the Mac's dry runs) has no CUDA graphs, so
258
+ # there the default is the eager loop. --tw1-eager: the eager loop on CUDA, for debugging only. --tw1-capture / --tw1-pool stay accepted.
259
+ _CUDA = os.environ.get("E0_ENV14_BACKEND", "cuda") == "cuda"
260
+ TW1 = {"log_cmd": False, "log_w": False, "on": _CUDA, "W": None, "m1c": False, "tf32": False, "critic_iters": None, "k2": False, "no_final_eval": False, "stamps": None,
261
+ "pool": _CUDA}
262
+ # --tw1-capture, and S2c's --tw1-m1c / --tw1-tf32 / --tw1-critic-iters N (PREREG_TW1_S2c.md): explicit arguments, stripped before the
263
+ # suite's argv; run_config's tw1_capture record carries them (4e / 4d' are SapoVec's own SAPO_ switches, recorded by prefix).
264
+ # The clock's two (the review, 11-10: training + evaluation <= 10 min, measured from the launch command to the verdict file), neither changes
265
+ # the training:
266
+ # --tw1-stamps PATH CLOCK_MONOTONIC_RAW stamps to PATH at exit: the import, the algo built, train() entered / left, and every epoch's
267
+ # callback entered / left with its step count (the loop's cost per epoch = entry - the previous exit; the callback's
268
+ # own = its logging and checkpoint saves)
269
+ # --tw1-no-final-eval the suite's end-of-run eval (a second env built with env14 installed, then one deterministic episode of the LIVE
270
+ # actor) is skipped: it is not the registered reading (the shadow, sampled, 8 starts: eval_verdict.py); the metrics
271
+ # it would write are NaN / 0 with final_eval_skipped True
272
+ DRY = 0 # TW14_DRY_EPOCHS (wrap_dry), read in __main__ only: the tools that import this module (the gate's window, the census) never cut
273
+ ST = {"import": T_IMPORT, "env_built": None, "algo_core": None, "e14_installed": None, "tw1_installed": None, "algo_built": None, "train_entry": None, "train_exit": None, "cb_entry": [], "cb_exit": [], "steps": [],
274
+ "final_eval_s": None, "exit": None}
275
+
276
+
277
+ def write_stamps():
278
+ ST["exit"] = RAW()
279
+ pathlib.Path(TW1["stamps"]).write_text(json.dumps(ST))
280
+
281
+
282
+ def wrap_train(algo):
283
+ """--tw1-stamps: the epoch callback's entry and exit stamped (RAW); the suite's callback runs unchanged in between"""
284
+ tr = algo.train
285
+
286
+ def train(*x, callback=None, **kw):
287
+ ST["train_entry"] = RAW()
288
+
289
+ def cb(epoch, step_count, *r, **k):
290
+ ST["cb_entry"].append(RAW())
291
+ ST["steps"].append(int(step_count))
292
+ out = callback(epoch, step_count, *r, **k) if callback is not None else None
293
+ ST["cb_exit"].append(RAW())
294
+ return out
295
+ out = tr(*x, callback=cb, **kw)
296
+ ST["train_exit"] = RAW()
297
+ return out
298
+ algo.train = train
299
+
300
+
301
+ def wrap_dry(algo, epochs, n):
302
+ """TW14_DRY_EPOCHS=N (the review 11-12, the cell runner's dry start inside the claim, for a cell whose key has no certificate): the
303
+ cell's own command at its PRODUCTION epoch count, stopped after the suite's callback for epoch N returns. cfg.epochs and SapoVec's
304
+ max_epochs stay the run's, so every schedule and assert keyed on them is the run's (A13c died at epoch 1's callback on
305
+ SUITE_SAVE_CKPTS_EVERY % (epochs // 50); a smoke at a smaller epoch count passes that assert). Start-up, the first N updates and the
306
+ suite's per-epoch callback run; then the CUDA device is synchronised (an asynchronous kernel fault raises here, rc != 0) and the
307
+ process leaves with os._exit(0): no atexit (the stamps), no final eval, no checkpoint past what the callback itself saved (so the
308
+ caller gives it an --out-dir of its own).
309
+ Under the captured window (mode "graph") the dry start must reach the FIRST REPLAY (the review, 11-12): tonight's taskwalk windows
310
+ read {eager 3, graph 5}, so the first replay is epoch index 3 (N = 4), where the g999 died (an illegal memory access right after
311
+ the record) and where A11c / A14's gate differences enter. A replayed epoch is tw1_gate_gpu's own test (W.graphs is not None at the
312
+ epoch's callback); with none by epoch N the dry start fails (rc != 0) instead of passing a path it never ran."""
313
+ assert 1 <= n < epochs, f"TW14_DRY_EPOCHS={n} must be in [1, the run's {epochs} epochs)"
314
+ tr, need_replay, rep = algo.train, TW1["on"] and TW1.get("window_mode", "graph") == "graph", []
315
+
316
+ def train(*x, callback=None, **kw):
317
+ def cb(epoch, step_count, *r, **k):
318
+ out = callback(epoch, step_count, *r, **k) if callback is not None else None
319
+ W = TW1["W"]
320
+ if W is not None and W.graphs is not None:
321
+ rep.append(epoch + 1)
322
+ if epoch + 1 == n:
323
+ torch.cuda.synchronize()
324
+ assert rep or not need_replay, (f"TW14_DRY_EPOCHS={n}: no replayed window by epoch {n} under the captured window; the dry "
325
+ f"start must reach the first replay (raise N)")
326
+ win = dict(W.windows) if W is not None else None # the review: the window counts and the
327
+ pool = W.pool.n_builds if W is not None and W.pool is not None else None # pool's builds, so a pass shows the pool replayed
328
+ print(f"[tw14] dry epochs: {n} of {epochs} done (steps {int(step_count)}, replayed epochs {rep or 'none'}, windows {win}, "
329
+ f"reset pool builds {pool}, {RAW() - T_IMPORT:.1f} s after the import); exit 0", flush=True)
330
+ sys.stderr.flush()
331
+ os._exit(0)
332
+ return out
333
+ return tr(*x, callback=cb, **kw)
334
+ algo.train = train
335
+
336
+
337
+ def wrap_log_cmd(algo, env, epochs):
338
+ """--tw1-log-cmd (11-11, after RUN290's frozen ramp): at every logged epoch (the suite's rule: the first, every epochs // 50, the
339
+ last) the command the env actually holds and the speed price the reward actually uses, read off the live objects: env._train_steps,
340
+ the floor / ceiling TW_V_LO / TW_V_HI, the worlds' v_tgt (mean, min, max) and taskwalk.w_speed_max. One host read per logged epoch, so
341
+ the eager loop only (refused under --tw1-capture, whose Python-side schedules are frozen: tools/d16_taskwalk/PREREG_RUN350.md Amendment 1)."""
342
+ tr, tw, every = algo.train, env.taskwalk, max(1, epochs // 50)
343
+
344
+ def train(*x, callback=None, **kw):
345
+ def cb(epoch, step_count, *r, **k):
346
+ out = callback(epoch, step_count, *r, **k) if callback is not None else None
347
+ if epoch == 0 or (epoch + 1) % every == 0 or epoch + 1 == epochs:
348
+ v = tw.v_tgt.detach().float()
349
+ print(f"[tw14] cmd ep={epoch + 1} train_steps={env._train_steps} floor={env.TW_V_LO:.5f} ceiling={env.TW_V_HI:.5f} "
350
+ f"v_tgt mean={float(v.mean()):.5f} min={float(v.min()):.5f} max={float(v.max()):.5f} w_speed_max={float(tw.w_speed_max):.5f}",
351
+ flush=True)
352
+ return out
353
+ return tr(*x, callback=cb, **kw)
354
+ algo.train = train
355
+
356
+
357
+ def wrap_log_weights(algo, env, epochs):
358
+ """--tw1-log-weights (11-11, PREREG_S290 Amendment 2, S290 from a cold start): at every logged epoch (the suite's rule, as
359
+ --tw1-log-cmd) the schedules the env holds (the TASKWALK_W_* list and its second segments, the command's floor / ceiling ends) and
360
+ the weights the reward multiplies by: the four that R290's recipe ramps (joint limit, passive limit torque, hip rotation, head
361
+ acceleration) and the speed price, each read off the live reward (a weight with a tensor route through that tensor, which is what
362
+ the captured graph reads). Allowed under --tw1-capture: it reads values, it writes nothing, and with no schedule nothing writes them."""
363
+ tr, tw, every = algo.train, env.taskwalk, max(1, epochs // 50)
364
+ names = ("w_joint_limit", "w_limit_torque", "w_hip_rotation", "w_head_accel", "w_speed_max")
365
+
366
+ def val(n):
367
+ wt = getattr(tw, "_wt", None)
368
+ return float(wt[n]) if wt is not None and n in wt else float(getattr(tw, n))
369
+
370
+ def train(*x, callback=None, **kw):
371
+ def cb(epoch, step_count, *r, **k):
372
+ out = callback(epoch, step_count, *r, **k) if callback is not None else None
373
+ if epoch == 0 or (epoch + 1) % every == 0 or epoch + 1 == epochs:
374
+ print(f"[tw14] weights ep={epoch + 1} w_sched {len(env._tw_w_sched)} w_sched2 {len(getattr(env, '_tw_w_sched2', []))} "
375
+ f"v_lo_end {env._tw_v_lo_end} v_hi_end {env._tw_v_hi_end} floor={env.TW_V_LO:.5f} ceiling={env.TW_V_HI:.5f} "
376
+ + " ".join(f"{n}={val(n):.6g}" for n in names), flush=True)
377
+ return out
378
+ return tr(*x, callback=cb, **kw)
379
+ algo.train = train
380
+
381
+
382
+ def install_tw1(algo, env, e14):
383
+ """--tw1-capture: SAPO's actor window as P3's per-slot CUDA graphs on the taskwalk env (TW1 S2a, tools/d16_taskwalk/TW1_S2_DESIGN.md;
384
+ its GPU gate tw1_gate_gpu.py): the window-varying weights through their tensor route, the speed P update at the window boundary,
385
+ extra_state = sapo_capture.TASKWALK_STATE. Bitwise to the eager loop by that gate."""
386
+ from diffneusim.rl import sapo_capture as SC
387
+ tw = env.taskwalk
388
+ names = sorted({n for n, *_ in env._tw_w_sched} | {n for n, *_ in getattr(env, "_tw_w_sched2", [])} | {"w_speed_max"}
389
+ | ({env._asat_gate["target"]} if getattr(env, "_asat_gate", None) is not None else set())) # the performance-gated weight moves between windows
390
+ tw.enable_tensor_weights(names, env.device)
391
+ if tw._speed_p is not None:
392
+ tw.defer_speed_p()
393
+ TW1["W"] = SC.install(algo, env, e14, TW1.get("window_mode", "graph"), extra_state=SC.TASKWALK_STATE, pool=TW1["pool"]) # --tw1-pool: S2b, the reset pool; --tw1-window-eager: mode "eager"
394
+ if TW1["W"].pool is not None: # the pool's device counters, printed at exit (L290p, 11-10, ran without this print)
395
+ P = TW1["W"].pool
396
+ atexit.register(lambda: print(f"[tw14] reset pool: {P.n_builds} builds, {int(P.resets)} resets, {int(P.reused)} of them a second reset of a world in its window (the row reused)", flush=True))
397
+ print(f"[tw14] TW1 S2a capture installed: SapoWindow {TW1['W'].mode}, extra_state {len(TW1['W'].extra)} paths, tensor weights {names}", flush=True)
398
+
399
+
400
+ def install_freeze(algo, obs_rms, alpha):
401
+ """TW14_FREEZE_OBS_RMS=1 / TW14_FREEZE_ALPHA=1 (opt-in; 11-12 for the review's sprint diagnostic, PREREG_TENDON Amendment 11; unset =
402
+ today's path: this is never called). obs_rms: the observation normaliser is not updated during training. alpha: the temperature takes no
403
+ optimiser step. Both are no-ops set on the INSTANCE (algo.obs_rms.update, algo.alpha_opt.step) BEFORE the capture is installed, so the eager
404
+ loop, the captured window (sapo_capture's obs_rms.update calls run as no-ops while it records) and E5's text-copied _e5_update_alpha (which
405
+ calls self.alpha_opt.step()) all skip them, and the flag is constant for the whole run. A warm start's loaded mean / var / count and
406
+ log_alpha stay as loaded: train() records them at entry and asserts them BITWISE at exit (fail-fast)."""
407
+ assert obs_rms or alpha
408
+ if obs_rms:
409
+ algo.obs_rms.update = lambda arr: None
410
+ if alpha:
411
+ assert hasattr(algo, "alpha_opt") and hasattr(algo, "log_alpha"), "TW14_FREEZE_ALPHA needs SAPO's temperature"
412
+ algo.alpha_opt.step = lambda *a, **k: None
413
+ tr = algo.train
414
+
415
+ def train(*x, **kw):
416
+ r = algo.obs_rms
417
+ m0, v0, c0 = r.mean.clone(), r.var.clone(), r.count
418
+ la0 = algo.log_alpha.detach().clone() if alpha else None
419
+ print(f"[tw14] FROZEN for this run: obs_rms {obs_rms} (count {c0:.6g}), alpha {alpha}"
420
+ + (f" (alpha {float(la0.exp()):.4g})" if alpha else ""), flush=True)
421
+ out = tr(*x, **kw)
422
+ if obs_rms:
423
+ assert torch.equal(r.mean, m0) and torch.equal(r.var, v0) and r.count == c0, "the frozen obs_rms moved"
424
+ if alpha:
425
+ assert torch.equal(algo.log_alpha.detach(), la0), "the frozen log_alpha moved"
426
+ print(f"[tw14] FROZEN check at train exit: obs_rms {'bitwise unchanged' if obs_rms else 'not frozen'}, "
427
+ f"alpha {'bitwise unchanged' if alpha else 'not frozen'}", flush=True)
428
+ return out
429
+ algo.train = train
430
+
431
+
432
+ def install_lr_sched(algo, spec):
433
+ """TW14_LR_SCHED (opt-in; 11-12 for the review's step-size diagnostic; unset = the suite's linear anneal, bit-identical): the actor and
434
+ critic learning rates set per epoch here instead of SapoVec.train's "linear" rewrite (lr_schedule switched off). The optimizer step runs in
435
+ Python after the captured window's backward, so a per-epoch change takes effect under capture as the linear anneal does.
436
+ const both held at their configured values (DN_ACTOR_LR / DN_CRITIC_LR, or SAPO's defaults) for every epoch
437
+ floor:FRAC:EPOCH linear from the configured peak to FRAC x peak at absolute epoch EPOCH, then held at FRAC x peak
438
+ The epoch is ABSOLUTE (a warm start's epoch_offset added), so a continuation keeps its place in the schedule."""
439
+ parts = spec.split(":")
440
+ assert parts[0] in ("const", "floor") and (len(parts) == 1 if parts[0] == "const" else len(parts) == 3), f"TW14_LR_SCHED={spec!r}"
441
+ frac, e_floor = (float(parts[1]), int(parts[2])) if parts[0] == "floor" else (1.0, 1)
442
+ assert 0.0 < frac <= 1.0 and e_floor >= 1, spec
443
+ assert algo.lr_schedule == "linear", algo.lr_schedule
444
+ algo.lr_schedule = "tw14"
445
+ peak_a, peak_c, sc = float(algo.actor_lr), float(algo.critic_lr), float(getattr(algo, "_actor_lr_scale", 1.0))
446
+
447
+ def factor(e):
448
+ return 1.0 + (frac - 1.0) * min(1.0, e / e_floor)
449
+
450
+ def set_lr(e):
451
+ f = factor(e)
452
+ for g in algo.actor_opt.param_groups:
453
+ g["lr"] = peak_a * f * sc
454
+ for g in algo.critic_opt.param_groups:
455
+ g["lr"] = peak_c * f
456
+ return f
457
+
458
+ tr = algo.train
459
+
460
+ def train(*x, callback=None, **kw):
461
+ off = int(getattr(algo, "epoch_offset", 0))
462
+ f0 = set_lr(off)
463
+ print(f"[tw14] lr schedule {spec}: peaks actor {peak_a:.3g} critic {peak_c:.3g}; epoch {off} factor {f0:.4f} "
464
+ f"(actor {peak_a * f0 * sc:.3g}, critic {peak_c * f0:.3g})", flush=True)
465
+
466
+ def cb(epoch, step_count, *r, **k):
467
+ out = callback(epoch, step_count, *r, **k) if callback is not None else None
468
+ f = set_lr(off + epoch + 1) # the next epoch's rate, set before its window
469
+ if (epoch + 1) % 200 == 0:
470
+ print(f"[tw14] lr at epoch {off + epoch + 1}: factor {f:.4f} actor {peak_a * f * sc:.3g} critic {peak_c * f:.3g}", flush=True)
471
+ return out
472
+ return tr(*x, callback=cb, **kw)
473
+ algo.train = train
474
+
475
+
476
+ def wrap_first_update(algo):
477
+ """the launch campaign's measure (23 for the review, 11-11): ONE line per process at the end of its first training epoch (the first after
478
+ a resume too), outside any clock, a print only: FIRST_UPDATE <local time with offset> it=<the epoch's number>"""
479
+ tr, done = algo.train, {"v": False}
480
+
481
+ def train(*x, callback=None, **kw):
482
+ def cb(epoch, step_count, *r, **k):
483
+ out = callback(epoch, step_count, *r, **k) if callback is not None else None
484
+ if not done["v"]:
485
+ done["v"] = True
486
+ print(f"FIRST_UPDATE {time.strftime('%Y-%m-%dT%H:%M:%S%z')} it={epoch + 1}", flush=True)
487
+ return out
488
+ return tr(*x, callback=cb, **kw)
489
+ algo.train = train
490
+
491
+
492
+ def make_algo(name, env, cfg, seed):
493
+ algo = orig_make_algo(name, env, cfg, seed)
494
+ ST["algo_core"] = RAW() # the start-up split (the review 11-12: the cell's 2-3 min before epoch 1)
495
+ # the engine's tape window is the ALGORITHM's (DN_STEPS_NUM overrides SAPO's steps_num, not cfg's; PREREG_S290 Amendment 3's
496
+ # CHECK probe at H64 hit train14's 'the window's 32 control steps are used' with cfg.steps_num); equal to cfg.steps_num when unset
497
+ # both windows printed, and equal unless DN_STEPS_NUM is set (the review: the fix is a no-op at H32 by construction; the log shows it)
498
+ print(f"[tw14] engine window: algo.steps_num {int(algo.steps_num)} cfg.steps_num {int(cfg.steps_num)} DN_STEPS_NUM "
499
+ f"{os.environ.get('DN_STEPS_NUM', 'unset')}", flush=True)
500
+ if "DN_STEPS_NUM" not in os.environ:
501
+ assert int(algo.steps_num) == int(cfg.steps_num), (algo.steps_num, cfg.steps_num)
502
+ e14 = install(env, int(algo.steps_num))
503
+ ST["e14_installed"] = RAW()
504
+ if EMA:
505
+ install_ema(algo)
506
+ _fz = (False, False)
507
+ if any(_fz):
508
+ install_freeze(algo, *_fz) # before the capture (install_tw1) and every train() wrapper below
509
+ if TW1["critic_iters"] is not None:
510
+ algo.critic_iterations = int(TW1["critic_iters"])
511
+ if TW1["tf32"]:
512
+ torch.backends.cuda.matmul.allow_tf32 = True
513
+ if TW1["m1c"]:
514
+ algo.critic.compile(dynamic=False) # the m1c: in place, so the bootstrap runs compiled too
515
+ if TW1.get("e5"):
516
+ algo.enable_critic_overlap() # after the critic's final form (eager or m1c in place)
517
+ if TW1["k2"]:
518
+ assert e14.foot is not None and env.mirror is not None, "--tw1-k2: the mirror latch on the D16 contact (E0_ENV14_KINLATCH)"
519
+ assert set(e14.foot.bodies) <= set(env._monitor._fk_moving) | set(env._tw_bodies), "the foot bodies must be in the reward's FK"
520
+ env._tw_latch_from_reward = True
521
+ assert not TW1["pool"] or TW1["on"], "--tw1-pool needs --tw1-capture (the pool lives in the SapoWindow)"
522
+ if TW1["on"]:
523
+ install_tw1(algo, env, e14)
524
+ ST["tw1_installed"] = RAW()
525
+ if TW1["log_cmd"]:
526
+ assert not TW1["on"], "--tw1-log-cmd reads the live Python schedules, which --tw1-capture freezes: the eager loop only"
527
+ wrap_log_cmd(algo, env, cfg.epochs)
528
+ if TW1["log_w"]:
529
+ wrap_log_weights(algo, env, cfg.epochs)
530
+ if os.environ.get("TW14_LR_SCHED"):
531
+ install_lr_sched(algo, os.environ["TW14_LR_SCHED"]) # before the stamps wrapper, inside the suite's callback
532
+ wrap_first_update(algo)
533
+ if TW1["stamps"]:
534
+ wrap_train(algo) # around whatever train() the installs left
535
+ if DRY:
536
+ wrap_dry(algo, int(cfg.epochs), DRY) # last: its exit follows the stamps' callback for epoch N
537
+ print(f"[tw14] TW1 switches: k2 {TW1['k2']} capture {TW1['on']} m1c {TW1['m1c']} tf32 {bool(torch.backends.cuda.matmul.allow_tf32)} critic_iterations "
538
+ f"{algo.critic_iterations} freeze_critic_bptt {algo.freeze_critic_bptt} one_bootstrap {algo.one_bootstrap}; no_final_eval "
539
+ f"{TW1['no_final_eval']} stamps {TW1['stamps']} pool {TW1['pool']}", flush=True)
540
+ ST["algo_built"] = RAW()
541
+ return algo
542
+
543
+
544
+ orig_make_env = S.make_env
545
+ MADE = {"n": 0}
546
+
547
+
548
+ def make_env(name, cfg, seed, stochastic_init):
549
+ """the suite's make_env (two call sites, rl_algorithm_suite.py train_one) with env14 installed on every env after the first. The first
550
+ is the training env, which make_algo installs. The second is the suite's end-of-run eval env (after algo.train). It ran the D16-trained
551
+ policy on the old engine (the reviewer's H2), and now runs on the D16 engine too, so old_sim 0 holds for the whole process."""
552
+ if MADE["n"] >= 1 and TW1["no_final_eval"]:
553
+ assert ST["train_exit"] is not None or not TW1["stamps"], "--tw1-no-final-eval: a second env before train() returned"
554
+ MADE["n"] += 1
555
+ return None # the suite's eval env: not built (eval_and_record below takes None)
556
+ env = orig_make_env(name, cfg, seed, stochastic_init)
557
+ MADE["n"] += 1
558
+ if MADE["n"] == 1:
559
+ ST["env_built"] = RAW()
560
+ if MADE["n"] > 1:
561
+ env._tw_e14 = install(env, cfg.steps_num)
562
+ return env
563
+
564
+
565
+ orig_eval_and_record = S.eval_and_record
566
+
567
+
568
+ def eval_and_record(env_name, env, algo, out_npz, *x, **kw):
569
+ """the suite's end-of-run eval, timed (RAW); skipped under --tw1-no-final-eval (its env was not built)"""
570
+ t = RAW()
571
+ if TW1["no_final_eval"]:
572
+ assert env is None and MADE["n"] == 2, (env, MADE)
573
+ out = dict(eval_return=float("nan"), eval_steps=0, eval_fwd=float("nan"), eval_height_mean=float("nan"), rollout_dnrec="",
574
+ final_eval_skipped=True)
575
+ else:
576
+ out = orig_eval_and_record(env_name, env, algo, out_npz, *x, **kw)
577
+ ST["final_eval_s"] = RAW() - t
578
+ print(f"[tw14] the suite's final eval: {'skipped (--tw1-no-final-eval)' if TW1['no_final_eval'] else 'ran'}, {ST['final_eval_s']:.1f} s "
579
+ f"(RAW)", flush=True)
580
+ return out
581
+
582
+
583
+ orig_write_run_config = S.write_run_config
584
+
585
+
586
+ def write_run_config(out_dir, env, algo, *x, **kw):
587
+ """the suite's run_config, plus TW1's capture record (the argument is stripped from the argv the suite sees)"""
588
+ orig_write_run_config(out_dir, env, algo, *x, **kw)
589
+ p = pathlib.Path(out_dir) / "run_config.json"
590
+ r = json.loads(p.read_text())
591
+ W = TW1["W"]
592
+ r["tw1_capture"] = dict(on=TW1["on"], mode=W.mode if W is not None else None, extra_state=list(W.extra) if W is not None else None,
593
+ m1c=TW1["m1c"], k2=TW1["k2"], tf32=bool(torch.backends.cuda.matmul.allow_tf32), critic_iterations=int(algo.critic_iterations),
594
+ freeze_critic_bptt=bool(algo.freeze_critic_bptt), one_bootstrap=algo.one_bootstrap,
595
+ no_final_eval=TW1["no_final_eval"], stamps=TW1["stamps"], pool=TW1["pool"], e5=TW1.get("e5", False))
596
+ p.write_text(json.dumps(r, indent=2))
597
+
598
+
599
+ orig_payload = S.ckpt_payload
600
+
601
+
602
+ def ckpt_payload(algo, step_count, epoch):
603
+ p = orig_payload(algo, step_count, epoch)
604
+ if getattr(algo, "_learn_ema", None): # the shadow beside the raw weights (once built); the normalizer stays the raw policy's
605
+ p["actor_ema"] = {k: v.clone() for k, v in algo._learn_ema.items()}
606
+ # D16_TW_CHAIN=GCOT (11-22): the checkpoint's "epoch" is the ABSOLUTE epoch (the warm start's epoch_offset + this run's local epoch). The
607
+ # suite stores the local epoch, which a chain link reads as its epoch_offset and its env step counter (SUITE_INIT_RESUME_ENV_STEPS), so a
608
+ # second link would restart the lr anneal and the command schedule at its parent's local count; eval_tw14 also holds the scheduled weights
609
+ # at this epoch. The local epoch is kept as "epoch_local"; the file name stays local (the suite's).
610
+ if os.environ.get("D16_TW_CHAIN") == "GCOT":
611
+ p["epoch_local"] = int(epoch)
612
+ p["epoch"] = int(epoch) + int(getattr(algo, "epoch_offset", 0))
613
+ return p
614
+
615
+
616
+ if __name__ == "__main__":
617
+ _av, _out = sys.argv[1:], []
618
+ while _av:
619
+ x = _av.pop(0)
620
+ if x == "--tw1-capture":
621
+ TW1["on"] = True
622
+ elif x == "--tw1-eager": # debugging only: the eager loop on CUDA
623
+ TW1["on"], TW1["pool"] = False, False
624
+ elif x == "--tw1-m1c":
625
+ TW1["m1c"] = True
626
+ elif x == "--tw1-tf32":
627
+ TW1["tf32"] = True
628
+ elif x == "--tw1-k2":
629
+ TW1["k2"] = True
630
+ elif x == "--tw1-e5": # the critic on a side stream during the actor's backward (was e5_launch.py --e5 1)
631
+ TW1["e5"] = True
632
+ elif x == "--tw1-critic-iters":
633
+ TW1["critic_iters"] = int(_av.pop(0))
634
+ elif x == "--tw1-pool":
635
+ TW1["pool"] = True
636
+ elif x == "--tw1-window-eager": # 23 for the review 11-12 (A14's waiver): the SapoWindow in mode "eager" with its pool,
637
+ TW1["window_mode"] = "eager" # i.e. tw1_gate_gpu's eagerx arm as the training path (the reference the gate compares to)
638
+ elif x == "--tw1-no-pool": # the captured window WITHOUT the reset pool (S2a alone: L290s, S290's cells)
639
+ TW1["pool"] = False
640
+ elif x == "--tw1-no-final-eval":
641
+ TW1["no_final_eval"] = True
642
+ elif x == "--tw1-log-cmd":
643
+ TW1["log_cmd"] = True
644
+ elif x == "--tw1-log-weights":
645
+ TW1["log_w"] = True
646
+ elif x == "--tw1-stamps":
647
+ TW1["stamps"] = _av.pop(0)
648
+ else:
649
+ _out.append(x)
650
+ sys.argv = sys.argv[:1] + _out
651
+ assert not (TW1["pool"] and not TW1["on"]), "the reset pool needs the captured window (--tw1-pool without --tw1-capture, or --tw1-eager with --tw1-pool)"
652
+ # the resolved loop, printed before anything else (run_config.json["tw1_capture"] records the same switches at the run's end); since
653
+ # the default flip (ebc2c712a) a command without loop flags runs capture + pool on CUDA, so a record states which loop produced it
654
+ LOOP = dict(backend=os.environ.get("E0_ENV14_BACKEND", "cuda"), capture=TW1["on"], window=TW1.get("window_mode", "graph"), pool=TW1["pool"], k2=TW1["k2"], tf32=TW1["tf32"],
655
+ m1c=TW1["m1c"], critic_iters=TW1["critic_iters"], e5=TW1.get("e5", False))
656
+ print("[tw14] loop: " + " ".join(f"{k} {v}" for k, v in LOOP.items()), flush=True)
657
+ if os.environ.get("TW14_PARSE_ONLY") == "1": # the caller census (PREREG_CAPSCHED's pin check): the parse alone, nothing built
658
+ print("[tw14] parse-only " + json.dumps(LOOP), flush=True)
659
+ sys.exit(0)
660
+ DRY = int(os.environ.get("TW14_DRY_EPOCHS", "0")) # wrap_dry: 0 (unset) = the full run
661
+ assert DRY >= 0, DRY
662
+ if DRY:
663
+ print(f"[tw14] dry epochs {DRY}: the run's own command and epoch count, stopped after epoch {DRY}'s callback", flush=True)
664
+ check_env()
665
+ if TW1["stamps"]:
666
+ atexit.register(write_stamps)
667
+ S.make_algo = make_algo
668
+ S.make_env = make_env
669
+ S.eval_and_record = eval_and_record
670
+ S.ckpt_payload = ckpt_payload
671
+ S.write_run_config = write_run_config
672
+ sys.argv = ["diffneusim.train.rl_algorithm_suite"] + sys.argv[1:]
673
+ S.main()
674
+