--- title: Loopy emoji: ๐Ÿ” colorFrom: gray colorTo: red sdk: gradio sdk_version: 6.26.0 app_file: app.py pinned: false python_version: "3.12" startup_duration_timeout: 1h short_description: Seamless looping video generation with Wan2.2 + Loopy models: - htdong/Loopy - Wan-AI/Wan2.2-T2V-A14B - lightx2v/Wan2.2-Distill-Loras --- # ๐Ÿ” Loopy โ€” Seamless Video Loop Generation Demo of **[Loopy](https://huggingface.co/htdong/Loopy)** โ€” *Seamless Video Loop Generation via Anchored Looping Shift of Positional Embedding* ([code](https://github.com/WeChatCV/Loopy) ยท [project page](https://donghaotian123.github.io/Loopy/)). Loopy turns [Wan2.2-T2V-A14B](https://huggingface.co/Wan-AI/Wan2.2-T2V-A14B) into a *looping* video generator. Its trick is the **anchored looping shift of positional embedding**: inside self-attention block `i` the temporal RoPE frequencies are cyclically rolled by `shift = 0 if i == 0 else (i - 1) % (F - 1) + 1` (with `F` latent frames), which puts the temporal positions on a circle so the last frame becomes a neighbour of the first one and the clip loops without a visible seam. Two small LoRAs (high-noise / low-noise expert) adapt the base model to that shifted geometry. ## What this Space runs Faithful port of the reference implementation (`generate_2.2_new.py`, `Wan2.2/wan2/text2video_roll.py`, `Wan2.2/wan2/modules/model_roll.py`) onto ๐Ÿงจ diffusers' `WanPipeline` so it fits on ZeroGPU: | | | |---|---| | Base | `linoyts/Wan2.2-T2V-A14B-Diffusers-BF16` (bf16 mirror of `Wan-AI/Wan2.2-T2V-A14B-Diffusers`) | | LoRAs merged | LightX2V 4-step distillation (rank 64, high + low) + Loopy (rank 4, high + low) | | RoPE | anchored looping shift, applied to self-attention only, per the paper | | Sampler | UniPC, flow sigmas, `shift = 12.0`, 4 steps, `guidance = 1.0` (CFG-free) | | Default output | 832ร—480, 53 frames @ 16 fps (the repo's `test.sh` setting) | | Quantization | fp8 dynamic (both 14B experts), int8 weight-only (UMT5-XXL text encoder) | Prompts in the examples are the ones the authors showcase on the project page. ## Prompting tips Describe motion that is naturally periodic or continuous โ€” falling snow, drifting clouds, flowing water, a walking animal, a rotating object โ€” and state the style and shot type. English and Chinese both work.