Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(model-text2motion): correct MDM decode path, ship real text-to-motion

nirholascc9c841456e9
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5313b0f3a..c0531eaec 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,17 +9,20 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **KOL Tracker** (`/tracker`) — Solana crypto KOLs ranked by realized P&L computed from their own wallet's on-chain trade history, with win rate, volume, trade count, and X follower counts for verified handles.
- **Tutorial · 3D AI Shopping Assistant for Shopify** (`/tutorials/shopify-shopping-assistant`) — Add a chat assistant with a 3D face to your Shopify store: it reads your live catalog, recommends real products as cards with add-to-cart, and answers shipping and returns, all from one script tag.
- **We Gave 11 AI Agents Their Own Wallets and Real SOL. Here Are All 90 Trades.** (`/blog/autonomous-trading-experiment`) — Two weeks of fully autonomous pump.fun trading on Solana: 11 armed strategies, 90 closed real-money trades, every entry thesis, every exit, every mistake. Plus the 83,000 coins the fleet did not buy, the winners it missed, and a paperhands audit of every sell. Complete dataset included.
+- **3D generations look dramatically more real, at every quality tier** — Every text-to-3D generation now routes through a photoreal reference photo by default, at every tier, not just the paid one. Previously the fastest free lane skipped straight to shape generation from your words alone; now it always paints a studio-lit reference photo first (and, on our self-hosted engine, front/side/back turnaround views for a fuller reconstruction), then a quality check scores that photo before the expensive 3D step even starts, retrying once if it falls short. The prompt-rewrite step also got smarter: people, animals, vehicles, food, buildings, and objects each get their own material and construction guidance instead of one generic description. Repeating an idea within 24 hours reuses its reference photo instantly instead of regenerating it. (`/forge`) `[improvement]`
- **A full notification center, plus two new things it tells you about** — The bell in the nav now links to a dedicated /notifications page: your full history, filterable by category (sales, purchases, social, in person, market alerts, creations, account), with load-more paging so nothing gets lost past the dropdown's last 20. We also closed two gaps in what triggers a notification. Fork royalty streams (an avatar you created earning a slice of income from everyone who forked it) now notify the upstream creator the moment a payout confirms on-chain, with the SOL/USD amount and which fork paid it. And finishing a mission or co-op heist in /play now lands in your inbox too, not just the site-wide activity ticker. Both respect your existing per-category mute preferences in notification settings. (`/notifications`) `[feature]`
- **Agent wallet and portfolio views stay reliable when an RPC provider is capped** — Agent portfolio and wallet-balance reads no longer fail when a Solana RPC provider hits its daily request limit. Balance lookups now fall back across several free, unthrottled Solana nodes, so net-worth snapshots and holdings keep loading during provider throttling instead of erroring out. `[fix, infra]`
- **All 90 trades from the autonomous fleet, published and graded** — The autonomous sniper fleet has closed 90 real-money trades across 8 strategies and 8 wallets, and we published every single one: entry thesis, exit, on-chain receipts, and an honest grade per trade. The deep dive also audits everything the fleet did not do: the 83,000 launches it observed and declined, proof the conviction scorer’s top band hits 77.5% winners at scale (and why zero of those coins were bought), the missed monsters that were invisible at minute zero, and a paperhands check showing every one of the 90 sells was vindicated. Full dataset downloadable as JSON. (`/blog/autonomous-trading-experiment`) `[docs, feature]`
- **Avatars now generate on our strongest 3D lane by default** — Every avatar made through the avatar tools (forge_avatar, text_to_avatar, and the /forge web page's avatar mode) now requests our highest-fidelity generation tier automatically, which routes people/character prompts to our self-hosted Hunyuan3D lane instead of the faster draft lane. That means better proportions, cleaner hands, and less texture warping at the neck and hairline, at no extra cost or extra steps. We also tuned the avatar prompt director to always ask for relaxed, open hands with fingers visible, since closed fists and hidden hands were the single biggest source of mangled-hand meshes. If auto-rigging ever fails after a great mesh generates, you still keep the finished mesh, rigging alone, and can retry rigging separately. (`/forge`) `[improvement]`
- **Every 3D view on the site now renders film-quality** — We audited every 3D viewer on the platform, from the IRL AR placer and avatar talk mode to the marketplace lobby, the coin snapshot view, the trading floor, the demo pages, and the embeddable avatar widget, and brought them all up to one cinematic bar: filmic tone mapping, correct color management, and real photographic HDRI lighting (not a flat studio guess) reflecting off skin, chrome, and fabric alike. A model now looks the same whether you're seeing it on your own profile, in a marketplace card, embedded on someone else's site, or standing on a street corner in AR. Lower-end phones automatically get a lighter version (capped resolution, simplified lighting) so nothing chugs or overheats. (`/irl`) `[improvement]`
+- **Fixed unreadable text on a few pages, added an automated accessibility check** — The AGI, Alpha Co-pilot, and Search pages weren't painting their dark background at all in some load paths, leaving light-mode text rendered on a white canvas instead of the platform's near-black theme, a real readability bug, not just a contrast nitpick. Fixed the underlying stylesheets so every page reliably paints the dark canvas. Also tightened up a few too-faint labels (Forge's card timestamps, the getting-started progress widget) that fell just short of accessible contrast, and wired an automated accessibility scan (axe-core) into the test suite covering the platform's 30 highest-traffic pages, so regressions like this get caught before they ship. `[fix, improvement]`
- **Fixed: wallets showing $0 of $THREE on the tiers page** — Holders reported the site not recognising their $THREE balance: /three showed "You hold $0" (Member tier) for wallets with real bags, across Phantom, Solflare, and Brave Wallet. Root cause: when our primary balance provider ran out of quota, the backup on-chain read only queried the classic SPL token program, and $THREE (like all pump.fun coins) lives on Token-2022, so it was invisible. The backup path now reads both token programs and rides the same deep multi-provider RPC failover as the rest of the platform, so holder tiers, fee discounts, and quota boosts resolve correctly even when individual RPC providers are down. (`/three`) `[fix]`
- **Forge results now come with a full next-step toolkit** — Every model you forge now lands with four new one-click follow-ups right in the result bar. Rig for animation adds a humanoid skeleton and hands you straight to Pose Studio or IRL placement. Restyle materials re-skins the surface (chrome, wood, gold, cyberpunk neon, marble, rust, or your own description) without touching the shape. Iterate makes a real shape-changing edit from a plain sentence, like "make the helmet red" or "add a backpack", and keeps every version in a branchable history you can jump back to. And Place IRL sends the model straight into the AR pin-placement flow so you can anchor it somewhere real. The empty state also grew from three starter prompts to six, so there's more to try with zero typing. (`/forge`) `[feature, improvement]`
- **Opening a 3D object gives you a viewer, not a chatbot** — Previewing a prop from the CC0 object library (a wrench, a vase, an ammo box) used to drop you into the embodied-agent surface, complete with an "Ask the agent" box and prompts like "Why are you embodied?" that make no sense for an inanimate object. Objects now open in a dedicated viewer mode: the agent chat and avatar controls are gone, replaced by the things you actually want for a 3D thing — Restyle to recolor or AI-restyle its materials, View in AR to place it in your room, and Download the CC0 GLB. Avatars are untouched and still open with the full agent experience. (`/objects`) `[improvement]`
- **Real materials: skin, glass, and car paint that actually behave like the real thing** — Avatars now get a subtle skin sheen, wet-looking corneas, and double-sided hair automatically the moment a humanoid model loads in any three.ws viewer, no extra step needed. Restyle Studio's material presets grew a real-physics tier alongside the classic looks: skin, car paint with a genuine clearcoat layer, brushed steel with directional anisotropic highlights, and a real-glass preset that actually refracts (KHR_materials_transmission) instead of faking transparency. The AI restyle tool ("make it chrome", "cyberpunk neon") can now propose clearcoat, transmission, and sheen too when an instruction calls for it. The text-guided texture worker also gained an optional material_class hint (person/metal/wood/fabric/plastic/glass) that bakes measured real-world roughness values instead of one flat guess for every material. (`/restyle`) `[feature, improvement]`
- **Restyled models now show up on your creator portfolio** — Your public portfolio at /u/:username (and /profile for yourself) already collected your forged 3D models and saved worlds into one "Creations" feed alongside your avatars, agents, launched coins, skills, and plugins. Restyled models were the missing piece: an AI material restyle ("make it chrome", "cyberpunk neon") or a seeded colorway variant fan-out from the Restyle Studio now records to your account when you're signed in, and shows up in Creations with a live 3D thumbnail, the instruction or preset used, and a link to the viewer, right next to your other work. (`/profile`) `[feature]`
- **Security hardening across payments, embeds, and account pages** — A full-platform security audit landed fixes for every confirmed finding. Paid API endpoints now reject concurrent replays of the same payment, so one payment can never be redeemed twice for generation work. The Solana payment facilitator only settles USDC and $THREE, closing a path that could waste platform funds on junk tokens. Server fetches that follow user-supplied links (article reader, scene export, vault uploads, agent-to-agent calls) are pinned to pre-validated addresses and re-checked on every redirect, shutting down server-side request forgery against internal services. Sign-in and registration pages validate post-login redirect targets, blocking phishing-grade open redirects, and wallet/payment flows reject cross-site posts. Two scheduled jobs now refuse to run unauthenticated if their secret is ever missing, matching the rest of the fleet. `[security]`
+- **Text-to-motion is live: describe a move, get a new animation** — The text_to_animation tool and POST /api/forge-motion now generate real, brand-new motion from a prompt like "a celebratory jump" or "a slow tai-chi sweep" and retarget it onto any rigged avatar, on a new self-hosted GPU worker (MDM, MIT-licensed). Unlike the curated animation library, this motion doesn't pre-exist: it's synthesized per prompt. Also: generation surfaces (/ar, /ar/studio, and MCP tool responses) now show a real GPU-warming state with an honest countdown and live stage labels instead of a silent spinner when a lane is cold, and the sketch-to-3D and text-to-3D GPU lanes got their scale-up ceilings raised to absorb more concurrent traffic. (`/docs/mcp`) `[feature, improvement]`
- **The Concierge becomes a Shopify shopping assistant, with product cards** — The embeddable AI concierge (the floating chat with a 3D avatar) now turns into a full shopping assistant on any Shopify store, from the same one script tag. It reads your live catalog and policies straight from Shopify's public endpoints, no app, no API key, and no product feed to keep in sync, then helps shoppers find the right thing and shows real product cards with the live image, price, and an add-to-cart button. It understands how people actually shop ("a gift under $75", "cheapest hoodie", "anything on sale?") and answers shipping and returns from your published policies. Because the cards are drawn from your real catalog, it can never invent a product, a price, or a discount. (`/tutorials/shopify-shopping-assistant`) `[feature, sdk]`
- **The sniper learns from its own postmortem: conviction-crossing entries and smarter trailing stops** — Two upgrades shipped straight from the 90-trade analysis. First, a new oracle_crossing trigger: instead of judging a coin at launch, when the conviction scorer has no signal yet, an arm can now buy the moment a coin first crosses its conviction bar. Measured over the fleet window, that band pumped or graduated 77.5% of the time versus an 11.8% base rate, and the crossing lands a median of two minutes after launch. The formerly idle strict arm is re-armed on it with a sell-the-initials ladder. Second, trailing stops now arm only once a position has been above breakeven; armed underwater they only converted recoverable dips into locked losses while the hard stop-loss already capped the downside. (`/blog/autonomous-trading-experiment`) `[feature, improvement]`
diff --git a/data/changelog.json b/data/changelog.json
index b7c9cb11d..5b28fd36e 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,16 @@
{
"$comment": "Curated changelog entries for three.ws, the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.",
"entries": [
+ {
+ "date": "2026-07-23",
+ "title": "Text-to-motion is live: describe a move, get a new animation",
+ "summary": "The text_to_animation tool and POST /api/forge-motion now generate real, brand-new motion from a prompt like \"a celebratory jump\" or \"a slow tai-chi sweep\" and retarget it onto any rigged avatar, on a new self-hosted GPU worker (MDM, MIT-licensed). Unlike the curated animation library, this motion doesn't pre-exist: it's synthesized per prompt. Also: generation surfaces (/ar, /ar/studio, and MCP tool responses) now show a real GPU-warming state with an honest countdown and live stage labels instead of a silent spinner when a lane is cold, and the sketch-to-3D and text-to-3D GPU lanes got their scale-up ceilings raised to absorb more concurrent traffic.",
+ "tags": [
+ "feature",
+ "improvement"
+ ],
+ "link": "/docs/mcp"
+ },
{
"date": "2026-07-23",
"title": "Fixed unreadable text on a few pages, added an automated accessibility check",
diff --git a/public/changelog.json b/public/changelog.json
index c22a97a52..79cb77316 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-07-23T13:48:38.850Z",
+ "generated_at": "2026-07-23T15:39:04.361Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -36,6 +36,16 @@
"launch"
]
},
+ {
+ "date": "2026-07-23",
+ "type": "update",
+ "title": "3D generations look dramatically more real, at every quality tier",
+ "summary": "Every text-to-3D generation now routes through a photoreal reference photo by default, at every tier, not just the paid one. Previously the fastest free lane skipped straight to shape generation from your words alone; now it always paints a studio-lit reference photo first (and, on our self-hosted engine, front/side/back turnaround views for a fuller reconstruction), then a quality check scores that photo before the expensive 3D step even starts, retrying once if it falls short. The prompt-rewrite step also got smarter: people, animals, vehicles, food, buildings, and objects each get their own material and construction guidance instead of one generic description. Repeating an idea within 24 hours reuses its reference photo instantly instead of regenerating it.",
+ "link": "/forge",
+ "tags": [
+ "improvement"
+ ]
+ },
{
"date": "2026-07-23",
"type": "update",
@@ -88,6 +98,17 @@
"improvement"
]
},
+ {
+ "date": "2026-07-23",
+ "type": "update",
+ "title": "Fixed unreadable text on a few pages, added an automated accessibility check",
+ "summary": "The AGI, Alpha Co-pilot, and Search pages weren't painting their dark background at all in some load paths, leaving light-mode text rendered on a white canvas instead of the platform's near-black theme, a real readability bug, not just a contrast nitpick. Fixed the underlying stylesheets so every page reliably paints the dark canvas. Also tightened up a few too-faint labels (Forge's card timestamps, the getting-started progress widget) that fell just short of accessible contrast, and wired an automated accessibility scan (axe-core) into the test suite covering the platform's 30 highest-traffic pages, so regressions like this get caught before they ship.",
+ "link": null,
+ "tags": [
+ "fix",
+ "improvement"
+ ]
+ },
{
"date": "2026-07-23",
"type": "update",
@@ -150,6 +171,17 @@
"security"
]
},
+ {
+ "date": "2026-07-23",
+ "type": "update",
+ "title": "Text-to-motion is live: describe a move, get a new animation",
+ "summary": "The text_to_animation tool and POST /api/forge-motion now generate real, brand-new motion from a prompt like \"a celebratory jump\" or \"a slow tai-chi sweep\" and retarget it onto any rigged avatar, on a new self-hosted GPU worker (MDM, MIT-licensed). Unlike the curated animation library, this motion doesn't pre-exist: it's synthesized per prompt. Also: generation surfaces (/ar, /ar/studio, and MCP tool responses) now show a real GPU-warming state with an honest countdown and live stage labels instead of a silent spinner when a lane is cold, and the sketch-to-3D and text-to-3D GPU lanes got their scale-up ceilings raised to absorb more concurrent traffic.",
+ "link": "/docs/mcp",
+ "tags": [
+ "feature",
+ "improvement"
+ ]
+ },
{
"date": "2026-07-23",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index 7d3e37783..0152c3350 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -30,6 +30,14 @@
<category>launch</category>
<description>Two weeks of fully autonomous pump.fun trading on Solana: 11 armed strategies, 90 closed real-money trades, every entry thesis, every exit, every mistake. Plus the 83,000 coins the fleet did not buy, the winners it missed, and a paperhands audit of every sell. Complete dataset included.</description>
</item>
+ <item>
+ <title>3D generations look dramatically more real, at every quality tier</title>
+ <link>https://three.ws/forge</link>
+ <guid isPermaLink="false">2026-07-23:3D generations look dramatically more real, at every quality tier</guid>
+ <pubDate>Thu, 23 Jul 2026 12:00:00 GMT</pubDate>
+ <category>improvement</category>
+ <description>Every text-to-3D generation now routes through a photoreal reference photo by default, at every tier, not just the paid one. Previously the fastest free lane skipped straight to shape generation from your words alone; now it always paints a studio-lit reference photo first (and, on our self-hosted engine, front/side/back turnaround views for a fuller reconstruction), then a quality check scores that photo before the expensive 3D step even starts, retrying once if it falls short. The prompt-rewrite step also got smarter: people, animals, vehicles, food, buildings, and objects each get their own material and construction guidance instead of one generic description. Repeating an idea within 24 hours reuses its reference photo instantly instead of regenerating it.</description>
+ </item>
<item>
<title>A full notification center, plus two new things it tells you about</title>
<link>https://three.ws/notifications</link>
@@ -70,6 +78,14 @@
<category>improvement</category>
<description>We audited every 3D viewer on the platform, from the IRL AR placer and avatar talk mode to the marketplace lobby, the coin snapshot view, the trading floor, the demo pages, and the embeddable avatar widget, and brought them all up to one cinematic bar: filmic tone mapping, correct color management, and real photographic HDRI lighting (not a flat studio guess) reflecting off skin, chrome, and fabric alike. A model now looks the same whether you're seeing it on your own profile, in a marketplace card, embedded on someone else's site, or standing on a street corner in AR. Lower-end phones automatically get a lighter version (capped resolution, simplified lighting) so nothing chugs or overheats.</description>
</item>
+ <item>
+ <title>Fixed unreadable text on a few pages, added an automated accessibility check</title>
+ <link>https://three.ws/changelog</link>
+ <guid isPermaLink="false">2026-07-23:Fixed unreadable text on a few pages, added an automated accessibility check</guid>
+ <pubDate>Thu, 23 Jul 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>The AGI, Alpha Co-pilot, and Search pages weren't painting their dark background at all in some load paths, leaving light-mode text rendered on a white canvas instead of the platform's near-black theme, a real readability bug, not just a contrast nitpick. Fixed the underlying stylesheets so every page reliably paints the dark canvas. Also tightened up a few too-faint labels (Forge's card timestamps, the getting-started progress widget) that fell just short of accessible contrast, and wired an automated accessibility scan (axe-core) into the test suite covering the platform's 30 highest-traffic pages, so regressions like this get caught before they ship.</description>
+ </item>
<item>
<title>Fixed: wallets showing $0 of $THREE on the tiers page</title>
<link>https://three.ws/three</link>
@@ -118,6 +134,14 @@
<category>security</category>
<description>A full-platform security audit landed fixes for every confirmed finding. Paid API endpoints now reject concurrent replays of the same payment, so one payment can never be redeemed twice for generation work. The Solana payment facilitator only settles USDC and $THREE, closing a path that could waste platform funds on junk tokens. Server fetches that follow user-supplied links (article reader, scene export, vault uploads, agent-to-agent calls) are pinned to pre-validated addresses and re-checked on every redirect, shutting down server-side request forgery against internal services. Sign-in and registration pages validate post-login redirect targets, blocking phishing-grade open redirects, and wallet/payment flows reject cross-site posts. Two scheduled jobs now refuse to run unauthenticated if their secret is ever missing, matching the rest of the fleet.</description>
</item>
+ <item>
+ <title>Text-to-motion is live: describe a move, get a new animation</title>
+ <link>https://three.ws/docs/mcp</link>
+ <guid isPermaLink="false">2026-07-23:Text-to-motion is live: describe a move, get a new animation</guid>
+ <pubDate>Thu, 23 Jul 2026 12:00:00 GMT</pubDate>
+ <category>feature</category>
+ <description>The text_to_animation tool and POST /api/forge-motion now generate real, brand-new motion from a prompt like &quot;a celebratory jump&quot; or &quot;a slow tai-chi sweep&quot; and retarget it onto any rigged avatar, on a new self-hosted GPU worker (MDM, MIT-licensed). Unlike the curated animation library, this motion doesn't pre-exist: it's synthesized per prompt. Also: generation surfaces (/ar, /ar/studio, and MCP tool responses) now show a real GPU-warming state with an honest countdown and live stage labels instead of a silent spinner when a lane is cold, and the sketch-to-3D and text-to-3D GPU lanes got their scale-up ceilings raised to absorb more concurrent traffic.</description>
+ </item>
<item>
<title>The Concierge becomes a Shopify shopping assistant, with product cards</title>
<link>https://three.ws/tutorials/shopify-shopping-assistant</link>
diff --git a/public/features.json b/public/features.json
index 441b3ac82..5dc6ff75d 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-07-23T13:48:38.841Z",
+ "generated_at": "2026-07-23T15:39:04.354Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/workers/model-text2motion/mdm_sampler.py b/workers/model-text2motion/mdm_sampler.py
index 0ad0624a5..44af76264 100644
--- a/workers/model-text2motion/mdm_sampler.py
+++ b/workers/model-text2motion/mdm_sampler.py
@@ -127,7 +127,17 @@ class MdmSampler:
horizon = min(MAX_MOTION_LEN, max(2, int(round(n_frames * HUMANML_FPS / max(n_frames, 1))) or n_frames))
horizon = min(MAX_MOTION_LEN, max(2, n_frames))
- model_kwargs = {"y": {"text": [prompt], "lengths": torch.tensor([horizon], device=self.device)}}
+ # MDM.forward reads `y['mask'].shape[-1]` unconditionally (see model/mdm.py:
+ # `is_valid_mask = y['mask'].shape[-1] > 1`) even though this deployment's
+ # checkpoint has mask_frames=False, so the key must exist regardless. A
+ # single unpadded prompt at exactly `horizon` frames has no padding, so
+ # the honest mask a real (non-padded) batch's collate would produce is
+ # all-ones over the full length — shape (bs, 1, 1, horizon), matching
+ # sample/generate.py's own `model_kwargs['y']['mask']` convention.
+ mask = torch.ones((1, 1, 1, horizon), dtype=torch.bool, device=self.device)
+ model_kwargs = {
+ "y": {"text": [prompt], "lengths": torch.tensor([horizon], device=self.device), "mask": mask}
+ }
if self._guidance_param != 1:
model_kwargs["y"]["scale"] = torch.ones(1, device=self.device) * self._guidance_param
sample_fn = self._diffusion.p_sample_loop
@@ -170,13 +180,33 @@ def _decode_to_smpl(sample):
intended place to calibrate the residual SMPL-rest vs. Wolf3D-rest
orientation offset.
"""
+ import torch
from data_loaders.humanml.scripts.motion_process import recover_from_ric
from data_loaders.humanml.utils import paramUtil
- # sample: (1, njoints, nfeats, T) → (T, features)
- feats = sample.squeeze(0).permute(2, 0, 1).contiguous() # (T, njoints, nfeats)
n_joints = 22
- positions = recover_from_ric(feats.float(), n_joints) # (T, 22, 3)
+
+ # sample: (1, njoints=263, nfeats=1, T) → (T, 263). NOT
+ # `.squeeze(0).permute(2,0,1)` (a prior version of this code did that): that
+ # reorders to (T, 263, 1) and leaves the size-1 nfeats axis trailing, so
+ # `recover_from_ric`'s `data[..., 0]` etc. (which assume the LAST dim is the
+ # 263-wide feature vector) silently slice the wrong axis instead of failing
+ # loudly. `.squeeze(1)` first removes nfeats, then permute puts T first.
+ feats = sample.squeeze(0).squeeze(1).permute(1, 0).float() # (T, 263)
+
+ # The diffusion model samples in HumanML3D's NORMALIZED feature space
+ # (zero mean / unit std over the training set) — recover_from_ric expects
+ # real units. Denormalize with the checkpoint-independent HumanML3D dataset
+ # stats MDM ships in its own repo (`dataset/t2m_{mean,std}.npy`, small
+ # precomputed arrays, not a license-gated model file), exactly the
+ # `inv_transform` upstream's own sample/generate.py applies before calling
+ # this same recover_from_ric.
+ # PYTHONPATH=/opt/mdm is fixed by the Dockerfile's `git clone ... /opt/mdm`.
+ mean = torch.from_numpy(np.load("/opt/mdm/dataset/t2m_mean.npy")).float().to(feats.device)
+ std = torch.from_numpy(np.load("/opt/mdm/dataset/t2m_std.npy")).float().to(feats.device)
+ feats = feats * std + mean
+
+ positions = recover_from_ric(feats, n_joints) # (T, 22, 3)
positions = positions.cpu().numpy().astype(np.float64)
parents = _parents_from_kinematic_chain(paramUtil.t2m_kinematic_chain, n_joints)