omerbt/TokenFlow

★ 1,707⑂ 143

Official Pytorch Implementation for "TokenFlow: Consistent Diffusion Features for Consistent Video Editing" presenting "TokenFlow" (ICLR 2024)

About omerbt/TokenFlow

omerbt/TokenFlow is an open-source project on GitHub, mainly written in Python. Official Pytorch Implementation for "TokenFlow: Consistent Diffusion Features for Consistent Video Editing" presenting "TokenFlow" (ICLR 2024) It currently holds 1,707 stars and 143 forks with 41 open issues, and was last pushed on 2025-02-03 (repository created 2023-07-20).

Project Overview

AI Homed tracks it on the AI Video Projects board and on the AI AI Video Projects list.

GitHub Repository Details

Repository omerbt/TokenFlow · default branch master · size 28746 KB · watchers 70 · source: GitHub REST API and repository README

README

TokenFlow: Consistent Diffusion Features for Consistent Video Editing (ICLR 2024)

[Project Page]

arXiv Hugging Face Spaces Pytorch

[//]: # ([![Replicate](https://replicate.com/cjwbw/multidiffusion/badge)](https://replicate.com/cjwbw/multidiffusion))

[//]: # ([![Hugging Face Spaces](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue)](https://huggingface.co/spaces/weizmannscience/text2live))

https://github.com/omerbt/TokenFlow/assets/52277000/93dccd63-7e9a-4540-a941-31962361b0bb

TokenFlow is a framework that enables consistent video editing, using a pre-trained text-to-image diffusion model, without any further training or finetuning.

[//]: # (as described in (link to paper).)

[//]: # (. It can be used for localized and global edits that change the texture of existing objects or augment the scene with semi-transparent effects (e.g. smoke, fire, snow).)

[//]: # (### Abstract)

The generative AI revolution has been recently expanded to videos. Nevertheless, current state-of-the-art video mod- els are still lagging behind image models in terms of visual quality and user control over the generated content. In this work, we present a framework that harnesses the power of a text-to-image diffusion model for the task of text-driven video editing. Specifically, given a source video and a target text-prompt, our method generates a high-quality video that adheres to the target text, while preserving the spatial lay- out and dynamics of the input video. Our method is based on our key observation that consistency in the edited video can be obtained by enforcing consistency in the diffusion feature space. We achieve this by explicitly propagating diffusion features based on inter-frame correspondences, readily available in the model. Thus, our framework does not require any training or fine-tuning, and can work in con- junction with any off-the-shelf text-to-image editing method. We demonstrate state-of-the-art editing results on a variety of real-world videos.

For more see the project webpage.

Sample results

Image from the project README

Environment

conda create -n tokenflow python=3.9
conda activate tokenflow
pip install -r requirements.txt

Preprocess

Preprocess you video by running using the following command:

python preprocess.py --data_path  \
                     --inversion_prompt <'' or a string describing the video content>
Additional arguments:
                     --save_dir 
                     --H 
more information on the arguments can be found here.

Note:

The video reconstruction will be saved as inverted.mp4. A good reconstruction is required for successfull editing with our method.

Editing

To edit your video, first create a yaml config as in `configs/config_pnp.yaml`. Then run
python run_tokenflow_pnp.py

Similarly, if you want to use ControlNet or SDEedit, create a yaml config as in `config/config_controlnet.yaml or `configs/config_SDEdit.yaml` and run `python run_tokenflow_controlnet.py` or python run_tokenflow_SDEdit.py` respectivly.

Citation

@article{tokenflow2023,
        title = {TokenFlow: Consistent Diffusion Features for Consistent Video Editing},
        author = {Geyer, Michal and Bar-Tal, Omer and Bagon, Shai and Dekel, Tali},
        journal={arXiv preprint arxiv:2307.10373},
        year={2023}
        }

GitHub Stars & Activity

1,707Stars
143Forks
41Open issues
PythonLanguage

GitHub Popularity

GitHub stars1,707
Forks143
Open issues41
Primary languagePython
LicenseMIT
Stars gained today0
Created2023-07-20
Last pushed2025-02-03

Trending History

Trending statusnot on today's boards

Related AI Projects

1

calesthio / OpenMontage

Python★ 69,490⑂ 0
→
2

ATH-MaaS / Pixelle-Video

Python★ 29,138⑂ 0
→
3

KlingAIResearch / LivePortrait

Python★ 19,258⑂ 0
→
4

Wan-Video / Wan2.2

Python★ 18,004⑂ 0
→
5

latent-spaces / brag

Python★ 16,683⑂ 0
→
6

Zulko / moviepy

Python★ 15,004⑂ 0
→
7

zai-org / CogVideo

Python★ 13,085⑂ 0
→
8

HKUDS / ViMax

Python★ 12,683⑂ 0
→

More AI Rankings