Nvidia Cosmos 에서 제공하는 모델인 Text2World, Video2World 테스트

Cosmos

  • Nvidia에서 제공하며, 합성 데이터 생성 기술을 통해 AI 모델의 훈련을 지원하는 플랫폼.
  • Diffusion 모델 기반의 Text2World, Video2World 사전 학습된 모델을 제공함.
  • Git: NVIDIA Cosmos

실행 환경 및 설치

실행 환경

  • CPU: Intel(R) Xeon(R) w5-3423 @ 12cores
  • RAM: 256GB
  • OS: Ubuntu-22.04 LTS
  • GPU: NVIDIA RTX A6000 48G x 2ea
  • CUDA Toolkit: CUDA 11.8, cuDNN 8.9.7

설치

Set Up Docker Environment

  1. NVIDIA Container Toolkit 설치.
  2. 레파지토리 복사
git clone git@github.com:NVIDIA/Cosmos.git
cd Cosmos
  1. Docker 이미지 빌드
docker build -t cosmos .
docker run -d --name cosmos_container --gpus all --ipc=host -it -v $(pwd):/workspace cosmos
docker attach cosmos_container

Download Checkpoints

  • 모든 작업은 생성된 Docker 컨테이너 내에서 실행함.
  1. Hugging Face 엑세스 토큰 생성. 엑세스 토큰을 ‘Read’ 권한으로 설정.
  2. 생성된 토큰으로 Hugginh Face 로그인.
huggingface-cli login
  1. Mistral AI의 Pixtral-12B 모델에 대한 엑세스 요청 및 동의 (Pixtral’s Hugging Face model page). Pixtral-12B 모델은 Video2World 작업의 프롬포트 업샘플링에 사용됨.
  2. Hugging Face로부터 Cosmos 모델 가중치 파일 다운로드.
PYTHONPATH=$(pwd) python cosmos1/scripts/download_diffusion.py --model_sizes 7B 14B --model_types Text2World Video2World
  1. 다운받은 가중치 파일은 아래 구조를 따름.
checkpoints/
├── Cosmos-1.0-Diffusion-7B-Text2World
│   ├── model.pt
│   └── config.json
├── Cosmos-1.0-Diffusion-14B-Text2World
│   ├── model.pt
│   └── config.json
├── Cosmos-1.0-Diffusion-7B-Video2World
│   ├── model.pt
│   └── config.json
├── Cosmos-1.0-Diffusion-14B-Video2World
│   ├── model.pt
│   └── config.json
├── Cosmos-1.0-Tokenizer-CV8x8x8
│   ├── decoder.jit
│   ├── encoder.jit
│   └── mean_std.pt
├── Cosmos-1.0-Prompt-Upsampler-12B-Text2World
│   ├── model.pt
│   └── config.json
├── Pixtral-12B
│   ├── model.pt
│   ├── config.json
└── Cosmos-1.0-Guardrail
    ├── aegis/
    ├── blocklist/
    ├── face_blur_filter/
    └── video_content_safety_filter/

사용방법

Model Types

Diffusion 베이스의 World 생성은 두 가지 타입의 모델을 제공함.

  1. Text2World: 입력 텍스트로부터 World 생성 지원.
  • Models: Cosmos-1.0-Diffusion-7B-Text2World and Cosmos-1.0-Diffusion-14B-Text2World
  • Inference script: text2world.py
  1. Video2World: 입력 이미지/비디오로부터 World 생성 지원.
  • Models: Cosmos-1.0-Diffusion-7B-Video2World and Cosmos-1.0-Diffusion-14B-Video2World
  • Inference script: video2world.py

Text2World

Offloading Strategy7B Text2World14B Text2World
Offload prompt upsampler74.0 GB> 80.0 GB
Offload prompt upsampler & guardrails57.1 GB70.5 GB
Offload prompt upsampler & guardrails & T5 encoder38.5 GB51.9 GB
Offload prompt upsampler & guardrails & T5 encoder & tokenizer38.3 GB51.7 GB
Offload prompt upsampler & guardrails & T5 encoder & tokenizer & diffusion model24.4 GB39.0 GB
  • H100 80G GPU에서 생성에 걸리는 소요시간은 아래와 같음.
7B Text2World (offload prompt upsampler)14B Text2World (offload prompt upsampler, guardrails)
~380 seconds~590 seconds

실행 결과

  • Cosmos-1.0-Diffusion-7B-Text2World 모델을 이용한 테스트 결과.

프롬포트 1

  • (데모) A sleek, humanoid robot stands in a vast warehouse filled with neatly stacked cardboard boxes on industrial shelves. The robot’s metallic body gleams under the bright, even lighting, highlighting its futuristic design and intricate joints. A glowing blue light emanates from its chest, adding a touch of advanced technology. The background is dominated by rows of boxes, suggesting a highly organized storage system. The floor is lined with wooden pallets, enhancing the industrial setting. The camera remains static, capturing the robot’s poised stance amidst the orderly environment, with a shallow depth of field that keeps the focus on the robot while subtly blurring the background for a cinematic effect.

프롬포트2

  • A red tractor is in the middle of a field after the harvest on a clear day. Our scene seems to have been shot from a height of about 3 meters. Around us are several other fields of the same size, all of which have rough soil surfaces and are separated from each other by berms. The fields look like a checkerboard. There are about 5 white bales of silage on the fields, and they are in the shape of cylinders with the same width and height.


Video2World

Offloading Strategy7B Video2World14B Video2World
Offload prompt upsampler76.5 GB> 80.0 GB
Offload prompt upsampler & guardrails59.9 GB73.3 GB
Offload prompt upsampler & guardrails & T5 encoder41.3 GB54.8 GB
Offload prompt upsampler & guardrails & T5 encoder & tokenizer41.1 GB54.5 GB
Offload prompt upsampler & guardrails & T5 encoder & tokenizer & diffusion model27.3 GB39.0 GB
  • H100 80G GPU에서 생성에 걸리는 소요시간은 아래와 같음.
7B Video2World (offload prompt upsampler)14B Video2World (offload prompt upsampler, guardrails)
~383 seconds~593 seconds

실행 결과

  • (데모) 샘플이미지의 테스트 결과