Instructions to use OzzyGT/gemx_soma_custom_blocks with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use OzzyGT/gemx_soma_custom_blocks with Diffusers:
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_custom_blocks", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
GEM-X SOMA Modular 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.
Modular Diffusers blocks for nvidia/GEM-X: reconstruct the 3D motion of one person in a video as a SOMA77 motion on Kimodo's neutral skeleton. The converted weights and model code are in OzzyGT/gemx_soma_diffusers.
Requires PyTorch, diffusers>=0.41.0, transformers>=5.3.0, torchvision, opencv-python-headless and scipy. The example also needs imageio and imageio-ffmpeg for load_video.
Licensing
The blocks are Apache-2.0, adapted from NVlabs/GEM-X under Apache-2.0. See NOTICE. This repository contains no model weights; the GEM-X weights use the NVIDIA Open Model License.
Usage
The example uses trust_remote_code=True, which loads these blocks, and trust_components_code=True, which loads the model code in the weights repository.
Note: both flags run Python code downloaded from the Hub. Only use them with repositories you trust, and review their code before passing different ones.
GEM-X works at 30 FPS, so resample the clip first:
ffmpeg -i input.mp4 -vf fps=30 -an -c:v libx264 -crf 18 -pix_fmt yuv420p clip_30fps.mp4
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()})
Use float32; bfloat16 saves memory but changes the motion noticeably.
The input is a list of frames. The tracked person is the largest one in the clip. The blocks assume a fixed camera; for a panning or handheld shot, pass camera_rotations, the (frames, 3, 3) world-to-camera rotations from a camera tracker. intrinsics takes the (3, 3) camera matrix in pixels if you know it.
The output is arrays, not a file. motion holds local_rot_mats, global_rot_mats, posed_joints, root_positions and foot_contacts, at 30 FPS, in meters and +Y up, with the joint order and rotation convention of Kimodo SOMA Modular. Ask for soma_params and soma_params_camera for the SOMA body parameters, including the estimated body shape, in world and camera space.
The feet are locked in place while they touch the floor; pass foot_lock=False for GEM-X's raw prediction. The finger rotations come from the body model, not GEM-X's hand model.
- Downloads last month
- 8
Model tree for OzzyGT/gemx_soma_custom_blocks
Base model
nvidia/GEM-X