ml: 全流程代码与运行手册(数据打包/可微运动学与对拍/MeanFlow+WTA 模型/训练/闭环仿真/APG/挖错循环/ONNX 导出);webapp 策略运行时 ik-policy.js + ?policy=1 接入;tests/policy_bench.cjs;ik-solver 增 pairList/clusterExport/criticalPairs/pairGap/leverTable

This commit is contained in:
Hark
2026-10-17 15:48:19 +00:00
parent 7e70c4e811
commit 8bfe9bc083
50 changed files with 2677 additions and 172 deletions
+17
View File
@@ -0,0 +1,17 @@
"""本地预览查看器(带 COOP/COEP 头 → 页面跨源隔离 → onnxruntime-web 可用多线程 wasm)
python ml/serve.py [端口=8000] 然后打开 http://localhost:8000/?policy=1
注:跨源隔离下从 CDN 加载 ort.min.js 需要 CDN 返回 CORP 头;jsDelivr 支持。若被拦,用 &ortLocal=1 并把
onnxruntime-web 的 dist 文件(ort.min.js、ort-wasm-simd-threaded*.wasm/.mjs)放到 webapp/vendor/ort/。"""
import http.server, os, sys
os.chdir(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'webapp'))
class H(http.server.SimpleHTTPRequestHandler):
def end_headers(self):
self.send_header('Cross-Origin-Opener-Policy', 'same-origin')
self.send_header('Cross-Origin-Embedder-Policy', 'require-corp')
self.send_header('Cross-Origin-Resource-Policy', 'cross-origin')
self.send_header('Cache-Control', 'no-store')
super().end_headers()
extensions_map = {**http.server.SimpleHTTPRequestHandler.extensions_map, '.wasm': 'application/wasm', '.mjs': 'text/javascript'}
port = int(sys.argv[1]) if len(sys.argv) > 1 else 8000
print(f'http://localhost:{port}/?policy=1')
http.server.ThreadingHTTPServer(('', port), H).serve_forever()