Image-to-Video
Diffusers
Safetensors
world-model
video-generation
camera-control
long-video
linear-attention
Instructions to use sum0214/LOCI with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use sum0214/LOCI with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image, export_to_video # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("sum0214/LOCI", dtype=torch.bfloat16, device_map="cuda") pipe.to("cuda") prompt = "A man with short gray hair plays a red electric guitar." image = load_image( "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/guitar-man.png" ) output = pipe(image=image, prompt=prompt).frames[0] export_to_video(output, "output.mp4") - Notebooks
- Google Colab
- Kaggle
Model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: diffusers
|
| 4 |
+
base_model: Wan-AI/Wan2.2-TI2V-5B
|
| 5 |
+
pipeline_tag: image-to-video
|
| 6 |
+
tags:
|
| 7 |
+
- world-model
|
| 8 |
+
- video-generation
|
| 9 |
+
- camera-control
|
| 10 |
+
- long-video
|
| 11 |
+
- linear-attention
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# LOCI
|
| 15 |
+
|
| 16 |
+
LOCI is a hybrid spatial-memory video world model built on Wan2.2-TI2V-5B. When a camera revisits a previously observed region, it reproduces what was there before: in half of the transformer blocks, attention keeps a key-value cache of past observations; in the other half, attention is restricted to the current chunk and complemented by a recurrent linear-attention memory whose reads and writes are conditioned on projective camera geometry. On the public MIND memory benchmark and on held-out recorded trajectories, LOCI reproduces revisited content more faithfully than representative world models and a same-recipe full-softmax model; with a bounded bank of retained observations, it streams long videos at constant memory.
|
| 17 |
+
|
| 18 |
+
- Paper: [LOCI: Spatial Linear Memory for Streaming World Models](https://arxiv.org/abs/2609.40222)
|
| 19 |
+
- Code: https://github.com/xiaji2021/LOCI
|
| 20 |
+
|
| 21 |
+
## Models
|
| 22 |
+
|
| 23 |
+
This repository holds two models with the same architecture, each in its own subfolder:
|
| 24 |
+
|
| 25 |
+
| subfolder | sampler | steps |
|
| 26 |
+
|---|---|---|
|
| 27 |
+
| `LOCI/` | `flow_euler` | 50 |
|
| 28 |
+
| `LOCI-4step/` | `few_step` (distilled) | 4 |
|
| 29 |
+
|
| 30 |
+
Each subfolder contains `config.json`, the shard index, 3 bf16 shards (about 11 GB, transformer only) and `SHA256SUMS`. The sampler and the number of steps are read from `config.json`; `--steps N` overrides the number of steps.
|
| 31 |
+
|
| 32 |
+
## Download
|
| 33 |
+
|
| 34 |
+
Download one model:
|
| 35 |
+
|
| 36 |
+
```bash
|
| 37 |
+
hf download sum0214/LOCI --include "LOCI-4step/*" --local-dir ./weights # 4-step model
|
| 38 |
+
hf download sum0214/LOCI --include "LOCI/*" --local-dir ./weights # 50-step model
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
The VAE, text encoder and tokenizer come from the Wan2.2 base release (`Wan-AI/Wan2.2-TI2V-5B-Diffusers`); the code loads them from the Hub.
|
| 42 |
+
|
| 43 |
+
## Run
|
| 44 |
+
|
| 45 |
+
Install the code from https://github.com/xiaji2021/LOCI, then:
|
| 46 |
+
|
| 47 |
+
```bash
|
| 48 |
+
python examples/make_trajectory.py --preset look_around --chunks 16 --output traj.json
|
| 49 |
+
python scripts/generate.py --weights ./weights/LOCI-4step --wan Wan-AI/Wan2.2-TI2V-5B-Diffusers \
|
| 50 |
+
--image first_frame.png --prompt "A sunlit stone temple courtyard with red lanterns." \
|
| 51 |
+
--trajectory traj.json --height 512 --width 768 --output out.mp4
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
## Recommended use
|
| 55 |
+
|
| 56 |
+
- Full history (default) is recommended for clips up to about one minute.
|
| 57 |
+
- `--history sparse` selects the paper's bounded-memory setting: first frame + a view bank + the most recent frames, at constant memory.
|
| 58 |
+
- Resolution 480x864 or 512x768, one GPU. An 80 GB-class GPU (H100 / H200) is recommended.
|
| 59 |
+
|
| 60 |
+
## Speed
|
| 61 |
+
|
| 62 |
+
Measured on one NVIDIA H200 with FlashAttention-3: LOCI (50 steps), 480x864, bfloat16, a recorded 300 s camera trajectory. Time is seconds per second of generated video (one chunk = 20 frames = 1.25 s at 16 fps). Memory is the peak GPU memory allocated during generation (text encoding and VAE decoding not included).
|
| 63 |
+
|
| 64 |
+
| history | s per video second | peak GPU memory | measured over |
|
| 65 |
+
|---|---|---|---|
|
| 66 |
+
| full (`dense`, default) | 7.0 | 30.0 GiB | the first 40 s (time and memory grow with length) |
|
| 67 |
+
| bounded (`sparse`) | 5.0 | 16.2 GiB | 300 s (constant time per chunk and constant memory) |
|
| 68 |
+
|
| 69 |
+
## Citation
|
| 70 |
+
|
| 71 |
+
```bibtex
|
| 72 |
+
@article{xia2026loci,
|
| 73 |
+
title={LOCI: Spatial Linear Memory for Streaming World Models},
|
| 74 |
+
author={Xia, Ji and Liao, Tingting and Liang, Xuezhi and Li, Hao and Liu, Guangyi},
|
| 75 |
+
journal={arXiv preprint arXiv:2609.40222},
|
| 76 |
+
year={2026}
|
| 77 |
+
}
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
## Acknowledgements
|
| 81 |
+
|
| 82 |
+
LOCI builds on [Wan2.2](https://github.com/Wan-Video/Wan2.2). We thank the authors of [ARL²](https://arxiv.org/abs/2605.16579) (Li, Shah and Shang, *Attend Locally, Remember Linearly*): LOCI adopts their hybrid layer layout and follows their sampling procedure for the recurrent memory.
|
| 83 |
+
|
| 84 |
+
## License
|
| 85 |
+
|
| 86 |
+
Apache-2.0.
|