DreamBench++ 安装与配置指南
dreambench_plus 项目地址: https://gitcode.com/gh_mirrors/dr/dreambench_plus
1. 项目基础介绍
DreamBench++ 是一个针对个性化图像生成任务的人类对齐基准。它包含了一个多样化的图像集和包含简单、风格化和想象性内容的提示语集。项目使用多模态大型语言模型来构建与人类偏好对齐的自动化评估指标。
本项目的主要编程语言是 Python。
2. 关键技术和框架
- 多模态大型语言模型:用于构建自动化评估指标,与人类偏好对齐。
- 图像生成:使用先进的图像生成技术,例如 DreamBooth 或 Textual Inversion。
- 评估工具:DINO 和 CLIP,用于评估生成图像的质量。
- GPT 模型:用于对生成的图像进行评分。
3. 安装和配置
准备工作
在开始安装之前,请确保您的系统中已安装以下依赖:
- Python 3.8 或更高版本
- Git
- pip
安装步骤
-
克隆项目仓库:
git clone https://github.com/yuangpeng/dreambench_plus.git
-
进入项目目录:
cd dreambench_plus
-
安装项目依赖:
pip install -e .
-
(可选)如果您想评估 DreamBooth 或 Textual Inversion,首先需要在 DreamBench++ 样本上进行训练:
python dreambench_plus/generate_models.py \ --method dreambooth_sd \ --start 0 --end 150
-
生成图像:
torchrun dreambench_plus/generate_images.py \ --method blip_diffusion \ --use_default_params True
如果您想使用其他超参数进行推理,可以通过运行
torchrun dreambench_plus/generate_images.py --help
查询所有参数列表。 -
(可选)使用多 GPU 并行推理,例如,以下命令可在一台具有 8 个 GPU 的单节点上加速推理:
torchrun --nproc-per-node=8 dreambench_plus/generate_images.py \ --method blip_diffusion \ --use_default_params True
-
评估生成图像:
-
使用 DINO 和 CLIP 进行评估:
torchrun --nproc-per-node=8 dreambench_plus/eval_clip_and_dino.py --dir samples/blip_diffusion_gs7_5_step100_seed42_torch_float16
-
使用 GPT 进行评估:
首先,在
dreambench_plus/constants.py
文件中的METHODS
变量中写入方法和相应生成图像的目录,并填写您的 openai api 密钥。然后运行以下命令:python --method "DreamBooth LoRA SDXL" \ --out_dir data_gpt_rating/concept_preservation_full/dreambooth_lora_sdxl \ --category subject \ --ablation_settings full
运行上述命令后,您可以在
out_dir
目录中获得 GPT 评分结果。然后,运行以下命令获取最终分数:python dreambench_plus/benchmarking.py
-
以上就是 DreamBench++ 的详细安装和配置指南。按照上述步骤操作,您应该能够成功安装该项目并开始使用。
dreambench_plus 项目地址: https://gitcode.com/gh_mirrors/dr/dreambench_plus
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考