반응형
Sora, Veo, Kling은 전부 클라우드입니다. 프롬프트가 서버로 나가고, 생성된 영상은 학습 데이터가 됩니다. Wan2.2는 로컬에서 돌아가는 Alibaba 오픈소스 영상 생성 모델입니다. Wan-Bench 2.0 기준 상업 모델 대부분을 앞서면서 코드와 가중치가 전부 공개입니다.
[핵심 요약]
→ Wan2.2-T2V-A14B: Alibaba가 만든 오픈소스 텍스트→영상 모델 (2025년 7월 28일 공개)
→ 아키텍처: MoE (Mixture-of-Experts) — 총 27B 파라미터, 실행 시 14B만 활성화
→ 출력: 5초 영상, 480P / 720P 해상도, 24 FPS
→ 라이선스: Apache 2.0 — 상업 이용 가능
→ 가중치 크기: ~70GB (T2V-A14B)
→ VRAM 요구사항: 80GB+ (720P 기본) / 40~48GB (480P + FP8 양자화 + offload)
→ 소비자 GPU: RTX 4090 24GB 단독으로는 어렵고 --offload_model + --convert_model_dtype 조합 필요
→ 실행 방법: 공식 generate.py / Diffusers / ComfyUI 세 가지
→ 다중 GPU: torchrun으로 FSDP 병렬 처리 (8×H100 권장)
Wan2.2 모델 라인업 — 뭘 받아야 하나
[Wan2.2 전체 모델]
T2V-A14B (이 글의 주인공):
→ 텍스트 → 영상
→ 480P / 720P
→ ~70GB 가중치
→ HuggingFace: Wan-AI/Wan2.2-T2V-A14B
I2V-A14B:
→ 이미지 + 텍스트 → 영상 (정지 이미지 살리기)
→ 480P / 720P
→ HuggingFace: Wan-AI/Wan2.2-I2V-A14B
TI2V-5B:
→ 텍스트 + 이미지 → 영상 (더 작은 모델)
→ 720P, 24 FPS
→ 5B 파라미터 → VRAM 부담 낮음
→ HuggingFace: Wan-AI/Wan2.2-TI2V-5B
[Wan2.2 vs Wan2.1]
Wan2.1: 단일 14B Dense 모델
Wan2.2: MoE — 총 27B, 활성 14B (추론 비용은 동일, 품질 향상)
→ Wan2.2-A14B가 Wan2.1-14B보다 영상 품질 전반적으로 우세
→ VRAM 요구사항은 동일
실전 1 — 환경 설정
시스템 요구사항
[VRAM 현실적 요구사항]
이상적 (720P 풀 품질):
→ A100 80GB, H100 80GB 단일 GPU
→ 또는 RTX 3090 24GB × 3개 이상 (다중 GPU)
소비자 GPU (480P + 최적화):
→ RTX 3090 / RTX 4090 (24GB): --offload_model + --convert_model_dtype 필수
→ 생성 시간: 480P 5초 영상 기준 약 15~30분 (RTX 4090)
→ 720P: RTX 4090 단독으로는 사실상 어려움
클라우드 (권장):
→ RunPod, Vast.ai: A100 80GB 인스턴스
→ 480P 기준 약 4분 / H100 PCIe
다중 GPU (고속):
→ 8×H100: torchrun FSDP — 최고 품질·속도
# Python 환경 (3.10+ 권장)
conda create -n wan2 python=3.10
conda activate wan2
# PyTorch 2.4.0+ 필수
pip install torch==2.4.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
# 의존성 설치 (flash-attn은 마지막에)
pip install transformers accelerate diffusers
pip install imageio imageio-ffmpeg
pip install "huggingface_hub[cli]"
# flash-attn (설치 실패 시 나머지 먼저 설치 후 재시도)
pip install flash-attn --no-build-isolation
# 또는 flash-attn 없이 실행 (성능 약간 저하)
실전 2 — 모델 다운로드
# 방법 1: huggingface-cli (공식 권장)
pip install "huggingface_hub[cli]"
huggingface-cli download Wan-AI/Wan2.2-T2V-A14B \
--local-dir ./Wan2.2-T2V-A14B
# 약 70GB 다운로드 — 시간 여유 필요
# 다운로드 중단 후 재시작 가능 (resume 지원)
# 방법 2: Python으로 다운로드
from huggingface_hub import snapshot_download
snapshot_download(
repo_id="Wan-AI/Wan2.2-T2V-A14B",
local_dir="./Wan2.2-T2V-A14B",
resume_download=True, # 재시작 지원
)
# 다운로드 후 디렉토리 구조 확인
# ./Wan2.2-T2V-A14B/
# ├── models/
# │ ├── vae/ (VAE 인코더/디코더)
# │ ├── transformer/ (MoE DiT 모델)
# │ └── text_encoder/ (T5 텍스트 인코더)
# ├── config.json
# └── generate.py
실전 3 — 공식 generate.py로 영상 생성
480P 기본 실행 (소비자 GPU)
# 공식 GitHub 코드 클론
git clone https://github.com/Wan-Video/Wan2.2.git
cd Wan2.2
pip install -r requirements.txt
# ── 480P 생성 (소비자 GPU 최적화) ─────────────────────
python generate.py \
--task t2v-A14B \
--size 832*480 \
--ckpt_dir ./Wan2.2-T2V-A14B \
--offload_model True \ # GPU VRAM 절약: 모델을 CPU로 오프로드
--convert_model_dtype \ # FP8 양자화: VRAM 추가 절약
--prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage."
# ── 720P 생성 (고VRAM GPU) ────────────────────────────
python generate.py \
--task t2v-A14B \
--size 1280*720 \
--ckpt_dir ./Wan2.2-T2V-A14B \
--offload_model True \
--convert_model_dtype \
--prompt "A serene mountain lake at golden hour, mist rising from the water, pine trees reflected in the mirror-like surface."
# 주요 파라미터 설명
# --task: t2v-A14B (텍스트→영상, A14B 모델)
# --size: 832*480 (480P) / 1280*720 (720P)
# --ckpt_dir: 다운로드한 모델 경로
# --offload_model True: RAM으로 일부 오프로드 (VRAM 절약, 속도 저하)
# --convert_model_dtype: FP8로 양자화 (VRAM 추가 절약, 품질 약간 저하)
# --t5_cpu: T5 텍스트 인코더를 CPU에서 실행 (추가 VRAM 절약)
# --sample_steps: 디노이징 스텝 수 (기본 50, 낮추면 빠르지만 품질 저하)
# --sample_guide_scale: CFG 스케일 (기본 7.5)
# 소비자 RTX 4090 (24GB) 최대 절약 모드:
python generate.py \
--task t2v-A14B \
--size 832*480 \
--ckpt_dir ./Wan2.2-T2V-A14B \
--offload_model True \
--convert_model_dtype \
--t5_cpu \
--prompt "Your prompt here"
프롬프트 확장 (더 좋은 품질)
# --use_prompt_extend: LLM으로 프롬프트 자동 확장
# Qwen2.5-7B-Instruct가 짧은 프롬프트를 풍부하게 재작성
# 영상 품질 향상 — GPU 메모리 추가 필요
# 로컬 Qwen 모델로 프롬프트 확장
python generate.py \
--task t2v-A14B \
--size 832*480 \
--ckpt_dir ./Wan2.2-T2V-A14B \
--offload_model True \
--convert_model_dtype \
--use_prompt_extend \
--prompt_extend_method local_qwen \
--prompt_extend_model Qwen/Qwen2.5-7B-Instruct \
--prompt "A cat jumping over a fence"
# → "A cat jumping over a fence" 가
# → "A sleek tabby cat gracefully leaps over a weathered wooden picket fence
# in a sun-dappled garden, its fur rippling in the warm afternoon breeze..."
# 로 자동 확장 후 영상 생성
실전 4 — Diffusers로 Python 코드 통합
Diffusers 통합은 Python 코드에서 직접 호출할 때 가장 유연합니다.
# pip install diffusers transformers accelerate torch
import torch
from diffusers import AutoencoderKLWan, WanPipeline
from diffusers.utils import export_to_video
# ── 파이프라인 초기화 ──────────────────────────────────
# 메모리 최적화 설정
dtype = torch.bfloat16 # 또는 torch.float16
# VAE는 float32로 (품질 유지)
vae = AutoencoderKLWan.from_pretrained(
"Wan-AI/Wan2.2-T2V-A14B-Diffusers",
subfolder="vae",
torch_dtype=torch.float32
)
# 메인 파이프라인
pipe = WanPipeline.from_pretrained(
"Wan-AI/Wan2.2-T2V-A14B-Diffusers",
vae=vae,
torch_dtype=dtype,
)
# ── VRAM 절약 설정 ────────────────────────────────────
# 소비자 GPU에서 필수
pipe.enable_model_cpu_offload() # 모델 레이어를 CPU로 오프로드
# 또는
# pipe.enable_sequential_cpu_offload() # 더 적극적인 오프로드 (더 느림)
# xformers 메모리 최적화 (설치된 경우)
# pipe.enable_xformers_memory_efficient_attention()
# ── 영상 생성 ─────────────────────────────────────────
prompt = """
A majestic eagle soars over snow-capped mountain peaks at sunrise.
The camera slowly pans upward as golden light breaks through clouds,
casting dramatic shadows across the rugged terrain below.
"""
negative_prompt = "Bright tones, overexposed, static, blurred details, subtitles, style, works, paintings, images, static, overall light"
output = pipe(
prompt=prompt,
negative_prompt=negative_prompt,
height=480,
width=832,
num_frames=81, # 5초 × 24FPS = 121프레임 (실제는 81 사용)
guidance_scale=7.5, # CFG 스케일
num_inference_steps=50, # 디노이징 스텝 (낮추면 빠름, 품질 저하)
generator=torch.Generator().manual_seed(42), # 재현성
)
# 영상 저장
export_to_video(output.frames[0], "output.mp4", fps=16)
print("영상 저장 완료: output.mp4")
# ── 고급 설정: FlowMatchEuler 스케줄러 ────────────────
from diffusers import FlowMatchEulerDiscreteScheduler
# 더 적은 스텝으로 비슷한 품질
pipe.scheduler = FlowMatchEulerDiscreteScheduler.from_config(
pipe.scheduler.config
)
# 20 스텝으로도 괜찮은 품질 (기본 50 대비 2.5배 빠름)
output = pipe(
prompt=prompt,
height=480,
width=832,
num_frames=81,
guidance_scale=7.5,
num_inference_steps=20, # 스텝 감소
)
export_to_video(output.frames[0], "output_fast.mp4", fps=16)
# ── 배치 생성 (여러 프롬프트 한 번에) ─────────────────
prompts = [
"A serene Japanese garden with koi fish swimming in a pond",
"Futuristic city skyline at night with flying vehicles",
"Close-up of dewdrops on a spider web at dawn",
]
for i, prompt in enumerate(prompts):
output = pipe(
prompt=prompt,
height=480,
width=832,
num_frames=81,
guidance_scale=7.5,
num_inference_steps=30,
)
export_to_video(output.frames[0], f"output_{i}.mp4", fps=16)
print(f"✅ {i+1}/{len(prompts)} 완료")
torch.cuda.empty_cache() # VRAM 정리
실전 5 — ComfyUI로 노코드 인터페이스
# ComfyUI 설치
git clone https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI
pip install -r requirements.txt
# WanVideo ComfyUI 커스텀 노드 설치
cd custom_nodes
git clone https://github.com/kijai/ComfyUI-WanVideoWrapper.git
cd ComfyUI-WanVideoWrapper
pip install -r requirements.txt
# 모델 가중치를 ComfyUI models 폴더로 이동
# ComfyUI/models/wan/ 폴더 생성 후 다운로드한 모델 복사
mkdir -p ../../../models/wan
# 또는 심볼릭 링크
ln -s /path/to/Wan2.2-T2V-A14B ../../../models/wan/Wan2.2-T2V-A14B
# ComfyUI 실행
cd ../../..
python main.py --listen 0.0.0.0 --port 8188
[ComfyUI 워크플로우 설정]
브라우저에서 http://localhost:8188 접속
노드 구성:
1. Load WanVideo Model → Wan2.2-T2V-A14B 선택
2. CLIP Text Encode (Positive) → 프롬프트 입력
3. CLIP Text Encode (Negative) → 네거티브 프롬프트
4. WanVideo Sampler
→ Steps: 20~50
→ CFG: 7.0~7.5
→ Seed: 랜덤 또는 고정
5. WanVideo Decode
6. Video Combine → 출력 파일명 설정
Queue Prompt → 생성 시작
워크플로우 다운로드:
→ comfyworkflows.com 에서 "Wan2.2" 검색
→ WanVideoWrapper GitHub의 example_workflows/ 폴더
실전 6 — 다중 GPU 서빙 (고성능 환경)
# 8×GPU FSDP 병렬 처리 (A100/H100 서버)
torchrun \
--nproc_per_node=8 \
generate.py \
--task t2v-A14B \
--size 1280*720 \
--ckpt_dir ./Wan2.2-T2V-A14B \
--dit_fsdp \ # DiT 모델 FSDP 분산
--t5_fsdp \ # T5 텍스트 인코더 FSDP 분산
--ulysses_size 8 \ # Ulysses 시퀀스 병렬화
--prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." \
--use_prompt_extend \
--prompt_extend_method local_qwen \
--prompt_extend_model Qwen/Qwen2.5-7B-Instruct
# 4×GPU 구성
torchrun \
--nproc_per_node=4 \
generate.py \
--task t2v-A14B \
--size 1280*720 \
--ckpt_dir ./Wan2.2-T2V-A14B \
--dit_fsdp \
--t5_fsdp \
--ulysses_size 4 \
--prompt "Your prompt"
좋은 프롬프트 작성법
[Wan2.2 프롬프트 패턴]
구조:
[주체] + [액션/상황] + [카메라/앵글] + [분위기/조명] + [세부 묘사]
효과적인 프롬프트 예시:
"A lone astronaut walks slowly across the surface of Mars,
red dust swirling around their boots.
Wide establishing shot, dramatic backlighting from a low sun,
cinematic, highly detailed spacesuit."
"Cherry blossoms falling in slow motion over a traditional Japanese street.
Soft bokeh background, warm golden hour lighting,
petals catching the light as they drift past paper lanterns."
"A wolf running through a dense snowy forest at dusk.
Camera tracks alongside at ground level,
breath visible in the cold air, moonlight filtering through pine trees."
[네거티브 프롬프트 — 공식 권장]
"Bright tones, overexposed, static, blurred details, subtitles,
style, works, paintings, images, static, overall light"
[팁]
→ 영어 프롬프트가 한국어보다 훨씬 품질 좋음
→ 카메라 움직임 명시: "slow pan", "tracking shot", "zoom in" 등
→ 조명 조건 명시: "golden hour", "dramatic backlighting", "soft diffused light"
→ 품질 키워드: "cinematic", "highly detailed", "photorealistic", "8K"
→ 5초 분량에 너무 많은 이벤트 넣지 말 것 — 단순하고 명확하게
GPU별 실전 세팅 요약
[환경별 권장 세팅]
RTX 4090 24GB (단독):
→ 해상도: 480P만 현실적
→ 필수 플래그: --offload_model True --convert_model_dtype --t5_cpu
→ 생성 시간: 480P 약 20~30분
→ 720P: 거의 불가 (OOM)
A100 40GB:
→ 480P: --offload_model True 없이도 가능
→ 720P: --offload_model True + --convert_model_dtype
→ 생성 시간: 480P 약 5분
A100 80GB / H100:
→ 480P: 플래그 없이 풀 품질
→ 720P: --offload_model True 정도면 충분
→ 생성 시간: 480P 약 3~4분, 720P 약 8분
H100 × 8 (FSDP):
→ 720P 풀 품질
→ 생성 시간: 약 1~2분
마무리
✅ Wan2.2-T2V-A14B가 좋은 경우
→ 상업 이용 가능한 오픈소스 필요 (Apache 2.0)
→ 프롬프트 외부 전송 없는 완전 로컬 생성 필요
→ Sora·Veo 수준 품질을 자체 서버에서 구현하고 싶을 때
→ 마케팅 영상, 개념 시각화, 콘텐츠 제작 자동화 파이프라인
→ 배치로 대량 영상 생성 (토큰 비용 없음)
❌ 주의사항
→ 소비자 GPU: 24GB 단일로는 480P만 가능, 시간도 오래 걸림
→ 저장 공간: 모델 가중치만 ~70GB + 생성 영상 + 임시 파일
→ 생성 길이: 5초 고정 (더 긴 영상은 클립 연결 필요)
→ 프롬프트: 영어 권장, 한국어 프롬프트 품질 저조
→ 실시간 생성: 불가 — 배치 처리 워크플로우에 적합
반응형