Aryama's picture
Trained weights (LoRA adapters + twig heads), model card, checksums
80bfdac verified
|
Raw History Blame Contribute Delete
5.18 kB
---
license: apache-2.0
library_name: pytorch
base_model:
- Efficient-Large-Model/Sana_600M_512px_diffusers
- Wan-AI/Wan2.1-VACE-1.3B-diffusers
tags:
- diffusion
- diffusion-twigs
- loop-guidance
- lora
- controllable-generation
- video-editing
- safetensors
---
# Diffusion Twigs for images and video frames: trained weights
These are the weights for **[diffusion-twigs-image-video](https://github.com/AryamaVMurthy/diffusion-twigs-image-video)**. The project adapts *Diffusion Twigs with Loop Guidance* ([Mercatali et al., NeurIPS 2024](https://arxiv.org/abs/2410.24012)) to conditional image generation and next-frame video editing.
πŸ“„ Interactive report with all results, controls and theory: <https://aryamavmurthy.github.io/diffusion-twigs-image-video/report/>
The base models stay **frozen** and are not included. Download them from their own repos. This repo holds only what we trained: LoRA adapters, condition encoders and the small *twig* networks. Files are weights-only `safetensors`. Each file's training config is in its metadata.
## Files
| File | What it is | Base model | Size |
|---|---|---|---|
| `image/H6_sana_lora.safetensors` | **H6** conditional image model. LoRA r8 + seg/depth/box encoders + class-list prompts. Best adherence: COCO test mIoU 0.352 β†’ 0.481, hallucinated area 26.6% β†’ 20.0%. | Sana 600M 512px | 32 MB |
| `image/TB_sana_lora_twigs.safetensors` | **T-B** trunk used by the twig loop. LoRA r8 + seg/depth twig heads (stop-gradient). | Sana 600M 512px | 35 MB |
| `image/presence_twig.safetensors` | **Presence twig** (133 COCO-panoptic classes) on frozen T-B features. Drives *twig self-prompting*. | reads T-B | 4 MB |
| `video/W1_wan_vace_lora.safetensors` | **W1** next-frame editor (frame + change description β†’ next frame). LoRA r32. | Wan 2.1 VACE 1.3B | 135 MB |
| `video/VT_silhouette_twig.safetensors` | **V-T silhouette twig**. Reads the editor's xΜ‚β‚€ at step 1, the pose skeleton and the edit text (FiLM). Drives the *twig restart*. | reads W1 | 7 MB |
`SHA256SUMS` lists checksums.
## What the twigs do (held-out results)
- **Image twig self-prompting.** With no caption, the presence twig reads the trunk's xΜ‚β‚€ during sampling. Its classes are fed back as a prompt through the model's own text pathway. COCO test, n = 200:
- **Depth-only:** CLIP +0.355βœ“, KID Γ—100 5.05 β†’ 3.91.
- **Unconditional:** VLM legibility +0.355βœ“, KID Γ—100 3.86 β†’ 1.63.
A shuffled-list control does not reproduce these gains.
- **Video twig restart.** Pass 1 is read by the twig at step 1. Pass 2 re-samples from the same noise with the twig's silhouette as a mask, extrapolated away from "stay" (`1[p + Ξ»(p βˆ’ source) > Β½]`). Against W1:
- **YouTube-VOS text edits:** mask IoU +0.059βœ“.
- **DAVIS (unseen videos):** mask IoU +0.038βœ“.
- **Identity and PSNR** also improve. The full table and the motion-guidance variants are in the report.
## Usage
The weights are meant to be used with the code in the GitHub repo. The helper script downloads them and rebuilds the checkpoint layout the code expects:
```bash
git clone https://github.com/AryamaVMurthy/diffusion-twigs-image-video && cd diffusion-twigs-image-video
pip install -r requirements.txt # plus torch for your CUDA
python scripts/checkpoints.py fetch RUNS # -> RUNS/train/..., RUNS/wan/...
python -m twigs.cli --data DATA --runs RUNS edit_eval --name vt --no-baselines --subsets '[8]' \
--ckpts '{"W1vt": {"kind": "wan", "lora_rank": 32, "ckpt": "RUNS/wan/W1/ckpt_3000.pt", "src_cfg": 1.5,
"twig": "RUNS/wan/VT_twig/twig_1000.pt", "twig_steps": [1], "twig_restart": true,
"twig_early_exit": true, "twig_extrap": 0.5}}'
```
To read a file directly:
```python
from huggingface_hub import hf_hub_download
from safetensors import safe_open
import json
p = hf_hub_download("Aryama/diffusion-twigs-image-video", "video/VT_silhouette_twig.safetensors")
with safe_open(p, "pt") as f:
meta = f.metadata(); weights = {k: f.get_tensor(k) for k in f.keys()}
print(meta["description"], json.loads(meta["extra"])["cfg"])
```
## Training data and limitations
- **Training data:**
- Image models: 15k COCO train2017 images.
- Video editor and twig: static-camera frame pairs mined from YouTube-VOS 2019.
DAVIS 2017 was used only for evaluation. Check each dataset's own terms before reuse.
- **Research weights, small budget:**
- 512 px images.
- The video editor works on short 5-frame clips from a 1.3B model.
- Large deformations and burnt-in text remain hard.
- Text-only video edits are the weakest setting. On those, the twig improves localisation, but the VLM "change done" rate is only at parity with the baseline.
## License and citation
Apache-2.0, the same licence as both base models. If you use these weights, please also cite Diffusion Twigs:
```bibtex
@inproceedings{mercatali2024diffusiontwigs,
title = {Diffusion Twigs with Loop Guidance for Conditional Graph Generation},
author = {Mercatali, Giangiacomo and Verma, Yogesh and Freitas, Andr{\'e} and Garg, Vikas},
booktitle = {Advances in Neural Information Processing Systems},
year = {2024}
}
```