Rewrite the card in the house style with durable facts only
Browse files
README.md
CHANGED
|
@@ -1,161 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# motion-bricks.cpp
|
| 2 |
|
| 3 |
-
A C++23/GGML port of NVIDIA MotionBricks for CPU and Vulkan inference, with a
|
| 4 |
-
stable C ABI suitable for PureGo.
|
| 5 |
|
| 6 |
-
|
| 7 |
-
GGUF loading, root/duration planning, pose-token prediction, VQ decoding,
|
| 8 |
-
418/414/413 feature conversion, style alignment, and skeletal animation
|
| 9 |
-
output. CPU and Vulkan use the same public API and preserve the same duration
|
| 10 |
-
and pose-token decisions in the reference suite.
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
|
| 15 |
|
| 16 |
-
``
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
ctest --preset debug
|
| 20 |
-
```
|
| 21 |
|
| 22 |
-
|
| 23 |
-
GGUF and style bundles into `generated/` when they are not already present.
|
| 24 |
-
The same operation can be run explicitly:
|
| 25 |
|
| 26 |
```sh
|
| 27 |
-
python scripts/download_gguf_weights.py
|
| 28 |
-
```
|
| 29 |
-
|
| 30 |
-
For an offline or source-only build, preserve an existing local bundle or use
|
| 31 |
-
`cmake --preset debug -DMOTIONBRICKS_DOWNLOAD_MODELS=OFF`. The repository and
|
| 32 |
-
revision are configurable with `MOTIONBRICKS_MODEL_REPOSITORY` and
|
| 33 |
-
`MOTIONBRICKS_MODEL_REVISION`.
|
| 34 |
-
|
| 35 |
-
On NixOS, enter the reproducible development shell first:
|
| 36 |
-
|
| 37 |
-
```sh
|
| 38 |
-
nix develop
|
| 39 |
cmake --preset debug
|
| 40 |
cmake --build --preset debug
|
| 41 |
ctest --preset debug
|
|
|
|
| 42 |
```
|
| 43 |
|
| 44 |
-
|
| 45 |
-
The
|
| 46 |
-
|
| 47 |
-
```sh
|
| 48 |
-
cmake -S . -B build/debug -G Ninja -DMOTIONBRICKS_ENABLE_GGML=OFF
|
| 49 |
-
```
|
| 50 |
-
|
| 51 |
-
The Go binding and demo use PureGo to load `libmotionbricks` at runtime; they
|
| 52 |
-
do not use cgo or `import "C"`. Once the native shared library has been built,
|
| 53 |
-
the Go components therefore need no C compiler and can be built with cgo
|
| 54 |
-
explicitly disabled:
|
| 55 |
|
| 56 |
```sh
|
| 57 |
cd demo
|
| 58 |
CGO_ENABLED=0 go build -o ../build/debug/bin/motionbricks-demo .
|
| 59 |
```
|
| 60 |
|
| 61 |
-
`
|
| 62 |
-
in builds and CI. It affects only the Go build—the native C++ library is still
|
| 63 |
-
built separately with CMake.
|
| 64 |
-
|
| 65 |
-
The sanitizer lane is:
|
| 66 |
-
|
| 67 |
-
```sh
|
| 68 |
-
cmake --preset asan-ubsan
|
| 69 |
-
cmake --build --preset asan-ubsan
|
| 70 |
-
ctest --preset asan-ubsan
|
| 71 |
-
```
|
| 72 |
-
|
| 73 |
-
## Current ABI
|
| 74 |
-
|
| 75 |
-
The installed C API uses only fixed-width scalars, pointers, and opaque heap
|
| 76 |
-
handles. Callers never reproduce a C or C++ structure layout. All constructors
|
| 77 |
-
have matching free functions, and no C++ exception crosses the ABI boundary.
|
| 78 |
-
|
| 79 |
-
The current CLI can report ABI information:
|
| 80 |
-
|
| 81 |
-
```sh
|
| 82 |
-
./build/debug/bin/motionbricks-cli abi
|
| 83 |
-
```
|
| 84 |
-
|
| 85 |
-
After producing the trusted safetensors intermediates described in
|
| 86 |
-
`reference/README.md`, build and inspect an F32 runtime bundle with:
|
| 87 |
-
|
| 88 |
-
```sh
|
| 89 |
-
python scripts/convert_to_gguf.py \
|
| 90 |
-
--safe-directory generated/safe \
|
| 91 |
-
--output generated/g1-f32
|
| 92 |
-
./build/debug/bin/motionbricks-cli inspect generated/g1-f32
|
| 93 |
-
```
|
| 94 |
-
|
| 95 |
-
The released G1 inference path contains exactly **183,148,382 learned F32
|
| 96 |
-
parameters**. The bundle loader validates the upstream revision, source
|
| 97 |
-
checkpoint identities, component roles, tensor counts, parameter counts,
|
| 98 |
-
anchor shapes, and the 34-joint parent topology before accepting a model.
|
| 99 |
-
|
| 100 |
-
Convert the 15 original demo styles with:
|
| 101 |
-
|
| 102 |
-
```sh
|
| 103 |
-
python scripts/convert_styles.py \
|
| 104 |
-
--safe-directory generated/safe \
|
| 105 |
-
--output generated/styles
|
| 106 |
-
```
|
| 107 |
-
|
| 108 |
-
At runtime the high-level flow is: load one immutable model, load one or more
|
| 109 |
-
`.mbstyle` assets, create an agent, reset it from an initial style (or supply
|
| 110 |
-
at least four frames of G1 context), set movement/facing/style on a command,
|
| 111 |
-
then call `mb_agent_plan`. The returned motion owns row-major F32 root
|
| 112 |
-
translations `[frames,3]` and local XYZW rotations `[frames,34,4]`. Call
|
| 113 |
-
`mb_agent_advance` as playback progresses so replanning uses the generated
|
| 114 |
-
motion as its next context.
|
| 115 |
-
|
| 116 |
-
The current implementation covers original preprocessed G1 styles. Direct
|
| 117 |
-
Kimodo GLB-to-`.mbstyle` conversion remains subsequent integration work.
|
| 118 |
-
|
| 119 |
-
## Weights
|
| 120 |
-
|
| 121 |
-
Ready-to-run native weights and all 15 upstream style primitives are published
|
| 122 |
-
as [MotionBricks-G1-GGML](https://huggingface.co/LocalAI-io/MotionBricks-G1-GGML)
|
| 123 |
-
under the Hugging Face `LocalAI-io` organisation. NVIDIA currently distributes
|
| 124 |
-
MotionBricks checkpoints through Git LFS in
|
| 125 |
-
[`NVlabs/GR00T-WholeBodyControl`](https://github.com/NVlabs/GR00T-WholeBodyControl/tree/a0732b642c0333077e127a2f56ab0014c196bca4/motionbricks),
|
| 126 |
-
not a separate Hugging Face model repository, so the model card links to that
|
| 127 |
-
pinned upstream revision. The downloader verifies the version-controlled
|
| 128 |
-
distribution manifest before accepting any file.
|
| 129 |
-
|
| 130 |
-
The default build is pinned to Hugging Face commit
|
| 131 |
-
`cc2a47603dbc203a4f18f35dd06ed3611833f506` rather than the mutable `main`
|
| 132 |
-
branch.
|
| 133 |
-
|
| 134 |
-
## Interactive demo
|
| 135 |
-
|
| 136 |
-
The initial Go/Three.js demo renders the model's 34-joint skeleton alongside
|
| 137 |
-
the four actual placed target-keyframe ghosts. It lets you steer with W/A/S/D,
|
| 138 |
-
turn facing with the arrow keys, orbit/zoom the camera, and switch among the
|
| 139 |
-
converted upstream styles. It uses the reusable PureGo binding and the same
|
| 140 |
-
stateful native agent as other applications. See the
|
| 141 |
-
[demo guide](docs/DEMO.md) for build, run, architecture, and headless-Chromium
|
| 142 |
-
test instructions.
|
| 143 |
-
|
| 144 |
-
## Design
|
| 145 |
-
|
| 146 |
-
- [Human-led design](docs/motions-bricks.md)
|
| 147 |
-
- [Implementation sketch and plan](docs/IMPLEMENTATION.md)
|
| 148 |
-
- [Versioned formats](docs/FORMATS.md)
|
| 149 |
-
- [Go/Three.js demo](docs/DEMO.md)
|
| 150 |
-
- [Pinned upstream reference](reference/README.md)
|
| 151 |
|
| 152 |
-
##
|
| 153 |
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
with the published model. It permits derivative models and redistribution with
|
| 158 |
-
conditions including retention of the agreement and attribution, Trustworthy
|
| 159 |
-
AI terms, and trade compliance. Bundled third-party components retain their own
|
| 160 |
-
licenses; the vendored Three.js files are covered by
|
| 161 |
-
`demo/web/vendor/THREE-LICENSE.txt`.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
---
|
| 4 |
# motion-bricks.cpp
|
| 5 |
|
| 6 |
+
A C++23/GGML port of NVIDIA MotionBricks for CPU and Vulkan inference, with a stable C ABI for PureGo.
|
|
|
|
| 7 |
|
| 8 |
+
## What it is for
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
The repo holds the C++ source, a C header and C++ wrapper, a PureGo binding, a Go/Three.js demo, conversion scripts and parity tests.
|
| 11 |
+
It implements the batch-one G1 inference path end to end: strict GGUF loading, root and duration planning, pose-token prediction, VQ decoding, feature conversion, style alignment and skeletal animation output.
|
| 12 |
+
CPU and Vulkan use the same public API and make the same duration and pose-token decisions in the reference suite.
|
| 13 |
+
The C API uses only fixed-width scalars, pointers and opaque heap handles. No C++ exception crosses the ABI boundary.
|
| 14 |
+
At runtime a caller loads one model and one or more `.mbstyle` assets, creates an agent, sets movement, facing and style, then calls `mb_agent_plan` and `mb_agent_advance`.
|
| 15 |
+
The bundle loader checks the upstream revision, checkpoint identities, tensor and parameter counts and the joint topology before it accepts a model.
|
| 16 |
|
| 17 |
+
## Provenance
|
| 18 |
|
| 19 |
+
- Upstream source: NVIDIA MotionBricks in [NVlabs/GR00T-WholeBodyControl](https://github.com/NVlabs/GR00T-WholeBodyControl/tree/a0732b642c0333077e127a2f56ab0014c196bca4/motionbricks), at revision `a0732b642c0333077e127a2f56ab0014c196bca4`.
|
| 20 |
+
- Converted weights and style primitives: [LocalAI-io/MotionBricks-G1-GGML](https://huggingface.co/LocalAI-io/MotionBricks-G1-GGML). The default build pins Hugging Face commit `cc2a47603dbc203a4f18f35dd06ed3611833f506`.
|
| 21 |
+
- Fork notes are in `FORK_PROVENANCE.md`. The pinned upstream reference is in `reference/README.md`.
|
|
|
|
|
|
|
| 22 |
|
| 23 |
+
## Build and run
|
|
|
|
|
|
|
| 24 |
|
| 25 |
```sh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
cmake --preset debug
|
| 27 |
cmake --build --preset debug
|
| 28 |
ctest --preset debug
|
| 29 |
+
./build/debug/bin/motionbricks-cli abi
|
| 30 |
```
|
| 31 |
|
| 32 |
+
Configuration downloads and SHA-256-verifies the G1 F32 GGUF and style bundles into `generated/`. Use `-DMOTIONBRICKS_DOWNLOAD_MODELS=OFF` for an offline build. On NixOS, run `nix develop` first.
|
| 33 |
+
The Go binding and demo load `libmotionbricks` at runtime with PureGo, so they build with `CGO_ENABLED=0`:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
```sh
|
| 36 |
cd demo
|
| 37 |
CGO_ENABLED=0 go build -o ../build/debug/bin/motionbricks-demo .
|
| 38 |
```
|
| 39 |
|
| 40 |
+
See `docs/DEMO.md` for the demo, `docs/FORMATS.md` for the file formats and `docs/IMPLEMENTATION.md` for the design.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
+
## Licence
|
| 43 |
|
| 44 |
+
The source code is licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0) (`LICENSE`).
|
| 45 |
+
NVIDIA's model weights and the converted GGUF and style distributions stay under the NVIDIA Open Model License, reproduced with [LocalAI-io/MotionBricks-G1-GGML](https://huggingface.co/LocalAI-io/MotionBricks-G1-GGML) and in `scripts/hf/MotionBricks-G1-GGML/UPSTREAM_LICENSE`.
|
| 46 |
+
Bundled third-party parts keep their own licences. The vendored Three.js files are covered by `demo/web/vendor/THREE-LICENSE.txt`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|