🚀 openpose controlnet for flux.dev
这是一个用于flux.dev的openpose controlnet,基于Transformer架构,可用于图像生成。它在特定数据集上进行训练,能与xlabs ai pipeline集成,实现高质量的图像生成。
🚀 快速开始
本项目是用于flux.dev的openpose controlnet,在https://huggingface.co/datasets/raulc0399/open_pose_controlnet 数据集上进行训练。控制网络模型是为xlabs ai pipeline(https://github.com/XLabs-AI/x-flux )训练的。
📦 安装指南
要安装该pipeline,请执行以下命令:
git clone https://github.com/XLabs-AI/x-flux.git
cd x-flux
python3 -m venv xflux_env
source xflux_env/bin/activate
pip install -r requirements.txt
💻 使用示例
基础用法
要使用controlnet运行pipeline,请执行以下命令:
python3 main.py \
--prompt "person enjoying a day at the park, full hd, cinematic" \
--image ~/open_pose_controlnet_dataset/validation_images/pose/3_pose_1024.jpg --control_type openpose \
--local_path ./model.safetensors \
--use_controlnet --model_type flux-dev \
--width 1024 --height 1024 --timestep_to_start_cfg 2 \
--num_steps 50 --true_gs 4 --guidance 4 \
--save_path ~/gen_imgs
高级用法
如果图像已经过预处理,请注释掉src/flux/xflux_pipeline.py文件中的第146行:
📚 详细文档
训练步骤
oxen clone https://hub.oxen.ai/raulc/open_pose_controlnet_dataset
git clone https://github.com/raulc0399/x-flux.git
cd x-flux
git checkout open_pose_training
python3 -m venv xflux_env
source xflux_env/bin/activate
pip install -r requirements.txt
huggingface-cli login
accelerate config
mkdir images
rsync -r ~/open_pose_controlnet_dataset/train/images/ images/
cp train_configs/test_openpose_controlnet.yaml train_configs/openpose_controlnet.yaml
accelerate launch train_flux_deepspeed_controlnet.py --config "train_configs/openpose_controlnet.yaml"
⚠️ 重要提示
- 在开始训练前,请检查train_configs/openpose_controlnet.yaml文件。
- 需要使用rsync命令,cp命令在处理大量文件时可能无法正常工作。
- oxen仓库中的字幕文件为json格式,这是训练脚本所期望的格式。
训练结果
使用以下两张控制图像:

搭配以下提示词:
- "two friends sitting by each other enjoying a day at the park, full hd, cinematic"
- "person enjoying a day at the park, full hd, cinematic"
生成了以下结果图像:

📄 许可证
模型权重遵循 FLUX.1 [dev] 非商业许可证。