How to use from the
Use from the
Diffusers library
pip install -U diffusers transformers accelerate
import torch
from diffusers import DiffusionPipeline

# switch to "mps" for apple devices
pipe = DiffusionPipeline.from_pretrained("OzzyGT/gemx_soma_diffusers", dtype=torch.bfloat16, device_map="cuda")

prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
image = pipe(prompt).images[0]

GEM-X SOMA Diffusers

Left: the camera-space skeleton and 2D keypoints. Right: the world motion. The clip is AI-generated, the first frame with MiniMax-H3-Image and the video with MiniMax-H3.

A Diffusers conversion of the native77 body model of nvidia/GEM-X, which reconstructs the 3D motion of one person in a video. This repository holds the weights, configs and model code: the RT-DETR person detector, GEM-X's keypoint model, pose encoder and motion transformer, and Kimodo's neutral SOMA77 skeleton.

For model details, see the original model card and the GEM-X repository.

Usage

Install PyTorch for your GPU, then:

pip install "diffusers>=0.41.0" "transformers>=5.3.0" "torchvision>=0.25" "opencv-python-headless>=4.10" "scipy>=1.11" imageio imageio-ffmpeg

The model runs with the GEM-X SOMA Modular Diffusers blocks.

Note: trust_remote_code=True runs the code of the blocks repository and trust_components_code=True the model code in this one, both downloaded from the Hub. Only use them with repositories you trust.

import numpy as np
import torch
from diffusers import ModularPipelineBlocks
from diffusers.utils import load_video


blocks = ModularPipelineBlocks.from_pretrained(
    "OzzyGT/gemx_soma_custom_blocks",
    trust_remote_code=True,
    components_repo="OzzyGT/gemx_soma_diffusers",
    trust_components_code=True,
)
pipe = blocks.init_pipeline()
pipe.load_components(dtype=torch.float32)
pipe.to("cuda")

video = load_video("clip_30fps.mp4")
motion = pipe(video=video, output="motion")
np.savez_compressed("motion.npz", **{key: value.cpu().numpy() for key, value in motion.items()})

The clip must be at 30 FPS. The result is a SOMA77 motion in meters, +Y up, with Kimodo's joint order and rotation convention; the blocks can also return the SOMA body parameters. The feet are locked in place while they touch the floor; pass foot_lock=False for GEM-X's raw prediction. Use float32, which matches GEM-X. See the blocks for the inputs and outputs.

Licenses

Downloads last month
12
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for OzzyGT/gemx_soma_diffusers

Finetuned
(12)
this model