[SIGGRAPH Asia 2026] UniMate: One Unified Model to Animate Diverse Skeletons
Python
Add Qwen3.5 captioner support and fix video fps handling
Friedrich-M5e6c8683b8b1
diff --git a/data_process/README.md b/data_process/README.mdindex 3c31601..8341d55 100644--- a/data_process/README.md+++ b/data_process/README.md@@ -123,6 +123,13 @@ dataset/features/<dataset>/ stage-4 training clips + cond.npy`<dataset>` is one of `truebones`, `mixamo`, `objaverse`.+Both `dataset/render/` paths are symlinks into the dataset's own Hub mirror, so renders sit+beside the assets they came from and upload with them — `truebones` →+`raw/truebones/{animation_render,species_tpose}`, `mixamo` →+`raw/mixamo/{animation_motion_render,character_tpose}`, `objaverse` →+`raw/objaverse_renders/{glb_render,tpose}`. Objaverse keeps its renders in a separate repo+because there are 10,355 clip folders.+## Getting the Raw DataThe source assets are hosted on the Hugging Face Hub and download straight into the layout above:@@ -131,6 +138,7 @@ The source assets are hosted on the Hugging Face Hub and download straight intobash data_process/scripts/run_download.sh mixamo # → dataset/raw/mixamo/{animation_motion,character_refined,...}bash data_process/scripts/run_download.sh objaverse # → dataset/raw/objaverse/glbbash data_process/scripts/run_download.sh truebones # → dataset/raw/truebones (annotations only — see below)+bash data_process/scripts/run_download.sh objaverse_renders # → dataset/raw/objaverse_renders (optional, ~6 GB)```| Dataset | Source |@@ -138,6 +146,7 @@ bash data_process/scripts/run_download.sh truebones # → dataset/raw/truebone| `mixamo` | [Linzhan/Mixamo-Animations-Characters](https://huggingface.co/datasets/Linzhan/Mixamo-Animations-Characters) || `objaverse` | [Linzhan/Objaverse-XL-Rigged-Animated](https://huggingface.co/datasets/Linzhan/Objaverse-XL-Rigged-Animated) || `truebones` | [Linzhan/Truebones-ZOO-Annotations](https://huggingface.co/datasets/Linzhan/Truebones-ZOO-Annotations) (prompts, metadata, renders, build scripts — no motion files) |+| `objaverse_renders` | [Linzhan/Objaverse-XL-Rigged-Animated-Renders](https://huggingface.co/datasets/Linzhan/Objaverse-XL-Rigged-Animated-Renders) (four-view clip MP4s + T-pose grids; download-only companion, not needed to run the pipeline) |The mixamo and truebones repos also carry the stage-2a multi-view renders as per-view MP4 previews plus camera JSONs (`animation_motion_render/`, `animation_render/` — see each repo's README). The per-frame PNGs the caption stage reads are not hosted; stage 2a regenerates them (or extract stills from the MP4s).diff --git a/data_process/joint_annotation/llm.py b/data_process/joint_annotation/llm.pyindex ff9d034..fa44973 100644--- a/data_process/joint_annotation/llm.py+++ b/data_process/joint_annotation/llm.py@@ -62,7 +62,7 @@ def load_local_model(model_name, device_map="auto", torch_dtype=None):tokenizer = AutoTokenizer.from_pretrained(model_name)model = AutoModelForCausalLM.from_pretrained(model_name,- torch_dtype=dtype,+ dtype=dtype,device_map=device_map,)model.eval()diff --git a/data_process/mesh_animation/animate_motion.py b/data_process/mesh_animation/animate_motion.pyindex 039d763..a149367 100644--- a/data_process/mesh_animation/animate_motion.py+++ b/data_process/mesh_animation/animate_motion.py@@ -99,18 +99,18 @@ def build_anim_from_npy(anim_path, cond_data, anim_mode):legacy ``.npy`` of model motion features.Decoding model features back into an ``Animation`` requires the- training/inference package (``src.utils.motion_utils``), which is+ training/inference package (``unimate.utils.motion_utils``), which isimported lazily here so the NPZ path stays usable without it."""try:- from src.utils.motion_utils import (- recover_anytop_anim_from_rot,- recover_anytop_joint_pos_from_ric,+ from unimate.utils.motion_utils import (+ recover_unimate_anim_from_rot,+ recover_unimate_joint_pos_from_ric,)except ImportError as exc: # pragma: no cover — depends on the model packageraise RuntimeError("Legacy .npy motion features need the training/inference package "- "(src.utils.motion_utils); pass a feature-format .npz instead."+ "(unimate.utils.motion_utils); pass a feature-format .npz instead.") from excparents = cond_data['parents']@@ -125,12 +125,12 @@ def build_anim_from_npy(anim_path, cond_data, anim_mode):if anim_mode == 'fk':logger.info("Recovering animation using FK mode")- anim = recover_anytop_anim_from_rot(anim_data, parents, offsets)+ anim = recover_unimate_anim_from_rot(anim_data, parents, offsets)anim = scale_anim(anim, 1. / scale_factor)elif anim_mode == 'ik':logger.info("Recovering animation using IK mode")from InverseKinematics import animation_from_positions- recover_pos_ric = recover_anytop_joint_pos_from_ric(anim_data)+ recover_pos_ric = recover_unimate_joint_pos_from_ric(anim_data)ik_anim, ik_order, _ = animation_from_positions(recover_pos_ric, parents, offsets, iterations=150,)diff --git a/data_process/scripts/run_caption_motion.sh b/data_process/scripts/run_caption_motion.shindex f2dca46..f13221c 100755--- a/data_process/scripts/run_caption_motion.sh+++ b/data_process/scripts/run_caption_motion.sh@@ -2,13 +2,14 @@# Stage 2 — caption multi-view motion renders with a VLM.# The backend is picked from MODEL, with the same rules as detect_backend() in# vlm_caption/backends.py:-# *qwen* (default, any case) -> local Qwen3-VL (GPU-bound; supports --multi-gpu)+# *qwen* (default, any case) -> local Qwen3-VL / Qwen3.5 (GPU-bound; supports --multi-gpu)# gemini* -> Gemini API (needs GOOGLE_API_KEY)# anything else -> OpenAI-compatible API (needs OPENAI_API_KEY)## Usage:# bash data_process/scripts/run_caption_motion.sh objaverse # local Qwen3-VL# bash data_process/scripts/run_caption_motion.sh truebones --multi-gpu # all visible GPUs (local backend only)+# MODEL=Qwen/Qwen3.5-9B bash data_process/scripts/run_caption_motion.sh objaverse# MODEL=gemini-3-flash-preview bash data_process/scripts/run_caption_motion.sh objaverse# MODEL=gpt-5-mini NUM_WORKERS=16 bash data_process/scripts/run_caption_motion.sh mixamo#diff --git a/data_process/scripts/run_download.sh b/data_process/scripts/run_download.shindex ccc9aa2..4c74833 100755--- a/data_process/scripts/run_download.sh+++ b/data_process/scripts/run_download.sh@@ -6,11 +6,17 @@# bash data_process/scripts/run_download.sh mixamo # animations + rigged characters# bash data_process/scripts/run_download.sh objaverse # rigged + animated GLBs# bash data_process/scripts/run_download.sh objaverse --include 'glb/*' # skip metadata+# bash data_process/scripts/run_download.sh objaverse_renders # renders + T-poses## Sources:-# mixamo https://huggingface.co/datasets/Linzhan/Mixamo-Animations-Characters-# objaverse https://huggingface.co/datasets/Linzhan/Objaverse-XL-Rigged-Animated-# truebones https://huggingface.co/datasets/Linzhan/Truebones-ZOO-Annotations+# mixamo https://huggingface.co/datasets/Linzhan/Mixamo-Animations-Characters+# objaverse https://huggingface.co/datasets/Linzhan/Objaverse-XL-Rigged-Animated+# objaverse_renders https://huggingface.co/datasets/Linzhan/Objaverse-XL-Rigged-Animated-Renders+# truebones https://huggingface.co/datasets/Linzhan/Truebones-ZOO-Annotations+#+# `objaverse_renders` is a download-only companion repo (four-view clip MP4s and+# per-asset T-pose grids, ~6 GB). It is not a pipeline dataset name — the render+# stages write into it through the dataset/render/ symlinks.## The truebones repo carries annotations only (prompts, per-clip metadata,# T-pose renders, build scripts) — the Truebones ZOO animal pack itself is a@@ -31,6 +37,16 @@ source "$(dirname "${BASH_SOURCE[0]}")/_common.sh"handle_help "$@"DATASET=${1:-}[[ -n "$DATASET" ]] || { print_usage; exit 0; }+# Download-only companion repo: not a pipeline dataset name, so it skips+# require_dataset (no stage takes "objaverse_renders" as its dataset argument).+if [[ "$DATASET" == "objaverse_renders" ]]; then+ shift+ REPO=Linzhan/Objaverse-XL-Rigged-Animated-Renders+ RAW_DIR=${RAW_DIR:-dataset/raw/objaverse_renders}+ echo "Downloading $REPO -> $RAW_DIR"+ exec hf download "$REPO" --type dataset --local-dir "$RAW_DIR" "$@"+fi+require_dataset "$DATASET"shiftdiff --git a/data_process/utils/vlm.py b/data_process/utils/vlm.pyindex ad2cfb2..a596af0 100644--- a/data_process/utils/vlm.py+++ b/data_process/utils/vlm.py@@ -501,7 +501,8 @@ def load_qwen_model(Args:model_name: HuggingFace model ID or local path- (e.g., "Qwen/Qwen3-VL-8B-Instruct").+ (e.g., "Qwen/Qwen3-VL-8B-Instruct", or "Qwen/Qwen3.5-9B" —+ the qwen3_5 architecture needs transformers>=5).device_map: Device placement strategy (default "auto").torch_dtype: Override dtype ("float16", "bfloat16", or None for auto).min_pixels: Minimum pixels per image (default 200704 = 256*28*28).@@ -589,6 +590,10 @@ def qwen_generate(model, processor, messages, max_tokens=300,Decoded output string (stripped), or ``(text, num_new_tokens)`` when``return_num_tokens`` is set."""+ # Qwen3.5 hybrid models think by default; enable_thinking=False makes the+ # template render a closed empty <think> block so the model answers+ # directly. Qwen3-VL templates don't reference the flag, so it is inert+ # there.if videos is None:inputs = processor.apply_chat_template(messages,@@ -596,18 +601,32 @@ def qwen_generate(model, processor, messages, max_tokens=300,add_generation_prompt=True,return_dict=True,return_tensors="pt",+ enable_thinking=False,)else:text = processor.apply_chat_template(- messages, tokenize=False, add_generation_prompt=True)- video_kwargs = {"fps": video_fps} if video_fps else {}- try:- inputs = processor(text=[text], videos=videos,- return_tensors="pt", **video_kwargs)- except TypeError:- # Older processors without an fps kwarg.- inputs = processor(text=[text], videos=videos,- return_tensors="pt")+ messages, tokenize=False, add_generation_prompt=True,+ enable_thinking=False)+ # Pin the total-pixel-budget resize semantics: transformers v5.22+ # flips the default to qwen-vl-utils-style per-frame capping, which+ # would silently change video token counts.+ video_kwargs = {"cap_pixels_per_frame": False}+ if video_fps:+ # Frames are pre-sampled, so sampling must stay off and the true+ # frame rate rides in as metadata — the processor derives the+ # prompt timestamps from metadata.fps. A bare ``fps=`` kwarg+ # instead requests re-sampling against an assumed 24 fps source+ # (duplicating/dropping frames and skewing timestamps).+ from transformers.video_utils import VideoMetadata+ video_kwargs["do_sample_frames"] = False+ video_kwargs["video_metadata"] = [+ VideoMetadata(total_num_frames=len(v), fps=f,+ duration=len(v) / f,+ frames_indices=list(range(len(v))))+ for v, f in zip(videos, video_fps)+ ]+ inputs = processor(text=[text], videos=videos,+ return_tensors="pt", **video_kwargs)inputs.pop("token_type_ids", None)logger.debug("Qwen prompt tokens: {}".format(inputs["input_ids"].shape[-1]))inputs = inputs.to(model.device)@@ -630,6 +649,11 @@ def qwen_generate(model, processor, messages, max_tokens=300,generated_ids_trimmed, skip_special_tokens=True,clean_up_tokenization_spaces=False,)[0].strip()+ # A thinking model may still emit a <think> block despite the template+ # flag; keep only the answer after it. An unclosed block means the budget+ # was spent thinking — the leftover text trips the rejection checks.+ if "</think>" in text:+ text = text.split("</think>")[-1].strip()if return_num_tokens:return text, len(generated_ids_trimmed[0])return text@@ -645,7 +669,7 @@ def add_qwen_model_args(parser):default='Qwen/Qwen3-VL-8B-Instruct',help='HuggingFace model ID or local path ''(e.g., Qwen/Qwen3-VL-8B-Instruct, '- 'Qwen/Qwen3-VL-72B-Instruct).')+ 'Qwen/Qwen3-VL-72B-Instruct, Qwen/Qwen3.5-9B).')parser.add_argument('--torch_dtype', type=str, default=None,choices=['float16', 'bfloat16'],help='Override model dtype (default: bfloat16).')diff --git a/data_process/vlm_caption/backends.py b/data_process/vlm_caption/backends.pyindex 65a85a4..a51e834 100644--- a/data_process/vlm_caption/backends.py+++ b/data_process/vlm_caption/backends.py@@ -4,8 +4,8 @@ One captioning request is the same everywhere — a system prompt plus aninterleaved [view header, frame label, image, ...] user turn — but eachbackend speaks a different dialect. This module owns those dialects:- qwen — local Qwen3-VL via HuggingFace transformers; PIL images- inline, OOM-aware retries that halve the frame count.+ qwen — local Qwen3-VL / Qwen3.5 via HuggingFace transformers; PIL+ images inline, OOM-aware retries that halve the frame count.openai — OpenAI-compatible chat API; base64 ``data:`` image URLs,GPT-5 vs GPT-4o parameter differences handled here.gemini — Google Gemini API; raw image bytes as Parts, thinking and@@ -200,7 +200,7 @@ def generate_qwen(multiview_frames, motion_name, system_prompt,model, processor, max_tokens, max_retries=MAX_RETRIES,hint=None, video_fps=None):# type: (Dict[str, List], str, str, object, object, int, int, Optional[str], Optional[Dict[str, float]]) -> str- """Generate caption using local Qwen3-VL model.+ """Generate caption using a local Qwen3-VL / Qwen3.5 model.``multiview_frames`` carries base64 PNG/JPEG strings in image mode, orPIL frame lists when ``video_fps`` is given — the latter selects thediff --git a/data_process/vlm_caption/caption_motion.py b/data_process/vlm_caption/caption_motion.pyindex 911df7f..51e7ea7 100644--- a/data_process/vlm_caption/caption_motion.py+++ b/data_process/vlm_caption/caption_motion.py@@ -1,7 +1,7 @@"""Caption multi-view rendered motion sequences with a Vision-Language Model.Supports three backends (see :mod:`data_process.vlm_caption.backends`):- qwen — Local Qwen3-VL via HuggingFace transformers (default).+ qwen — Local Qwen3-VL / Qwen3.5 via HuggingFace transformers (default).openai — OpenAI-compatible API (GPT-4o, GPT-5, ...).gemini — Google Gemini API.@@ -411,7 +411,8 @@ def parse_args():parser.add_argument('--model', type=str,default='Qwen/Qwen3-VL-8B-Instruct',help='Model name. For qwen: HuggingFace model ID '- '(default Qwen/Qwen3-VL-8B-Instruct). For openai: '+ '(default Qwen/Qwen3-VL-8B-Instruct; also e.g. '+ 'Qwen/Qwen3.5-9B). For openai: ''API model (e.g., gpt-5-mini). For gemini: API model ''(e.g., gemini-3-flash-preview).')diff --git a/requirements.txt b/requirements.txtindex f08c08e..1da48db 100644--- a/requirements.txt+++ b/requirements.txt@@ -29,11 +29,11 @@ torchvision==0.20.1+cu124torch-geometric==2.7.0 # GCN graph embedding (use_graph_emb)torchdiffeq==0.2.5 # ODE/SDE integrators for flow matchingeinops==0.8.2-accelerate==0.30.1 # multi-GPU + mixed-precision training+accelerate==1.14.0 # multi-GPU + mixed-precision training; transformers 5.x needs >=1.1tensorboard==2.20.0 # training logs (SummaryWriter)# ── Text conditioning (T5 / CLIP / BERT) & VLM captioning ────────────────────-transformers==4.57.6 # T5/BERT text encoders; >=4.57 required by the local Qwen3-VL captioner+transformers==5.16.1 # T5/BERT text encoders; local Qwen3-VL captioner needs >=4.57, Qwen3.5 (qwen3_5 arch) needs 5.xsentencepiece==0.2.1 # T5 tokenizer backendclip @ git+https://github.com/openai/CLIP.git # CLIP text encoderspacy # T5 conditioner text normalization