Metadata-Version: 2.5
Name: wsms
Version: 0.2.0
Summary: World Snapshot Models pipelines for unified visual generation, estimation, control, and reconstruction
Project-URL: Homepage, https://world-snapshot.github.io/WSMs/
Project-URL: Documentation, https://world-snapshot.github.io/doc/index.html
Project-URL: Repository, https://github.com/World-Snapshot/WSMs
Project-URL: Paper, https://arxiv.org/abs/2611.24917
Project-URL: Models, https://huggingface.co/World-Snapshot/WSM_v1
Project-URL: Datasets, https://huggingface.co/World-Snapshot/datasets
Project-URL: Issues, https://github.com/World-Snapshot/WSMs/issues
Author: World Snapshot
Author-email: Sen Fang <sen.fang@rutgers.edu>
License: WSM Non-commercial Research License
        
        © 2026–2027 Rutgers, The State University of New Jersey.
        
        The accompanying source code, executable software and binaries, documentation, and Rutgers-owned model artifacts (including trained or fine-tuned model weights, checkpoints, adapters, model.pth files, and other model-weight files) are made available under the terms of this Rutgers’ Non-commercial Research License (this “RU-NCRL”). By downloading, installing, or using any of these materials, you are consenting to be bound by this RU-NCRL. If you do not agree to the terms and conditions of this license, do not download, install, or use any of these materials.
        
        Redistribution and use for noncommercial purposes in source, binary, and model-artifact forms, with or without modification, are permitted provided that the following conditions are met:
        
        1. The software is used solely for academic, research, experimental, personal noncommercial purposes. It may not be used indirectly for commercial use, such as on a website that accepts advertising money for content. For commercial use rights, contact Rutgers, The State University of New Jersey, at compliance@research.rutgers.edu, copying Dimitris N. Metaxas at dnm@cs.rutgers.edu and Sen Fang at sen.fang@rutgers.edu, and inquire about the Rutgers Docket #2027-020.
        
        2. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
        
        3. Redistributions in binary or model-artifact form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
        
        4. Neither the name of Rutgers, The State University of New Jersey nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
        
        This Agreement shall be governed by, construed, interpreted and enforced under the laws of the State of New Jersey, except for its conflict of laws principles. The venue shall be the state and federal courts located in the State of New Jersey.
        
        THIS SOFTWARE IS PROVIDED BY THE RUTGERS, THE STATE UNIVERSITY OF NEW JERSEY AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RUTGERS, THE STATE UNIVERSITY OF NEW JERSEY OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License-File: LICENSE
Keywords: computer vision,diffusers,generative model,multimodal,tunnelingnet,world snapshot model
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Requires-Dist: accelerate>=1.2.0
Requires-Dist: av>=13.0.0
Requires-Dist: diffusers>=0.40.0
Requires-Dist: einops>=0.8.0
Requires-Dist: httpx>=0.27.0
Requires-Dist: huggingface-hub>=0.36.0
Requires-Dist: imageio[ffmpeg]>=2.36.0
Requires-Dist: lightning[pytorch-extra]<2.6,>=2.1
Requires-Dist: matplotlib>=3.9.3
Requires-Dist: numba>=0.60.0
Requires-Dist: numpy<3,>=1.26.4
Requires-Dist: opencv-python-headless>=4.10.0
Requires-Dist: optimum-quanto>=0.2.6
Requires-Dist: packaging>=24.0
Requires-Dist: pandas>=2.2.3
Requires-Dist: peft>=0.18.0
Requires-Dist: pillow>=10.0.0
Requires-Dist: plyfile>=1.1
Requires-Dist: pyrender>=0.1.45
Requires-Dist: pyyaml>=6.0
Requires-Dist: safetensors>=0.5.0
Requires-Dist: scikit-learn>=1.5.0
Requires-Dist: scipy>=1.14.0
Requires-Dist: sentencepiece>=0.2.0
Requires-Dist: speechrecognition>=3.10.0
Requires-Dist: sympy>=1.13.0
Requires-Dist: timm>=1.0.12
Requires-Dist: torch>=2.5.0
Requires-Dist: torchvision>=0.20.0
Requires-Dist: tqdm>=4.66.0
Requires-Dist: transformers>=5.0.0
Requires-Dist: trimesh>=4.5.0
Provides-Extra: audio
Requires-Dist: openai-whisper>=20240930; extra == 'audio'
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: twine>=6; extra == 'dev'
Provides-Extra: full
Requires-Dist: bitsandbytes>=0.45; extra == 'full'
Requires-Dist: fastapi>=0.115; extra == 'full'
Requires-Dist: gradio>=4; extra == 'full'
Requires-Dist: mayavi>=4.8; extra == 'full'
Requires-Dist: open3d>=0.18; extra == 'full'
Requires-Dist: openai-whisper>=20240930; extra == 'full'
Requires-Dist: plotly>=5; extra == 'full'
Requires-Dist: uvicorn>=0.32; extra == 'full'
Requires-Dist: viser>=0.2; extra == 'full'
Requires-Dist: wandb>=0.19; extra == 'full'
Requires-Dist: xformers>=0.0.29; extra == 'full'
Provides-Extra: training
Requires-Dist: bitsandbytes>=0.45; extra == 'training'
Requires-Dist: wandb>=0.19; extra == 'training'
Requires-Dist: xformers>=0.0.29; extra == 'training'
Provides-Extra: webui
Requires-Dist: fastapi>=0.115; extra == 'webui'
Requires-Dist: gradio>=4; extra == 'webui'
Requires-Dist: open3d>=0.18; extra == 'webui'
Requires-Dist: plotly>=5; extra == 'webui'
Requires-Dist: uvicorn>=0.32; extra == 'webui'
Requires-Dist: viser>=0.2; extra == 'webui'
Description-Content-Type: text/markdown

# WSM: World Snapshot Models

**World Snapshot Models (WSMs) are an ideal world model designed to unify,
expand, and ultimately transcend Computer Vision.** The first implementation is
WSM v1, codename Augustus.

To train the world itself, we define world frames and use
[World Snapshot Graphics (`.wsg`)](https://github.com/World-Snapshot/wsg) to
encode RGB, geometry, motion, pose, physics, materials, semantics, audio, and
other information into a unified 256-channel image. This realizes the
[Unified Law for Visual Tasks](https://github.com/World-Snapshot/Unified-Law-for-Visual-Tasks):
**if all information can be encoded into the image itself, then two-dimensional
image generation becomes lossless world generation.**

WSM v1 is the first large-scale implementation of this law. **A single
generative model validates 1,148 visual tasks and provides a trained baseline
for every task.** Capabilities previously scattered across different models,
datasets, and research communities coexist in the same system, while 99.99% of
earlier visual models were built for one task. Papers with Code recorded 1,477
visual or vision-related tasks representing the existing field; all 1,477 are
compatible with WSM interfaces. Among the 1,148 evaluated tasks, an estimated
655–1,056 are entirely new, allowing WSM to **expand the recorded Computer
Vision task space by 44.3–71.5%.**

The four WSM interfaces are the minimum common training form of the complete
visual task space. At this higher level, classification, localization,
detection, segmentation, estimation, reconstruction, restoration, completion,
registration, correspondence, tracking, retrieval, indexing, prediction,
generation, editing, rendering, simulation, planning, and control all belong
to these four interface categories. Thousands of concrete tasks can therefore
be trained through the same four unified interfaces.

This scale is enabled by **TunnelingNet**. It preserves a shared FLUX.2
generative backbone while learning an independently trainable compact tunnel
for each directed task. Every tunnel can be trained, loaded, improved,
separated, or newly added without retraining the task bank from scratch.
Compared with parameter-matched multimodal and unified-model baselines,
TunnelingNet reveals recognizable structure 77–100 times earlier and requires
19.0–38.5 times fewer optimizer updates. Each task adds only a
12.51M-parameter tunnel; with the complete task bank loaded, WSM v1 forms an
18B-class model rather than multiplying the backbone thousands of times.

The `wsms` package makes this complete task space directly callable through
`WSMPipeline`, command-line discovery, and qualified Dense, Sparse, and
Custom Channel Heads.

## Installation

```bash
pip install wsms
```

The [one-click WSM notebook](https://github.com/World-Snapshot/WSMs/blob/main/src/examples/WSM_Quickstart.ipynb)
turns the discovery and inference examples below into an executable GPU
workflow.

WSM v1 inference requires a CUDA-capable GPU and currently runs in
`torch.bfloat16`. If pip selects a PyTorch build that does not match the local
CUDA driver, install the appropriate PyTorch wheel first and then install
`wsms`.

Optional interfaces can be installed without changing the API:

```bash
pip install "wsms[audio]"     # audio-specific decoding support
pip install "wsms[webui]"     # ControlWorld/WebUI dependencies
pip install "wsms[training]"  # training and continuation utilities
pip install "wsms[full]"      # all optional components
```

The pip distribution contains the WSM pipeline, task catalog, modality
contracts, and the source required to run released TunnelingNets. Model weights
are distributed separately as the single `WSM_v1.wsm` checkpoint on Hugging
Face and are never embedded in the Python package.

### Install directly from GitHub

The public Git repository can also be installed directly. Dependencies declared
in `pyproject.toml` are installed automatically:

```bash
pip install "wsms @ git+https://github.com/World-Snapshot/WSMs.git@v0.2.0"
```

Replace the release tag with a specific commit when exact reproducibility is
required.

## Model access

The default model repository is:

```text
World-Snapshot/WSM_v1
```

The model repository is public, so downloading released checkpoints does not
require authentication. A Hugging Face login remains optional for users who
want authenticated Hub access:

```bash
hf auth login
```

When present, the pipeline uses the cached Hugging Face identity automatically.
It also supports the standard `HF_TOKEN` environment variable and an explicit
`token=...` argument. Avoid storing tokens in source files or shell history.

## Three levels of discovery

WSM separates the public task relationship from its concrete implementation:

1. A **tunnel** is an ordered input-to-output mapping, such as
   `0-2 -> 36-38`.
2. A **Head** is one implementation of that mapping.
3. A **family** qualifies the Head namespace: `dense`, `sparse`, or
   `custom`.

Head indices repeat across families. Consequently, a bare value such as
`000003` is intentionally rejected. Use `dense:000003`,
`sparse:000003`, or `custom:000003` when pinning an implementation.

### Command-line discovery

```bash
wsms list
wsms tunnel list
wsms head list
wsms info
```

`wsms list` shows the package's top-level capabilities. `wsms tunnel list`
shows all user-facing mappings, while `wsms head list` shows the qualified
implementation behind each mapping.

Examples:

```bash
# RGB -> surface normals
wsms tunnel list --input 0-2 --output 36-38

# Ordered multi-input route
wsms tunnel list --input 39 --input 0-2 --output 90-92

# Only Sparse implementations
wsms head list --source sparse

# Machine-readable discovery
wsms tunnel list --output Universal_Pose --json
```

Filters preserve input order because `A + B -> C` and `B + A -> C` can
represent different routing contracts.

### Python discovery

```python
from wsms import WSMPipeline

tasks = WSMPipeline.list_tasks(
    inputs=["0-2"],
    output="36-38",
)
print(tasks[0]["task_id"])
print(tasks[0]["head"])
print(tasks[0]["condition_description"])
print(tasks[0]["target_description"])
```

The catalog combines all released and recommended Dense, Sparse, and Custom
Heads. It can be queried without downloading model weights.

## Python inference

Input-output selection is the recommended public API:

```python
import torch
from wsms import WSMPipeline

pipe = WSMPipeline.from_pretrained(
    "World-Snapshot/WSM_v1",
    inputs=["0-2"],
    output="36-38",
    torch_dtype=torch.bfloat16,
    device="cuda:0",
)

result = pipe(
    "input.png",
    num_inference_steps=10,
    seed=20260812,
    size=256,
)
result.images[0].save("normal.png")
```

`from_pretrained` first reads the compact index of `WSM_v1.wsm`, then fetches
only the embedded FLUX.2 Klein 4B runtime and the selected TunnelingNet byte
ranges. The backbone is cached once and shared across subsequent tasks; the
other 1,157 TunnelingNets are not downloaded or loaded.

### Multi-input tunnels

Pass a dictionary keyed by modality ID:

```python
pipe = WSMPipeline.from_pretrained(
    "World-Snapshot/WSM_v1",
    inputs=["39", "0-2"],
    output="90-92",
    device="cuda:0",
)

result = pipe(
    {
        "39": "curvature.npz",
        "0-2": "reference.png",
    }
)
```

An ordered list or tuple is also accepted, but a dictionary makes the routing
contract more explicit.

### Pinning a concrete Head

Use the input-output interface for ordinary use. A qualified Head is available
for exact reproduction:

```python
pipe = WSMPipeline.from_pretrained(
    "World-Snapshot/WSM_v1",
    head="custom:000000",
    device="cuda:0",
)
```

### Local and offline loading

A local single-file WSM checkpoint can replace the Hub repository:

```python
pipe = WSMPipeline.from_pretrained(
    "/models/WSM_v1.wsm",
    inputs=["0-2"],
    output="36-38",
    device="cuda:0",
)
```

Legacy release directories and direct task checkpoints remain supported, with
`base_model=...` available for those layouts. Set `cache_dir` to control where
the selected single-file members are materialized and reused.

## Command-line inference

The command-line interface uses the same catalog and `WSMPipeline` runtime:

```bash
wsms infer \
  --input 0-2=input.png \
  --target 36-38 \
  --device cuda:0 \
  --steps 10 \
  --seed 20260812 \
  --output-dir outputs/rgb_to_normal
```

Multi-input example:

```bash
wsms infer \
  --input 39=curvature.npz \
  --input 0-2=reference.png \
  --target 90-92 \
  --device cuda:0 \
  --output-dir outputs/curvature_reference_to_target
```

To pin an implementation, replace `--target` with a qualified selector such
as `--head dense:000424`. Run `wsms infer --help` for all runtime options.

## Accepted inputs

The Python pipeline accepts:

- paths to PNG/JPEG and WSG/NPZ inputs;
- `PIL.Image.Image` objects;
- NumPy arrays;
- PyTorch tensors.

RGB arrays are materialized as images. Non-RGB arrays are materialized as
modality-scoped NPZ files and then pass through the same normalization and
encoding contract used by the canonical WSM inference script.

## Outputs

Calling the pipeline returns `WSMPipelineOutput`:

```python
result.images       # list[PIL.Image.Image], primary visual outputs
result.wsg          # generated WSG array when available
result.task_id      # resolved family and input-output mapping
result.artifacts    # files retained when output_dir is provided
result.metadata     # task, seed, steps, size, and runtime manifest
```

Without `output_dir`, temporary intermediate files are removed after the
in-memory result is loaded. With `output_dir`, the generated image, WSG,
manifest, and related runtime artifacts are retained.

## Special modality assets

Some geometry and human-body visualizations require separately licensed assets.
Set these only when the selected tunnel needs them:

- `WSM_SMPLX_MODEL_ROOT`: directory containing SMPL-X model assets;
- `WSM_HUMAN_MODELS_PYTHONPATH`: optional Python helper root for SMPL-X;
- `WSM_SHAPENET_TEXTURE_ROOT`: ShapeNet texture directory.

These third-party assets are not distributed by `wsms`.

## Naming compatibility

`WSMPipeline` follows Python and Diffusers class naming conventions.
`WSM_Pipeline` remains available as a compatibility alias:

```python
from wsms import WSMPipeline, WSM_Pipeline

assert WSMPipeline is WSM_Pipeline
```

## Links

- [Project](https://world-snapshot.github.io/WSMs/)
- [Source](https://github.com/World-Snapshot/WSMs)
- [Model repository](https://huggingface.co/World-Snapshot/WSM_v1)
- [Post-training materials](https://huggingface.co/World-Snapshot/WSM_v1-Training-Resources)
- [Datasets](https://huggingface.co/World-Snapshot/datasets)
- [Documentation](https://world-snapshot.github.io/doc/index.html)
- [Paper](https://arxiv.org/abs/2611.24917)
