|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import argparse |
|
from pathlib import Path |
|
|
|
from huggingface_hub import snapshot_download |
|
|
|
from .convert_pixtral_ckpt import convert_pixtral_checkpoint |
|
|
|
|
|
def main(model_types, model_sizes, checkpoint_dir="checkpoints"): |
|
ORG_NAME = "nvidia" |
|
|
|
|
|
model_map = { |
|
"7B": "Cosmos-1.0-Diffusion-7B", |
|
"14B": "Cosmos-1.0-Diffusion-14B", |
|
} |
|
|
|
|
|
extra_models = [ |
|
"Cosmos-1.0-Guardrail", |
|
"Cosmos-1.0-Tokenizer-CV8x8x8", |
|
] |
|
|
|
if "Text2World" in model_types: |
|
extra_models.append("Cosmos-1.0-Prompt-Upsampler-12B-Text2World") |
|
|
|
|
|
checkpoints_dir = Path(checkpoint_dir) |
|
checkpoints_dir.mkdir(parents=True, exist_ok=True) |
|
|
|
download_kwargs = dict(allow_patterns=["README.md", "model.pt", "config.json", "*.jit"]) |
|
|
|
|
|
for size in model_sizes: |
|
for model_type in model_types: |
|
suffix = f"-{model_type}" |
|
model_name = model_map[size] + suffix |
|
repo_id = f"{ORG_NAME}/{model_name}" |
|
local_dir = checkpoints_dir.joinpath(model_name) |
|
local_dir.mkdir(parents=True, exist_ok=True) |
|
|
|
print(f"Downloading {repo_id} to {local_dir}...") |
|
snapshot_download( |
|
repo_id=repo_id, local_dir=str(local_dir), local_dir_use_symlinks=False, **download_kwargs |
|
) |
|
|
|
|
|
for model_name in extra_models: |
|
repo_id = f"{ORG_NAME}/{model_name}" |
|
local_dir = checkpoints_dir.joinpath(model_name) |
|
local_dir.mkdir(parents=True, exist_ok=True) |
|
|
|
print(f"Downloading {repo_id} to {local_dir}...") |
|
|
|
snapshot_download( |
|
repo_id=repo_id, |
|
local_dir=str(local_dir), |
|
local_dir_use_symlinks=False, |
|
) |
|
|
|
if "Video2World" in model_types: |
|
|
|
convert_pixtral_checkpoint( |
|
checkpoint_dir=checkpoint_dir, |
|
checkpoint_name="Pixtral-12B", |
|
vit_type="pixtral-12b-vit", |
|
) |
|
|
|
|