| --- |
| frameworks: |
| - Pytorch |
| license: Apache License 2.0 |
| tasks: |
| - text-to-image-synthesis |
|
|
| |
| |
| |
|
|
| |
| |
| |
|
|
| |
| |
| |
|
|
| |
| |
| |
|
|
| |
| |
| |
|
|
| |
| |
| |
| --- |
| # AttriCtrl 数值型生图控制模型 |
|
|
| ## 简介 |
|
|
| AttriCtrl 可以实现数值型图像指标的生图控制。 |
|
|
| 更多细节请参考我们的论文: [AttriCtrl: Fine-Grained Control of Aesthetic Attribute Intensity in Diffusion Models](https://arxiv.org/abs/2508.02151) |
|
|
| ## 效果展示 |
|
|
| ### 亮度(Brightness) |
|
|
| |scale = 0.1|scale = 0.3|scale = 0.5|scale = 0.7|scale = 0.9| |
| |-|-|-|-|-| |
| |||||| |
|
|
| ### 细节(Detail) |
|
|
| |scale = 0.1|scale = 0.3|scale = 0.5|scale = 0.7|scale = 0.9| |
| |-|-|-|-|-| |
| |||||| |
|
|
| ### 摄影感(Realism) |
|
|
| |scale = 0.1|scale = 0.3|scale = 0.5|scale = 0.7|scale = 0.9| |
| |-|-|-|-|-| |
| |||||| |
|
|
| ## 推理代码 |
|
|
| ```shell |
| git clone https://github.com/modelscope/DiffSynth-Studio.git |
| cd DiffSynth-Studio |
| pip install -e . |
| ``` |
|
|
| ```python |
| import torch |
| from diffsynth.pipelines.flux_image_new import FluxImagePipeline, ModelConfig |
| |
| |
| pipe = FluxImagePipeline.from_pretrained( |
| torch_dtype=torch.bfloat16, |
| device="cuda", |
| model_configs=[ |
| ModelConfig(model_id="black-forest-labs/FLUX.1-dev", origin_file_pattern="flux1-dev.safetensors"), |
| ModelConfig(model_id="black-forest-labs/FLUX.1-dev", origin_file_pattern="text_encoder/model.safetensors"), |
| ModelConfig(model_id="black-forest-labs/FLUX.1-dev", origin_file_pattern="text_encoder_2/"), |
| ModelConfig(model_id="black-forest-labs/FLUX.1-dev", origin_file_pattern="ae.safetensors"), |
| ModelConfig(model_id="DiffSynth-Studio/AttriCtrl-FLUX.1-Dev", origin_file_pattern="models/detail.safetensors") |
| ], |
| ) |
| |
| for i in [0.1, 0.3, 0.5, 0.7, 0.9]: |
| image = pipe(prompt="a cat on the beach", seed=2, value_controller_inputs=[i]) |
| image.save(f"value_control_{i}.jpg") |
| ``` |
|
|