Story-Adapter开源项目使用教程

Story-Adapter开源项目使用教程

story-adapter A Training-free Iterative Framework for Long Story Visualization story-adapter 项目地址: https://gitcode.com/gh_mirrors/st/story-adapter

1. 项目介绍

Story-Adapter是一个由UCSC-VLAA团队开发的,用于长故事可视化的无训练迭代框架。该框架通过利用文本提示以及之前迭代中生成的所有图像,迭代地优化每张生成的图像。它的核心是一个无需训练的全局参考交叉注意力模块,该模块通过全局嵌入聚合所有之前迭代的生成图像信息,以保持整个故事的语义一致性,同时最小化计算成本。

2. 项目快速启动

环境准备

  • Python 3.10.14
  • PyTorch 2.2.2
  • CUDA 12.1
  • cuDNN 8.9.02

克隆项目

git clone https://github.com/UCSC-VLAA/story-adapter.git
cd story-adapter

创建虚拟环境并安装依赖

conda create -n StoryAdapter python=3.10
conda activate StoryAdapter
pip install -r requirements.txt

下载预训练模型

  • 下载RealVisXL_V4.0模型并放入./RealVisXL_V4.0目录
  • 下载clip_image_encoder模型并放入./IP-Adapter/sdxl_models/image_encoder目录
  • 下载ip-adapter_sdxl.bin模型并放入./IP-Adapter/sdxl_models/目录

运行示例

python run.py --base_model_path ./RealVisXL_V4.0 --image_encoder_path ./IP-Adapter/sdxl_models/image_encoder --ip_ckpt ./IP-Adapter/sdxl_models/ip-adapter_sdxl.bin

自定义故事运行

python run.py --base_model_path ./RealVisXL_V4.0 --image_encoder_path ./IP-Adapter/sdxl_models/image_encoder --ip_ckpt ./IP-Adapter/sdxl_models/ip-adapter_sdxl.bin --story "自定义故事提示1" "自定义故事提示2" "自定义故事提示3" ... "自定义故事提示N"

注意:为了更好的故事可视化效果,建议使用模板[角色定义 + 交互定义 + 场景定义]来构建自定义故事提示。

3. 应用案例和最佳实践

不同的风格运行

漫画风格
python run.py --base_model_path ./RealVisXL_V4.0 --image_encoder_path ./IP-Adapter/sdxl_models/image_encoder --ip_ckpt ./IP-Adapter/sdxl_models/ip-adapter_sdxl.bin --style comic
电影风格
python run.py --base_model_path ./RealVisXL_V4.0 --image_encoder_path ./IP-Adapter/sdxl_models/image_encoder --ip_ckpt ./IP-Adapter/sdxl_models/ip-adapter_sdxl.bin --style film
现实风格
python run.py --base_model_path ./RealVisXL_V4.0 --image_encoder_path ./IP-Adapter/sdxl_models/image_encoder --ip_ckpt ./IP-Adapter/sdxl_models/ip-adapter_sdxl.bin --style realistic

4. 典型生态项目

  • stablediffusion: 用于生成高质量图像的稳定扩散模型
  • clip: 开源的图像和文本处理库
  • ip-adapter: 用于图像处理的适配器模块
  • storygen: 故事生成工具
  • storydiffusion: 基于扩散模型的故事生成
  • theatergen: 剧院场景生成工具
  • timm: 一个用于图像模型快速实验的库

story-adapter A Training-free Iterative Framework for Long Story Visualization story-adapter 项目地址: https://gitcode.com/gh_mirrors/st/story-adapter

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

梅颖庚Sheridan

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值