# 超现实、奇幻妆造
本模型使用 [**Qwen-Image-i2L**](https://modelscope.ai/models/DiffSynth-Studio/Qwen-Image-i2L) 从 6 张图像生成。
## 安装
```bash
git clone https://github.com/modelscope/DiffSynth-Studio.git
cd DiffSynth-Studio
pip install -e .
```
## 使用本模型
```python
from modelscope import snapshot_download
from diffsynth.pipelines.qwen_image import QwenImagePipeline, ModelConfig
import torch
vram_config = {
"offload_dtype": "disk",
"offload_device": "disk",
"onload_dtype": torch.bfloat16,
"onload_device": "cpu",
"preparing_dtype": torch.bfloat16,
"preparing_device": "cuda",
"computation_dtype": torch.bfloat16,
"computation_device": "cuda",
}
pipe = QwenImagePipeline.from_pretrained(
torch_dtype=torch.bfloat16,
device="cuda",
model_configs=[
ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="transformer/diffusion_pytorch_model*.safetensors", **vram_config),
ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="text_encoder/model*.safetensors", **vram_config),
ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="vae/diffusion_pytorch_model.safetensors", **vram_config),
],
tokenizer_config=ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="tokenizer/"),
vram_limit=torch.cuda.mem_get_info("cuda")[1] / (1024 ** 3) - 0.5,
)
lora_path = snapshot_download(model_id="diffsynth-i2L-gallery/Qwen-Image-surrealism-fantasy_makeup-c184")
pipe.load_lora(pipe.dit, f"{lora_path}/model.safetensors")
image = pipe("超现实主义风格的奇幻人像,面部被艺术化改造为猫脸特征(四只大眼睛、猫鼻、胡须纹样),搭配夸张头饰与羽毛装饰,梦幻柔焦滤镜,高饱和度色彩,低角度仰拍或特写构图", seed=0, height=1024, width=1024, num_inference_steps=50)
image.save("image.jpg")
```
## 相关链接
- i2L 模型:https://modelscope.ai/models/DiffSynth-Studio/Qwen-Image-i2L
- 代码仓库:https://github.com/modelscope/DiffSynth-Studio
## License
Apache-2.0
Description
本模型由 Image-to-LoRA 模型生成:https://modelscope.ai/models/DiffSynth-Studio/Qwen-Image-i2L
