File size: 22,134 Bytes
9b9c41e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
"""
Script to upload JEPA-WMs pretrained model checkpoints to Hugging Face Hub.
This script downloads checkpoints from dl.fbaipublicfiles.com and uploads them
to the Hugging Face Hub repository.
Usage:
# Upload all models to a new HF repository
python scripts/upload_to_huggingface.py --repo-id facebook/jepa-wms
# Upload only JEPA-WM models
python scripts/upload_to_huggingface.py --repo-id facebook/jepa-wms --category jepa_wm
# Upload a specific model
python scripts/upload_to_huggingface.py --repo-id facebook/jepa-wms --model jepa_wm_droid
# Dry run (show what would be uploaded)
python scripts/upload_to_huggingface.py --repo-id facebook/jepa-wms --dry-run
# Update only the README (without re-uploading checkpoints)
python scripts/upload_to_huggingface.py --repo-id facebook/jepa-wms --readme-only
# Upload from local files (instead of downloading from CDN)
python scripts/upload_to_huggingface.py --repo-id facebook/jepa-wms --local
Requirements:
pip install huggingface_hub
"""
import argparse
import os
import tempfile
from pathlib import Path
# Model weight URLs from https://dl.fbaipublicfiles.com/jepa-wms/
MODEL_URLS = {
# JEPA-WM models
"jepa_wm_droid": "https://dl.fbaipublicfiles.com/jepa-wms/droid_jepa-wm_noprop.pth.tar",
"jepa_wm_metaworld": "https://dl.fbaipublicfiles.com/jepa-wms/mw_jepa-wm.pth.tar",
"jepa_wm_pointmaze": "https://dl.fbaipublicfiles.com/jepa-wms/mz_jepa-wm.pth.tar",
"jepa_wm_pusht": "https://dl.fbaipublicfiles.com/jepa-wms/pt_jepa-wm.pth.tar",
"jepa_wm_wall": "https://dl.fbaipublicfiles.com/jepa-wms/wall_jepa-wm.pth.tar",
# DINO-WM baseline models
"dino_wm_droid": "https://dl.fbaipublicfiles.com/jepa-wms/droid_dino-wm_noprop.pth.tar",
"dino_wm_metaworld": "https://dl.fbaipublicfiles.com/jepa-wms/mw_dino-wm.pth.tar",
"dino_wm_pointmaze": "https://dl.fbaipublicfiles.com/jepa-wms/mz_dino-wm.pth.tar",
"dino_wm_pusht": "https://dl.fbaipublicfiles.com/jepa-wms/pt_dino-wm.pth.tar",
"dino_wm_wall": "https://dl.fbaipublicfiles.com/jepa-wms/wall_dino-wm.pth.tar",
# V-JEPA-2-AC baseline models
"vjepa2_ac_droid": "https://dl.fbaipublicfiles.com/jepa-wms/droid_vj2ac_noprop.pth.tar",
"vjepa2_ac_oss": "https://dl.fbaipublicfiles.com/jepa-wms/droid_vj2ac_oss-prop.pth.tar",
}
# Image decoder URLs
IMAGE_DECODER_URLS = {
"dinov2_vits_224": "https://dl.fbaipublicfiles.com/jepa-wms/vm2m_lpips_dv2vits_vitldec_224_05norm.pth.tar",
"dinov2_vits_224_INet": "https://dl.fbaipublicfiles.com/jepa-wms/vm2m_lpips_dv2vits_vitldec_224_INet.pth.tar",
"dinov3_vitl_256_INet": "https://dl.fbaipublicfiles.com/jepa-wms/vm2m_lpips_dv3vitl_256_INet.pth.tar",
"vjepa2_vitg_256_INet": "https://dl.fbaipublicfiles.com/jepa-wms/vm2m_lpips_vj2vitgnorm_vitldec_dup_256_INet.pth.tar",
}
# Model metadata for creating model cards
MODEL_METADATA = {
"jepa_wm_droid": {
"environment": "DROID & RoboCasa",
"resolution": "256Γ256",
"encoder": "DINOv3 ViT-L/16",
"pred_depth": 12,
"description": "JEPA-WM trained on DROID real-robot manipulation dataset",
},
"jepa_wm_metaworld": {
"environment": "Metaworld",
"resolution": "224Γ224",
"encoder": "DINOv2 ViT-S/14",
"pred_depth": 6,
"description": "JEPA-WM trained on Metaworld simulation environments",
},
"jepa_wm_pointmaze": {
"environment": "PointMaze",
"resolution": "224Γ224",
"encoder": "DINOv2 ViT-S/14",
"pred_depth": 6,
"description": "JEPA-WM trained on PointMaze navigation tasks",
},
"jepa_wm_pusht": {
"environment": "Push-T",
"resolution": "224Γ224",
"encoder": "DINOv2 ViT-S/14",
"pred_depth": 6,
"description": "JEPA-WM trained on Push-T manipulation tasks",
},
"jepa_wm_wall": {
"environment": "Wall",
"resolution": "224Γ224",
"encoder": "DINOv2 ViT-S/14",
"pred_depth": 6,
"description": "JEPA-WM trained on Wall environment",
},
"dino_wm_droid": {
"environment": "DROID & RoboCasa",
"resolution": "224Γ224",
"encoder": "DINOv2 ViT-S/14",
"pred_depth": 6,
"description": "DINO-WM baseline trained on DROID dataset",
},
"dino_wm_metaworld": {
"environment": "Metaworld",
"resolution": "224Γ224",
"encoder": "DINOv2 ViT-S/14",
"pred_depth": 6,
"description": "DINO-WM baseline trained on Metaworld",
},
"dino_wm_pointmaze": {
"environment": "PointMaze",
"resolution": "224Γ224",
"encoder": "DINOv2 ViT-S/14",
"pred_depth": 6,
"description": "DINO-WM baseline trained on PointMaze",
},
"dino_wm_pusht": {
"environment": "Push-T",
"resolution": "224Γ224",
"encoder": "DINOv2 ViT-S/14",
"pred_depth": 6,
"description": "DINO-WM baseline trained on Push-T",
},
"dino_wm_wall": {
"environment": "Wall",
"resolution": "224Γ224",
"encoder": "DINOv2 ViT-S/14",
"pred_depth": 6,
"description": "DINO-WM baseline trained on Wall environment",
},
"vjepa2_ac_droid": {
"environment": "DROID & RoboCasa",
"resolution": "256Γ256",
"encoder": "V-JEPA-2 ViT-G/16",
"pred_depth": 24,
"description": "V-JEPA-2-AC (fixed) baseline trained on DROID dataset",
},
"vjepa2_ac_oss": {
"environment": "DROID & RoboCasa",
"resolution": "256Γ256",
"encoder": "V-JEPA-2 ViT-G/16",
"pred_depth": 24,
"description": "V-JEPA-2-AC OSS baseline (with loss bug from original repo)",
},
}
def download_file(url: str, dest_path: str, verbose: bool = True) -> None:
"""Download a file from URL to destination path."""
import urllib.request
if verbose:
print(f" Downloading from {url}...")
urllib.request.urlretrieve(url, dest_path)
if verbose:
size_mb = os.path.getsize(dest_path) / (1024 * 1024)
print(f" Downloaded {size_mb:.1f} MB")
def create_model_card(model_name: str, repo_id: str) -> str:
"""Create a model card (README.md) for a model."""
meta = MODEL_METADATA.get(model_name, {})
model_type = (
"JEPA-WM"
if model_name.startswith("jepa_wm")
else ("DINO-WM" if model_name.startswith("dino_wm") else "V-JEPA-2-AC")
)
card = f"""---
license: cc-by-nc-4.0
tags:
- robotics
- world-model
- jepa
- planning
- pytorch
library_name: pytorch
pipeline_tag: robotics
datasets:
- facebook/jepa-wms
---
# {model_name}
{meta.get('description', f'{model_type} pretrained world model')}
## Model Details
- **Model Type:** {model_type}
- **Environment:** {meta.get('environment', 'N/A')}
- **Resolution:** {meta.get('resolution', 'N/A')}
- **Encoder:** {meta.get('encoder', 'N/A')}
- **Predictor Depth:** {meta.get('pred_depth', 'N/A')}
## Usage
### Via PyTorch Hub
```python
import torch
model, preprocessor = torch.hub.load('facebookresearch/jepa-wms', '{model_name}')
```
### Via Hugging Face Hub
```python
from huggingface_hub import hf_hub_download
import torch
# Download the checkpoint
checkpoint_path = hf_hub_download(
repo_id="{repo_id}",
filename="{model_name}.pth.tar"
)
# Load checkpoint (contains 'encoder', 'predictor', and 'heads' state dicts)
checkpoint = torch.load(checkpoint_path, map_location="cpu")
print(checkpoint.keys()) # dict_keys(['encoder', 'predictor', 'heads', 'opt', 'scaler', 'epoch', 'batch_size', 'lr', 'amp'])
```
> **Note**: This only downloads the weights. To instantiate the full `EncPredWM` model with the correct
> architecture and load the weights, we recommend using PyTorch Hub (see above) or cloning the
> [jepa-wms repository](https://github.com/facebookresearch/jepa-wms) and using the training/eval scripts.
## Paper
This model is from the paper ["What Drives Success in Physical Planning with Joint-Embedding Predictive World Models?"](https://arxiv.org/abs/2512.24497)
```bibtex
@misc{{terver2025drivessuccessphysicalplanning,
title={{What Drives Success in Physical Planning with Joint-Embedding Predictive World Models?}},
author={{Basile Terver and Tsung-Yen Yang and Jean Ponce and Adrien Bardes and Yann LeCun}},
year={{2025}},
eprint={{2512.24497}},
archivePrefix={{arXiv}},
primaryClass={{cs.AI}},
url={{https://arxiv.org/abs/2512.24497}},
}}
```
## License
This model is licensed under [CC-BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/).
"""
return card
def create_repo_readme(repo_id: str) -> str:
"""Create main README for the model repository."""
return f"""---
license: cc-by-nc-4.0
tags:
- robotics
- world-model
- jepa
- planning
- pytorch
library_name: pytorch
pipeline_tag: robotics
datasets:
- facebook/jepa-wms
---
<h1 align="center">
<p>π€ <b>JEPA-WMs Pretrained Models</b></p>
</h1>
<div align="center" style="line-height: 1;">
<a href="https://github.com/facebookresearch/jepa-wms" target="_blank" style="margin: 2px;"><img alt="Github" src="https://img.shields.io/badge/Github-facebookresearch/jepa--wms-black?logo=github" style="display: inline-block; vertical-align: middle;"/></a>
<a href="https://huggingface.co/{repo_id}" target="_blank" style="margin: 2px;"><img alt="HuggingFace" src="https://img.shields.io/badge/π€%20HuggingFace-{repo_id.replace('/', '/')}-ffc107" style="display: inline-block; vertical-align: middle;"/></a>
<a href="https://arxiv.org/abs/2512.24497" target="_blank" style="margin: 2px;"><img alt="ArXiv" src="https://img.shields.io/badge/arXiv-2512.24497-b5212f?logo=arxiv" style="display: inline-block; vertical-align: middle;"/></a>
</div>
<br>
<p align="center">
<b><a href="https://ai.facebook.com/research/">Meta AI Research, FAIR</a></b>
</p>
<p align="center">
This π€ HuggingFace repository hosts pretrained <b>JEPA-WM</b> world models.<br>
π See the <a href="https://github.com/facebookresearch/jepa-wms">main repository</a> for training code and datasets.
</p>
This repository contains pretrained world model checkpoints from the paper
["What Drives Success in Physical Planning with Joint-Embedding Predictive World Models?"](https://arxiv.org/abs/2512.24497)
## Available Models
### JEPA-WM Models
| Model | Environment | Resolution | Encoder | Pred. Depth |
|-------|-------------|------------|---------|-------------|
| `jepa_wm_droid` | DROID & RoboCasa | 256Γ256 | DINOv3 ViT-L/16 | 12 |
| `jepa_wm_metaworld` | Metaworld | 224Γ224 | DINOv2 ViT-S/14 | 6 |
| `jepa_wm_pusht` | Push-T | 224Γ224 | DINOv2 ViT-S/14 | 6 |
| `jepa_wm_pointmaze` | PointMaze | 224Γ224 | DINOv2 ViT-S/14 | 6 |
| `jepa_wm_wall` | Wall | 224Γ224 | DINOv2 ViT-S/14 | 6 |
### DINO-WM Baseline Models
| Model | Environment | Resolution | Encoder | Pred. Depth |
|-------|-------------|------------|---------|-------------|
| `dino_wm_droid` | DROID & RoboCasa | 224Γ224 | DINOv2 ViT-S/14 | 6 |
| `dino_wm_metaworld` | Metaworld | 224Γ224 | DINOv2 ViT-S/14 | 6 |
| `dino_wm_pusht` | Push-T | 224Γ224 | DINOv2 ViT-S/14 | 6 |
| `dino_wm_pointmaze` | PointMaze | 224Γ224 | DINOv2 ViT-S/14 | 6 |
| `dino_wm_wall` | Wall | 224Γ224 | DINOv2 ViT-S/14 | 6 |
### V-JEPA-2-AC Baseline Models
| Model | Environment | Resolution | Encoder | Pred. Depth |
|-------|-------------|------------|---------|-------------|
| `vjepa2_ac_droid` | DROID & RoboCasa | 256Γ256 | V-JEPA-2 ViT-G/16 | 24 |
| `vjepa2_ac_oss` | DROID & RoboCasa | 256Γ256 | V-JEPA-2 ViT-G/16 | 24 |
### VM2M Decoder Heads
| Model | Encoder | Resolution |
|-------|---------|------------|
| `dinov2_vits_224` | DINOv2 ViT-S/14 | 224Γ224 |
| `dinov2_vits_224_INet` | DINOv2 ViT-S/14 | 224Γ224 |
| `dinov3_vitl_256_INet` | DINOv3 ViT-L/16 | 256Γ256 |
| `vjepa2_vitg_256_INet` | V-JEPA-2 ViT-G/16 | 256Γ256 |
## Usage
### Via PyTorch Hub (Recommended)
```python
import torch
# Load JEPA-WM models
model, preprocessor = torch.hub.load('facebookresearch/jepa-wms', 'jepa_wm_droid')
model, preprocessor = torch.hub.load('facebookresearch/jepa-wms', 'jepa_wm_metaworld')
# Load DINO-WM baselines
model, preprocessor = torch.hub.load('facebookresearch/jepa-wms', 'dino_wm_metaworld')
# Load V-JEPA-2-AC baseline
model, preprocessor = torch.hub.load('facebookresearch/jepa-wms', 'vjepa2_ac_droid')
```
### Via Hugging Face Hub
```python
from huggingface_hub import hf_hub_download
import torch
# Download a specific checkpoint
checkpoint_path = hf_hub_download(
repo_id="{repo_id}",
filename="jepa_wm_droid.pth.tar"
)
# Load checkpoint (contains 'encoder', 'predictor', and 'heads' state dicts)
checkpoint = torch.load(checkpoint_path, map_location="cpu")
print(checkpoint.keys()) # dict_keys(['encoder', 'predictor', 'heads', 'opt', 'scaler', 'epoch', 'batch_size', 'lr', 'amp'])
```
> **Note**: This only downloads the weights. To instantiate the full model with the correct
> architecture and load the weights, we recommend using PyTorch Hub (see above) or cloning the
> [jepa-wms repository](https://github.com/facebookresearch/jepa-wms) and using the training/eval scripts.
## Citation
```bibtex
@misc{{terver2025drivessuccessphysicalplanning,
title={{What Drives Success in Physical Planning with Joint-Embedding Predictive World Models?}},
author={{Basile Terver and Tsung-Yen Yang and Jean Ponce and Adrien Bardes and Yann LeCun}},
year={{2025}},
eprint={{2512.24497}},
archivePrefix={{arXiv}},
primaryClass={{cs.AI}},
url={{https://arxiv.org/abs/2512.24497}},
}}
```
## License
These models are licensed under [CC-BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/).
## Links
- π [Paper](https://arxiv.org/abs/2512.24497)
- π» [GitHub Repository](https://github.com/facebookresearch/jepa-wms)
- π€ [Datasets](https://huggingface.co/datasets/facebook/jepa-wms)
- π€ [Models](https://huggingface.co/facebook/jepa-wms)
"""
def upload_readme_only(
repo_id: str,
dry_run: bool = False,
verbose: bool = True,
) -> None:
"""Upload only the README to Hugging Face Hub."""
from huggingface_hub import HfApi
api = HfApi()
with tempfile.TemporaryDirectory() as tmpdir:
readme_path = os.path.join(tmpdir, "README.md")
with open(readme_path, "w") as f:
f.write(create_repo_readme(repo_id))
if dry_run:
print(f"\n[DRY RUN] Would upload README.md to {repo_id}")
else:
api.upload_file(
path_or_fileobj=readme_path,
path_in_repo="README.md",
repo_id=repo_id,
repo_type="model",
)
if verbose:
print("β Uploaded README.md")
def upload_models(
repo_id: str,
models: dict,
category: str,
dry_run: bool = False,
verbose: bool = True,
use_local: bool = False,
local_dir: str = ".",
) -> None:
"""Upload models to Hugging Face Hub."""
from huggingface_hub import create_repo, HfApi
api = HfApi()
local_dir_path = Path(local_dir).resolve()
if not dry_run:
# Create repository if it doesn't exist
try:
create_repo(repo_id, repo_type="model", exist_ok=True)
if verbose:
print(f"Repository {repo_id} is ready")
except Exception as e:
print(f"Note: {e}")
with tempfile.TemporaryDirectory() as tmpdir:
# Create main README
readme_path = os.path.join(tmpdir, "README.md")
with open(readme_path, "w") as f:
f.write(create_repo_readme(repo_id))
if dry_run:
print(f"\n[DRY RUN] Would upload README.md to {repo_id}")
else:
api.upload_file(
path_or_fileobj=readme_path,
path_in_repo="README.md",
repo_id=repo_id,
repo_type="model",
)
if verbose:
print("Uploaded README.md")
# Upload each model
for model_name, url in models.items():
if verbose:
print(f"\nProcessing {model_name}...")
hf_filename = f"{model_name}.pth.tar"
if use_local:
# Use local file
local_path = local_dir_path / hf_filename
if not local_path.exists():
print(f" β Local file not found: {local_path}, skipping...")
continue
if dry_run:
size_mb = local_path.stat().st_size / (1024 * 1024)
print(
f" [DRY RUN] Would upload local file {local_path} ({size_mb:.1f} MB)"
)
print(f" [DRY RUN] Would upload as {hf_filename}")
continue
if verbose:
size_mb = local_path.stat().st_size / (1024 * 1024)
print(f" Using local file: {local_path} ({size_mb:.1f} MB)")
print(f" Uploading as {hf_filename}...")
api.upload_file(
path_or_fileobj=str(local_path),
path_in_repo=hf_filename,
repo_id=repo_id,
repo_type="model",
)
else:
# Download from URL
original_filename = url.split("/")[-1]
if dry_run:
print(f" [DRY RUN] Would download from {url}")
print(f" [DRY RUN] Would upload as {hf_filename}")
continue
# Download checkpoint
local_path = os.path.join(tmpdir, original_filename)
download_file(url, local_path, verbose=verbose)
# Upload to HF Hub
if verbose:
print(f" Uploading as {hf_filename}...")
api.upload_file(
path_or_fileobj=local_path,
path_in_repo=hf_filename,
repo_id=repo_id,
repo_type="model",
)
# Clean up to save space
os.remove(local_path)
if verbose:
print(f" β Uploaded {hf_filename}")
def main():
parser = argparse.ArgumentParser(
description="Upload JEPA-WMs checkpoints to Hugging Face Hub"
)
parser.add_argument(
"--repo-id",
type=str,
required=True,
help="Hugging Face repository ID (e.g., 'facebook/jepa-wms')",
)
parser.add_argument(
"--category",
type=str,
choices=["all", "jepa_wm", "dino_wm", "vjepa2_ac", "decoders"],
default="all",
help="Category of models to upload",
)
parser.add_argument(
"--model",
type=str,
help="Upload a specific model by name (e.g., 'jepa_wm_droid')",
)
parser.add_argument(
"--dry-run",
action="store_true",
help="Show what would be uploaded without actually uploading",
)
parser.add_argument(
"--readme-only",
action="store_true",
help="Only upload the README.md (skip checkpoint uploads)",
)
parser.add_argument(
"--quiet",
action="store_true",
help="Reduce output verbosity",
)
parser.add_argument(
"--local",
action="store_true",
help="Upload from local files instead of downloading from CDN",
)
parser.add_argument(
"--local-dir",
type=str,
default=".",
help="Directory containing local checkpoint files (default: current directory)",
)
args = parser.parse_args()
verbose = not args.quiet
# Handle README-only upload
if args.readme_only:
if verbose:
print(
f"{'[DRY RUN] ' if args.dry_run else ''}Uploading README.md to {args.repo_id}"
)
upload_readme_only(
repo_id=args.repo_id,
dry_run=args.dry_run,
verbose=verbose,
)
if verbose and not args.dry_run:
print(f"\nβ Done! README updated at: https://huggingface.co/{args.repo_id}")
return
# Select models to upload
if args.model:
# Upload specific model
all_models = {**MODEL_URLS, **IMAGE_DECODER_URLS}
if args.model not in all_models:
print(f"Error: Unknown model '{args.model}'")
print(f"Available models: {list(all_models.keys())}")
return
models = {args.model: all_models[args.model]}
elif args.category == "all":
models = {**MODEL_URLS, **IMAGE_DECODER_URLS}
elif args.category == "jepa_wm":
models = {k: v for k, v in MODEL_URLS.items() if k.startswith("jepa_wm")}
elif args.category == "dino_wm":
models = {k: v for k, v in MODEL_URLS.items() if k.startswith("dino_wm")}
elif args.category == "vjepa2_ac":
models = {k: v for k, v in MODEL_URLS.items() if k.startswith("vjepa2_ac")}
elif args.category == "decoders":
models = IMAGE_DECODER_URLS
if verbose:
mode_str = "local files" if args.local else "dl.fbaipublicfiles.com"
print(
f"{'[DRY RUN] ' if args.dry_run else ''}Uploading {len(models)} models to {args.repo_id} (from {mode_str})"
)
print(f"Models: {list(models.keys())}")
upload_models(
repo_id=args.repo_id,
models=models,
category=args.category,
dry_run=args.dry_run,
verbose=verbose,
use_local=args.local,
local_dir=args.local_dir,
)
if verbose and not args.dry_run:
print(f"\nβ Done! Models available at: https://huggingface.co/{args.repo_id}")
if __name__ == "__main__":
main()
|