hy-world-2-0-3d-world-model
Expert skill for using HY-World 2.0, Tencent's multi-modal world model for reconstructing, generating, and simulating 3D worlds from text, images, and video.
What this skill does
# HY-World 2.0 — 3D World Model Skill
> Skill by [ara.so](https://ara.so) — Daily 2026 Skills collection.
HY-World 2.0 is a multi-modal world model by Tencent Hunyuan that reconstructs, generates, and simulates 3D worlds. It accepts text, single-view images, multi-view images, and videos as input and produces 3D representations (meshes, 3D Gaussian Splattings, point clouds). Two core capabilities:
- **World Reconstruction** (multi-view images / video → 3D): Powered by WorldMirror 2.0, a ~1.2B feed-forward model predicting depth, surface normals, camera parameters, 3D point clouds, and 3DGS attributes in a single forward pass.
- **World Generation** (text / single image → 3D world): Four-stage pipeline — Panorama Generation (HY-Pano 2.0) → Trajectory Planning (WorldNav) → World Expansion (WorldStereo 2.0) → World Composition (WorldMirror 2.0 + 3DGS).
---
## Installation
### Requirements
- Python 3.10
- CUDA 12.4 (recommended)
- PyTorch 2.4.0
```bash
# 1. Clone repository
git clone https://github.com/Tencent-Hunyuan/HY-World-2.0
cd HY-World-2.0
# 2. Create conda environment
conda create -n hyworld2 python=3.10
conda activate hyworld2
# 3. Install PyTorch with CUDA 12.4
pip install torch==2.4.0 torchvision==0.19.0 --index-url https://download.pytorch.org/whl/cu124
# 4. Install project dependencies
pip install -r requirements.txt
# 5a. Install FlashAttention-3 (recommended for performance)
git clone https://github.com/Dao-AILab/flash-attention.git
cd flash-attention/hopper
python setup.py install
cd ../../
rm -rf flash-attention
# 5b. OR install FlashAttention-2 (simpler)
pip install flash-attn --no-build-isolation
```
### Model Weights
Model weights are **automatically downloaded from Hugging Face** on first run. Alternatively, download manually:
| Model | HuggingFace |
|---|---|
| WorldMirror 2.0 | `tencent/HY-World-2.0` → `HY-WorldMirror-2.0` |
| WorldMirror 1.0 (legacy) | `tencent/HunyuanWorld-Mirror` |
To pre-download:
```bash
# Set HuggingFace cache directory if needed
export HF_HOME=/path/to/cache
pip install huggingface_hub
python -c "from huggingface_hub import snapshot_download; snapshot_download('tencent/HY-World-2.0')"
```
---
## Core API — WorldMirror 2.0 (World Reconstruction)
### Basic Usage
```python
from hyworld2.worldrecon.pipeline import WorldMirrorPipeline
# Load pipeline — weights auto-downloaded on first run
pipeline = WorldMirrorPipeline.from_pretrained('tencent/HY-World-2.0')
# Run reconstruction from a folder of images
result = pipeline('path/to/images')
```
### With Prior Injection (Camera & Depth)
Provide known camera parameters or depth priors to improve accuracy:
```python
from hyworld2.worldrecon.pipeline import WorldMirrorPipeline
pipeline = WorldMirrorPipeline.from_pretrained('tencent/HY-World-2.0')
result = pipeline(
'path/to/images',
prior_cam_path='path/to/prior_camera.json',
prior_depth_path='path/to/prior_depth.npy', # optional
)
```
### Camera JSON Format
The `prior_camera.json` format expected by the pipeline:
```json
[
{
"image": "frame_001.jpg",
"fx": 800.0,
"fy": 800.0,
"cx": 640.0,
"cy": 360.0,
"width": 1280,
"height": 720,
"c2w": [
[1.0, 0.0, 0.0, 0.0],
[0.0, 1.0, 0.0, 0.0],
[0.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 1.0]
]
}
]
```
### Result Object
The pipeline returns a result object with the following attributes:
```python
result = pipeline('path/to/images')
# Access outputs
point_cloud = result.point_cloud # 3D point cloud (numpy or torch)
depth_maps = result.depth_maps # Per-image depth maps
normals = result.normals # Surface normal maps
cameras = result.cameras # Predicted camera parameters
gaussians = result.gaussians # 3DGS attributes
# Save outputs
result.save('output_dir/') # Saves all outputs to directory
```
---
## Gradio App — WorldMirror 2.0
Launch an interactive web UI for 3D reconstruction:
```bash
# From project root
python -m hyworld2.worldrecon.app
# Or if a dedicated script exists
python app.py --model tencent/HY-World-2.0
```
Access at `http://localhost:7860` by default.
---
## Common Patterns
### Pattern 1: Reconstruct from a Video
Extract frames from a video, then run reconstruction:
```python
import cv2
import os
from hyworld2.worldrecon.pipeline import WorldMirrorPipeline
def extract_frames(video_path, output_dir, fps=2):
os.makedirs(output_dir, exist_ok=True)
cap = cv2.VideoCapture(video_path)
video_fps = cap.get(cv2.CAP_PROP_FPS)
frame_interval = int(video_fps / fps)
frame_idx = 0
saved = 0
while cap.isOpened():
ret, frame = cap.read()
if not ret:
break
if frame_idx % frame_interval == 0:
cv2.imwrite(f"{output_dir}/frame_{saved:04d}.jpg", frame)
saved += 1
frame_idx += 1
cap.release()
return output_dir
# Extract frames at 2 fps
frames_dir = extract_frames("scene.mp4", "frames/", fps=2)
# Run reconstruction
pipeline = WorldMirrorPipeline.from_pretrained('tencent/HY-World-2.0')
result = pipeline(frames_dir)
result.save("output_3d/")
```
### Pattern 2: Flexible Resolution Inference
WorldMirror 2.0 supports 50K–500K pixel resolution. Control via resize parameters:
```python
from hyworld2.worldrecon.pipeline import WorldMirrorPipeline
pipeline = WorldMirrorPipeline.from_pretrained('tencent/HY-World-2.0')
# Low resolution (fast, lower memory)
result_fast = pipeline(
'path/to/images',
resolution=512, # resize shorter edge to 512
)
# High resolution (slower, more detail)
result_hq = pipeline(
'path/to/images',
resolution=1024,
)
```
### Pattern 3: Batch Processing Multiple Scenes
```python
import os
from pathlib import Path
from hyworld2.worldrecon.pipeline import WorldMirrorPipeline
pipeline = WorldMirrorPipeline.from_pretrained('tencent/HY-World-2.0')
scenes_root = Path("scenes/")
output_root = Path("outputs/")
for scene_dir in sorted(scenes_root.iterdir()):
if not scene_dir.is_dir():
continue
out_dir = output_root / scene_dir.name
out_dir.mkdir(parents=True, exist_ok=True)
print(f"Processing: {scene_dir.name}")
try:
result = pipeline(str(scene_dir))
result.save(str(out_dir))
print(f" Saved to {out_dir}")
except Exception as e:
print(f" Failed: {e}")
```
### Pattern 4: Export to Common 3D Formats
After reconstruction, export to formats compatible with Blender / Unity / Unreal:
```python
from hyworld2.worldrecon.pipeline import WorldMirrorPipeline
pipeline = WorldMirrorPipeline.from_pretrained('tencent/HY-World-2.0')
result = pipeline('path/to/images')
# Save 3DGS (.ply format for tools like 3D Gaussian Splatting viewer)
result.save_gaussians("scene.ply")
# Save mesh (if mesh export is supported)
result.save_mesh("scene.obj") # or scene.glb
# Save point cloud
result.save_pointcloud("scene_pointcloud.ply")
```
### Pattern 5: GPU Memory Management
For large scenes or limited VRAM:
```python
import torch
from hyworld2.worldrecon.pipeline import WorldMirrorPipeline
# Load in fp16 to reduce memory
pipeline = WorldMirrorPipeline.from_pretrained(
'tencent/HY-World-2.0',
torch_dtype=torch.float16,
)
pipeline = pipeline.to('cuda')
# Run with lower resolution to fit in memory
result = pipeline('path/to/images', resolution=768)
# Free memory after use
del result
torch.cuda.empty_cache()
```
---
## Project Structure
```
HY-World-2.0/
├── hyworld2/
│ ├── worldrecon/ # WorldMirror 2.0 reconstruction
│ │ ├── pipeline.py # Main WorldMirrorPipeline class
│ │ ├── app.py # Gradio web app
│ │ └── ...
│ ├── worldgen/ # World generation (coming soon)
│ │ ├── panorama/ # HY-Pano 2.0
│ │ ├── nav/ # WorldNav trajectory planning
│ │ └── stereo/ # WorldStereo 2.0
│ └── utils/
├── assets/ # Demo Related in Image & Video
watch
IncludedWatch a video (URL or local path). Downloads with yt-dlp, extracts auto-scaled frames with ffmpeg, pulls the transcript from captions (or Whisper API fallback), and hands the result to Claude so it can answer questions about what's in the video.
physical-ai-defect-image-generation
IncludedUse when the user wants to orchestrate defect image generation, run associated setup, or handle outputs on OSMO. The Day 0 path handles cold-start with USD-to-ROI, image-edit augmentation, and AnomalyGen to create initial PCBA datasets. The Day 1 path performs inference and labeling on real images. This skill helps with first-time asset setup, creation of finetuning checkpoints, and configuring deployment. Trigger keywords: defect image generation, dig workflow, dig pipeline, defect image detection workflow, aoi pipeline, aoi anomalygen, usd2roi anomalygen, day 0 pcba, day 1 pcba, day 1 real-photo alignment, day 1 manual roi, metal surface anomaly, glass defect, anomalygen finetune, setup_pcb, setup_metal, setup_glass, setup_pretrained, dig setup, dig datasets, dig pretrained checkpoint, dig image-edit endpoint.
accelint-react-best-practices
IncludedReact performance optimization and best practices. ALWAYS use this skill when working with any React code - writing components, hooks, JSX; refactoring; optimizing re-renders, memoization, state management; reviewing for performance; fixing hydration mismatches; debugging infinite re-renders, stale closures, input focus loss, animations restarting; preventing remounting; implementing transitions, lazy initialization, effect dependencies. Even simple React tasks benefit from these patterns. Covers React 19+ (useEffectEvent, Activity, ref props). Triggers - useEffect, useState, useMemo, useCallback, memo, inline components, nested components, components inside components, re-render, performance, hydration, SSR, Next.js, useDeferredValue, combined hooks.
elevenlabs-agents
IncludedBuild conversational AI voice agents with ElevenLabs Platform using React, JavaScript, React Native, or Swift SDKs. Configure agents, tools (client/server/MCP), RAG knowledge bases, multi-voice, and Scribe real-time STT. Use when: building voice chat interfaces, implementing AI phone agents with Twilio, configuring agent workflows or tools, adding RAG knowledge bases, testing with CLI "agents as code", or troubleshooting deprecated @11labs packages, Android audio cutoff, CSP violations, dynamic variables, or WebRTC config. Keywords: ElevenLabs Agents, ElevenLabs voice agents, AI voice agents, conversational AI, @elevenlabs/react, @elevenlabs/client, @elevenlabs/react-native, @elevenlabs/elevenlabs-js, @elevenlabs/agents-cli, elevenlabs SDK, voice AI, TTS, text-to-speech, ASR, speech recognition, turn-taking model, WebRTC voice, WebSocket voice, ElevenLabs conversation, agent system prompt, agent tools, agent knowledge base, RAG voice agents, multi-voice agents, pronunciation dictionary, voice speed control, elevenlabs scribe, @11labs deprecated, Android audio cutoff, CSP violation elevenlabs, dynamic variables elevenlabs, case-sensitive tool names, webhook authentication
humanizer
IncludedHumanize AI-generated text by detecting and removing patterns typical of LLM output. Rewrites text to sound natural, specific, and human. Uses 28 pattern detectors, 560+ AI vocabulary terms across 3 tiers, and statistical analysis (burstiness, type-token ratio, readability) for comprehensive detection. Use when asked to humanize text, de-AI writing, make content sound more natural/human, review writing for AI patterns, score text for AI detection, or improve AI-generated drafts. Covers content, language, style, communication, and filler categories.
generating-mermaid-diagrams
IncludedSalesforce architecture diagrams using Mermaid with ASCII fallback. Use this skill when generating text-based diagrams for Salesforce architecture, OAuth flows, ERDs, integration sequences, or Agentforce structure. TRIGGER when: user says "diagram", "visualize", "ERD", or asks for sequence diagrams, flowcharts, class diagrams, or architecture visualizations in Mermaid. DO NOT TRIGGER when: user wants PNG/SVG image output (use generating-visual-diagrams), or asks about non-Salesforce systems.