ZeyuLing commited on
Commit
a735cb5
Β·
verified Β·
1 Parent(s): 3cbf65c

Sync hftrainer model card for mdm

Browse files
Files changed (1) hide show
  1. README.md +123 -20
README.md CHANGED
@@ -1,42 +1,145 @@
1
  ---
2
- license: apache-2.0
3
  library_name: hftrainer
4
- pipeline_tag: text-to-motion
5
  tags:
6
  - motion-generation
7
  - text-to-motion
8
- - diffusion
9
  - humanml3d
10
  - mdm
 
11
  ---
12
 
13
- # MDM β€” Human Motion Diffusion Model (hftrainer reproduction)
14
 
15
- Self-contained, `ref_repo`-independent reproduction of **MDM** (Tevet et al.,
16
- ICLR 2023), packaged as an [hftrainer](https://github.com/) `ModelBundle`
17
- artifact. The vendored network + Gaussian diffusion are **bit-identical** to the
18
- released checkpoint.
19
 
20
- - **Task:** Text-to-Motion Β· **Representation:** HumanML3D-263 (20 fps, 22 joints)
21
- - **Text encoder:** CLIP ViT-B/32 (frozen, reloaded by name β€” not stored here)
22
- - **Paper:** [arXiv:2209.14916](https://arxiv.org/abs/2209.14916) Β· **Code:** https://github.com/GuyTevet/motion-diffusion-model
 
 
 
23
 
24
- ## Usage
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
  ```python
27
- from hftrainer.models.mdm import MDMBundle
28
  from hftrainer.pipelines.mdm import MDMPipeline
29
 
30
- bundle = MDMBundle.from_pretrained("ZeyuLing/hftrainer-mdm-humanml3d")
31
- pipe = MDMPipeline(bundle, device="cuda")
32
  motions = pipe.infer_t2m(["a person walks forward then sits down"], [120]) # list of (T, 263)
33
  ```
34
 
35
- ## Metrics (official HumanML3D-263 protocol, n=3970)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
- | FID ↓ | Diversity β†’ | R-Prec Top-3 ↑ | MM-Dist ↓ |
38
  |---|---|---|---|
39
- | **0.509** (paper 0.544) | **9.563** (paper 9.559) | 0.711 | 3.681 |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
- Files: `model.safetensors` (no CLIP) Β· `mdm_config.json` Β· `Mean.npy` / `Std.npy`
42
- (HumanML3D training stats, embedded so the checkpoint is self-contained).
 
 
 
 
 
 
1
  ---
 
2
  library_name: hftrainer
3
+ pipeline_tag: other
4
  tags:
5
  - motion-generation
6
  - text-to-motion
 
7
  - humanml3d
8
  - mdm
9
+ license: other
10
  ---
11
 
12
+ <!-- This model card is synchronized from docs/model_zoo/mdm.md by tools/sync_model_zoo_cards.py. -->
13
 
14
+ # MDM β€” Human Motion Diffusion Model
 
 
 
15
 
16
+ Text-to-motion baseline integrated into the hftrainer Model Zoo. Our
17
+ reproduction is **fully self-contained and independent of `ref_repo`**: the
18
+ network, the Gaussian-diffusion schedule, the classifier-free-guidance sampler
19
+ and the collate are all vendored into `hftrainer.models.motion.mdm._mdm`, and verified
20
+ to be **bit-identical** to the released checkpoint (`max-abs-diff = 0.0` for the
21
+ same seed/input).
22
 
23
+ | | |
24
+ |---|---|
25
+ | **Task** | Text-to-Motion (T2M) |
26
+ | **Bundle / Pipeline** | `MDMBundle` / `MDMPipeline` |
27
+ | **Processed HF artifact** | [`ZeyuLing/hftrainer-mdm-humanml3d`](https://huggingface.co/ZeyuLing/hftrainer-mdm-humanml3d) |
28
+ | **Motion representation** | **HumanML3D-263** (263-dim, 20 fps, 22 joints) |
29
+ | **Text encoder** | CLIP ViT-B/32 (frozen) |
30
+ | **Paper** | *Human Motion Diffusion Model*, Tevet et al., ICLR 2023 β€” [arXiv:2209.14916](https://arxiv.org/abs/2209.14916) |
31
+ | **Original code** | https://github.com/GuyTevet/motion-diffusion-model |
32
+
33
+ ---
34
+
35
+ ## Weights
36
+
37
+ Current hftrainer artifact (diffusers-style `from_pretrained`):
38
+
39
+ | Artifact | Location | Contents | Status |
40
+ |---|---|---|---|
41
+ | MDM HumanML3D | [`ZeyuLing/hftrainer-mdm-humanml3d`](https://huggingface.co/ZeyuLing/hftrainer-mdm-humanml3d) | `model.safetensors` + `mdm_config.json` + `Mean.npy` / `Std.npy` | public Hub artifact; complete CLIP packaging pending |
42
+ | local mirror | `checkpoints/mdm/humanml_trans_enc_512` | same layout | optional local cache |
43
+
44
+ **Use directly from the Hub:**
45
 
46
  ```python
 
47
  from hftrainer.pipelines.mdm import MDMPipeline
48
 
49
+ pipe = MDMPipeline.from_pretrained("ZeyuLing/hftrainer-mdm-humanml3d", device="cuda")
 
50
  motions = pipe.infer_t2m(["a person walks forward then sits down"], [120]) # list of (T, 263)
51
  ```
52
 
53
+ **Or download to disk first:**
54
+
55
+ ```bash
56
+ huggingface-cli download ZeyuLing/hftrainer-mdm-humanml3d \
57
+ --local-dir checkpoints/mdm/humanml_trans_enc_512
58
+ ```
59
+
60
+ The artifact is produced from a raw upstream `.pt` with
61
+ `scripts/eval/convert_mdm_checkpoint.py` (`--verify` asserts bit-identical
62
+ generation after the round-trip).
63
+
64
+ Complete text-encoder packaging is still pending for the current public MDM
65
+ artifact: the model weights reload through `MDMPipeline.from_pretrained`, but
66
+ CLIP ViT-B/32 is currently resolved by name rather than stored inside the repo.
67
+
68
+ ---
69
+
70
+ ## Motion representation
71
+
72
+ **HumanML3D-263**, the standard redundant T2M feature (Guo et al.), 20 fps,
73
+ 22-joint SMPL skeleton. Per frame (263 dims):
74
+
75
+ | Slice | Dim | Meaning |
76
+ |---|---|---|
77
+ | `root_rot_vel` | 1 | root angular velocity (about Y) |
78
+ | `root_lin_vel` | 2 | root linear velocity (XZ plane) |
79
+ | `root_y` | 1 | root height |
80
+ | `ric_data` | 63 | local joint positions (21Γ—3) |
81
+ | `rot_data` | 126 | local joint rotations (21Γ—6, cont. 6D) |
82
+ | `local_vel` | 66 | local joint velocities (22Γ—3) |
83
+ | `foot_contact` | 4 | binary foot-contact labels |
84
+
85
+ Convert to/from other spaces with `hftrainer.motion.representation.convert`
86
+ (e.g. `hml263_to_joints`, `hml263_to_motion135`, `hml263_to_motion272`).
87
+
88
+ ---
89
+
90
+ ## Evaluation
91
+
92
+ Generation under the **official HumanML3D protocol** (standard test split, native
93
+ 263-dim @ 20 fps, first caption) and scoring with the two persisted hftrainer
94
+ evaluators. Reproduce with:
95
+
96
+ ```bash
97
+ # 1) generate (8-GPU sharded)
98
+ bash scripts/eval/_run_mdm_h3d263_shards.sh
99
+ # 2) score with the HumanML3D-263 evaluator
100
+ python3 scripts/eval/verify_evaluators.py --which hml263 \
101
+ --hml263-pred outputs/evaluation/mdm_h3d263_official/mdm_263
102
+ ```
103
+
104
+ ### HumanML3D-263 evaluator (native space, n=3970)
105
 
106
+ | Metric | hftrainer | MDM paper | Note |
107
  |---|---|---|---|
108
+ | **FID** ↓ | **0.509** | 0.544 | βœ… reproduced (within noise) |
109
+ | **Diversity** β†’ | **9.563** | 9.559 | βœ… matches |
110
+ | R-Precision Top-1 / 2 / 3 ↑ | 0.420 / 0.605 / 0.711 | β€” / β€” / 0.611 | evaluator runs slightly hot (GT Top-3 0.816 vs paper 0.797) |
111
+ | MM-Dist ↓ | 3.681 | 5.566 | different evaluator embedding scale |
112
+ | GT(real) R-Prec / Div | 0.518 / 0.720 / 0.816, 9.499 | 0.797 (T3), 9.503 | βœ… GT row consistent |
113
+
114
+ **FID and Diversity match the paper**; R-Precision / MM-Dist differ only by the
115
+ calibration of our persisted evaluator (the GT row shifts the same way), not by
116
+ the model.
117
+
118
+ ### MotionStreamer-272 evaluator (cross-representation, n=7392)
119
+
120
+ MDM is a **263-dim** model; scoring it on the MS-272 evaluator requires a
121
+ `263 β†’ 272` conversion, which shifts the distribution. These numbers are **not a
122
+ fair native comparison** β€” they quantify the conversion gap, not MDM quality.
123
+
124
+ | Metric | MDM→272 | MS-272 GT(real) |
125
+ |---|---|---|
126
+ | FID ↓ | 121.35 | 0.0 |
127
+ | R-Precision Top-1 / 2 / 3 ↑ | 0.379 / 0.529 / 0.610 | 0.706 / 0.857 / 0.911 |
128
+ | MM-Dist ↓ | 20.96 | 15.01 |
129
+ | Diversity β†’ | 25.48 | 27.36 |
130
+
131
+ The GT(real) row reproduces the MotionStreamer paper exactly (R@1 **0.706**, Div
132
+ **27.36**, MM **15.01**), confirming the evaluator is correct; the large MDM FID
133
+ is the `263β†’272` representation mismatch.
134
+
135
+ ---
136
+
137
+ ## Implementation notes
138
 
139
+ - **Vendored, ref_repo-independent**: `hftrainer/models/mdm/_mdm/` holds the
140
+ network (`network.py`), diffusion (`diffusion/`), CFG sampler and collate.
141
+ Training-only deps are stubbed (inference-only).
142
+ - **Normalization travels with the checkpoint**: `Mean.npy` / `Std.npy` are the
143
+ HumanML3D *training* stats (not the evaluator stats) and are embedded in the
144
+ artifact, eliminating the recurring "wrong Mean/Std β†’ forward drift" bug.
145
+ - **Guidance**: classifier-free, default scale `2.5`.