This repository is the official implementation of Gen-L-Video.
You might be interested in Gen-L^2, which works better.
TL;DR: A <font color=#FF2000> universal</font> methodology that extends short video diffusion models for efficient <font color=#FF2000>multi-text conditioned long video</font> generation and editing.
Current methodologies for video generation and editing, while innovative, are often confined to extremely short videos (typically less than 24 frames) and are limited to a single text condition. These constraints significantly limit their applications given that real-world videos usually consist of multiple segments, each bearing different semantic information. To address this challenge, we introduce a novel paradigm dubbed as Gen-L-Video capable of extending off-the-shelf short video diffusion models for generating and editing videos comprising hundreds of frames with diverse semantic segments without introducing additional training, all while preserving content consistency.
<p align="center"> <img src="./statics/imgs/lvdm.png" width="1080px"/> <br> <em>Essentially, this procedure establishes an abstract long video generator and editor without necessitating any additional training, enabling the generation and editing of videos of any length using established short video generation and editing methodologies.</em> </p>git clone https://github.com/G-U-N/Gen-L-Video cd Gen-L-Video # The repo might be too large to clone because many long gifs are over 100 M. Fork the repo, delete the statics, and then clone it.
conda env create -f requirements.yml conda activate glv conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.6 -c pytorch -c nvidia
# (Optional) Makes the build much faster pip install ninja # Set TORCH_CUDA_ARCH_LIST if running and building on different GPU types pip install -v -U git+https://github.com/facebookresearch/xformers.git@main#egg=xformers # (this can take dozens of minutes)
pip install git+https://github.com/facebookresearch/segment-anything.git pip install git+https://github.com/IDEA-Research/GroundingDINO.git
or
git clone https://github.com/facebookresearch/segment-anything.git cd segment-anything pip install -e . cd .. # If you have a CUDA environment, please make sure the environment variable CUDA_HOME is set. # If the cuda version of the system conflicts with the cudatoolkit version, See: https://github.com/G-U-N/Gen-L-Video/discussions/7 git clone https://github.com/IDEA-Research/GroundingDINO.git cd GroundingDINO pip install -e .
Note that if you are using GPU clusters that the management node has no access to GPU resources, you should submit the pip install -e . to the computing node as a computing task when building the GroundingDINO. Otherwise, it will not support detection computing through GPU.
Make sure git-lfs is available. See: https://github.com/git-lfs/git-lfs/blob/main/INSTALLING.md
bash scripts/download_pretrained_models.sh
After downloading them, you should specify the absolute/relative path of them in the config files.
If you download all the above pretrained weights in the folder weights , set the configs files as follows:
configs/tuning-free-inpaint/girl-glass.yamlsam_checkpoint: "weights/sam_vit_h_4b8939.pth" groundingdino_checkpoint: "weights/groundingdino_swinb_cogcoor.pth" controlnet_path: "weights/edit-anything-v0-3"
one-shot-tuning.py, setadapter_paths={ "pose":"weights/T2I-Adapter/models/t2iadapter_openpose_sd14v1.pth", "sketch":"weights/T2I-Adapter/models/t2iadapter_sketch_sd14v1.pth", "seg": "weights/T2I-Adapter/models/t2iadapter_seg_sd14v1.pth", "depth":"weights/T2I-Adapter/models/t2iadapter_depth_sd14v1.pth", "canny":"weights/T2I-Adapter/models/t2iadapter_canny_sd14v1.pth" }
configs/one-shot-tuning/hike.yaml, setpretrained_model_path: "weights/anything-v4.0"
Then all the other weights are able to be automatically downloaded through the API of Hugging Face.
Here is an additional instruction for installing and running grounding dino.
# Notice: If you use 'pip install git+https://github.com/IDEA-Research/GroundingDINO.git' # You should modify GroundingDINO_SwinB_cfg.py in python site-packages directory # e.g. ~/miniconda3/envs/glv/lib/python3.8/site-packages/groundingdino/config/GroundingDINO_SwinB_cfg.py cd GroundingDINO/groundingdino/config/ vim GroundingDINO_SwinB_cfg.py
set
text_encoder_type = "[Your Path]/bert-base-uncased"
Then
vim GroundingDINO/groundingdino/util/get_tokenlizer.py
Set
def get_pretrained_language_model(text_encoder_type): if text_encoder_type == "bert-base-uncased" or text_encoder_type.split("/")[-1]=="bert-base-uncased": return BertModel.from_pretrained(text_encoder_type) if text_encoder_type == "roberta-base": return RobertaModel.from_pretrained(text_encoder_type) raise ValueError("Unknown text_encoder_type {}".format(text_encoder_type))
Now you should be able to run your Grounding DINO with pre-downloaded bert weights.
git clone https://github.com/lllyasviel/ControlNet.git cd ControlNet git checkout f4748e3 mv ../process_data.py . python process_data.py --v_path=../data --t_path=../t_data --c_path=../c_data --fps=10
accelerate launch one-shot-tuning.py --control=[your control]
[your control] can be set as pose , depth, seg, sketch, canny.
pose and depth are recommended.
accelerate launch tuning-free-mix.py
accelerate launch tuning-free-inpaint.py
accelerate launch follow-your-pose-long.py
# canny accelerate launch tuning-free-control.py --config=./configs/tuning-free-control/girl-glass.yaml # hed accelerate launch tuning-free-control.py --config=./configs/tuning-free-control/girl.yaml
Most of the results can be generated with a single RTX 3090.
https://github.com/G-U-N/Gen-L-Video/assets/60997859/9b370894-708a-4ed2-a2ac-abfa93829ea6
This video containing clips bearing various semantic information.
<img src="./statics/imgs/example.png" width=800px>All the following videos are directly generated with the pretrained Stable Diffusion weight without additional training.
<table class="center"> <tr> <td style="text-align:center;" colspan="4"><b>Videos with Smooth Semantic Changes</b></td> </tr> <tr> <td><img src="./statics/gifs/boat-walk-mix.gif"></td> <td><img src="./statics/gifs/car-turn-beach-mix.gif"></td> <td><img src="./statics/gifs/lion-cat-mix.gif"></td> <td><img src="./statics/gifs/surf-skiing-mix.gif"></td> </tr> <tr> <td width=25% style="text-align:center;">"A man is boating, village." → "A man is walking by, city, sunset."</td> <td width=25% style="text-align:center;">"A jeep car is running on the beach, sunny.” → "a jeep car is running on the beach, night."</td> <td width=25% style="text-align:center;">"Lion, Grass, Rainy." → "Cat, Grass, Sun." </td> <td width=25% style="text-align:center;">"A man is skiing in the sea." → "A man is surfing in the snow."</td> </tr> </table>All the following videos are directly generated with the pretrained Stable Diffusion weight without additional training.
<table class="center"> <tr> <td style="text-align:center;" colspan="4"><b>Edit Anything in Videos</b></td> </tr> <tr> <td><img src="./statics/gifs/girl-glass-source.gif"></td> <td><img src="./statics/gifs/girl-glass-mask.gif"></td> <td><img src="./statics/gifs/girl-glass-pink.gif"></td> <td><img src="./statics/gifs/girl-glass-cyberpunk.gif"></td> </tr> <tr> <td width=25% style="text-align:center;">Source Video</td> <td width=25% style="text-align:center;">Mask of Sunglasses</td> <td width=25% style="text-align:center;">"Sunglasses" → "Pink Sunglasses" </td> <td width=25% style="text-align:center;">"Sunglasses" → "Cyberpunk Sunglasses with Neon Lights"</td> </tr> <tr> <td><img src="./statics/gifs/man-surfing-source.gif"></td> <td><img src="./statics/gifs/man-surfing-mask.gif"></td> <td><img src="./statics/gifs/man-surfing-batman.gif"></td> <td><img src="./statics/gifs/man-surfing-ironman.gif"></td> </tr> <tr> <td width=25% style="text-align:center;">Source Video</td> <td width=25% style="text-align:center;">Mask of Man</td> <td width=25% style="text-align:center;">"Man" → "Bat Man" </td> <td width=25% style="text-align:center;">"Man" → "Iron Man"</td> </tr> </table>All the following videos are directly generated with the pre-trained VideoCrafter without additional training.
<table class="center"> <tr> <td style="text-align:center;" colspan="4"><b>Long Video Generation with Pretrained Short Text-to-Video Diffusion Model</b></td> </tr> <tr> <td><img src="./statics/gifs/ride-horse-iso-1.gif"></td> <td><img src="./statics/gifs/ride-horse-2.gif"></td> <td><img src="./statics/gifs/ride-horse-iso-2.gif"></td> <td><img src="./statics/gifs/ride-horse-4.gif"></td> </tr> <tr> <td width=25% style="text-align:center;"> "Astronaut riding a horse." (Isolated)</td> <td width=25% style="text-align:center;">"Astronaut riding a horse." (Gen-L-Video)</td> <td width=25% style="text-align:center;">"Astronaut riding a horse, Loving Vincent Style." (Isolated)</td> <td width=25% style="text-align:center;">"Astronaut riding a horse, Loving Vincent Style." (Gen-L-Video)</td> </tr> <tr> <td><img src="./statics/gifs/monkey-drinking-iso.gif"></td> <td><img src="./statics/gifs/monkey-drinking.gif"></td> <td><img src="./statics/gifs/car-moving-iso.gif"></td> <td><img src="./statics/gifs/car-moving.gif"></td> </tr> <tr> <td width=25% style="text-align:center;">"A monkey is drinking water." (Isolated)</td> <td width=25% style="text-align:center;">"A monkey

免费创建高清无水印Sora视频
Vora是一个免费创建高清无水印Sora视频的AI工具


最适合小白的AI自动化工作流平台
无需编码,轻松生成可复用、可变现的AI自动化工作流

大模型驱动的Excel数据处理工具
基于大模型交互的表格处理系统,允许用户通过对话方式完成数据整理和可视化分析。系统采用机器学习算法解析用户指令,自动执行排序、公式计算和数据透视等操作,支持多种文件格式导入导出。数据处理响应速度保持在0.8秒以内,支持超过100万行数据的即时分析。


AI辅助编程,代码自动修复
Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。


AI论文写作指导平台
AIWritePaper论文写作是一站式AI论文写作辅助工具,简化了选题、文献检索至论文撰写的整个过程。通过简单设定,平台可快速生成高质量论文大纲和全文,配合图表、参考文献等一应俱全,同时提供开题报告和答辩PPT等增值服务,保障数据安全,有效提升写作效率和论文质量。


AI一键生成PPT,就用博思AIPPT!
博思AIPPT,新一代的AI生成PPT平台,支持智能生成PPT、AI美化PPT、文本&链接生成PPT、导入Word/PDF/Markdown文档生成PPT等,内置海量精美PPT模板,涵盖商务、教育、科技等不同风格,同时针对每个页面提供多种版式,一键自适应切换,完美适配各种办公场景。


AI赋能电商视觉革命,一站式智能商拍平台
潮际好麦深耕服装行业,是国内AI试衣效果最好的软件。使用先进AIGC能力为电商卖家批量提供优质的、低成本的商拍图。合作品牌有Shein、Lazada、安踏、百丽等65个国内外头部品牌,以及国内10万+淘宝、天猫、京东等主流平台的品牌商家,为卖家节省将近85%的出图成本,提升约3倍出图效率,让品牌能够快速上架。


企业专属的AI法律顾问
iTerms是法大大集团旗下法律子品牌,基于最先进的大语言模型(LLM)、专业的法律知识库和强大的智能体架构,帮助企业扫清合规障碍,筑牢风控防线,成为您企业专属的AI法律顾问。


稳定高效的流量提升解决方 案,助力品牌曝光
稳定高效的流量提升解决方案,助力品牌曝光


最新版Sora2模型免费使用,一键生成无水印视频
最新版Sora2模型免费使用,一键生成无水印视频
最新AI工具、AI资讯
独家AI资源、AI项目落地

微信扫一扫关注公众号