File size: 3,194 Bytes
59ea5fa |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
---
base_model: MusePublic/FLUX.1-Kontext-Dev@v1
cover_images:
- _cover_images_/26_blingbling.jpg
- _cover_images_/9_blingbling.jpg
- _cover_images_/6_blingbling.jpg
- _cover_images_/12_blingbling.jpg
- _cover_images_/15_blingbling.jpg
- _cover_images_/5_blingbling.jpg
- _cover_images_/11_blingbling.jpg
frameworks:
- Pytorch
license: Apache License 2.0
tags:
- LoRA
- text-to-image
tasks:
- text-to-image-synthesis
vision_foundation: FLUX_1
#model-type:
##如 gpt、phi、llama、chatglm、baichuan 等
#- gpt
#domain:
##如 nlp、cv、audio、multi-modal
#- nlp
#language:
##语言代码列表 https://help.aliyun.com/document_detail/215387.html?spm=a2c4g.11186623.0.0.9f8d7467kni6Aa
#- cn
#metrics:
##如 CIDEr、Blue、ROUGE 等
#- CIDEr
#tags:
##各种自定义,包括 pretrained、fine-tuned、instruction-tuned、RL-tuned 等训练方法和其他
#- pretrained
#tools:
##如 vllm、fastchat、llamacpp、AdaSeq 等
#- vllm
---
# 玻璃雕像 - Kontext 图像编辑 LoRA
## 模型介绍
本 LoRA 模型是基于 [Kontext](https://www.modelscope.cn/models/black-forest-labs/FLUX.1-Kontext-dev) 模型和 [DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio) 训练的 LoRA 模型,使用本模型后,可输入指令 `Transform into a glass sculpture.` 将画面中的主体内容转换为晶莹的玻璃雕像。
## 模型效果
||样例 1|样例 2|样例 3|
|-|-|-|-|
|原图||||
|生成图||||
||样例 4|样例 5|样例 6|
|-|-|-|-|
|原图||||
|生成图||||
## 使用说明
本模型基于框架 [DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio/tree/main/examples/flux) 训练,请先安装
```
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
from PIL import Image
from modelscope import snapshot_download
snapshot_download("DiffSynth-Studio/FLUX.1-Kontext-dev-lora-blingbling", cache_dir="./models")
pipe = FluxImagePipeline.from_pretrained(
torch_dtype=torch.bfloat16,
device="cuda",
model_configs=[
ModelConfig(model_id="black-forest-labs/FLUX.1-Kontext-dev", origin_file_pattern="flux1-kontext-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"),
],
)
pipe.load_lora(pipe.dit, "models/DiffSynth-Studio/FLUX.1-Kontext-dev-lora-blingbling/model.safetensors", alpha=1)
image = Image.open("your_image.jpg")
image = pipe(
prompt="Transform into a glass sculpture.",
kontext_images=image,
embedded_guidance=2.5,
seed=0,
)
image.save("output.jpg")
``` |