Upload folder using huggingface_hub
Browse files- .msc +0 -0
- .mv +1 -0
- README.md +56 -0
- _cover_images_/image_0_fix.jpg +0 -0
- _cover_images_/image_14_fix.jpg +0 -0
- _cover_images_/image_1_fix.jpg +0 -0
- _cover_images_/image_2_fix.jpg +0 -0
- _cover_images_/image_3_fix.jpg +0 -0
- _cover_images_/image_6_fix.jpg +0 -0
- assets/image_0.jpg +0 -0
- assets/image_0_fix.jpg +0 -0
- assets/image_1.jpg +0 -0
- assets/image_14.jpg +0 -0
- assets/image_14_fix.jpg +0 -0
- assets/image_1_fix.jpg +0 -0
- assets/image_2.jpg +0 -0
- assets/image_2_fix.jpg +0 -0
- assets/image_3.jpg +0 -0
- assets/image_3_fix.jpg +0 -0
- assets/image_6.jpg +0 -0
- assets/image_6_fix.jpg +0 -0
- configuration.json +6 -0
- model.safetensors +3 -0
.msc
ADDED
|
Binary file (1.63 kB). View file
|
|
|
.mv
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Revision:master,CreatedAt:1751625321
|
README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 高分辨率修复 - Kontext 图像编辑 LoRA
|
| 2 |
+
|
| 3 |
+
## 模型介绍
|
| 4 |
+
|
| 5 |
+
本 LoRA 模型是基于 [Kontext](https://www.modelscope.cn/models/black-forest-labs/FLUX.1-Kontext-dev) 模型和 [DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio) 训练的 LoRA 模型,使用本模型后,可输入指令 `Improve the clarity.` 提高图像的清晰度。
|
| 6 |
+
|
| 7 |
+
## 模型效果
|
| 8 |
+
|
| 9 |
+
||样例 1|样例 2|样例 3|
|
| 10 |
+
|-|-|-|-|
|
| 11 |
+
|原图||||
|
| 12 |
+
|生成图||||
|
| 13 |
+
|
| 14 |
+
||样例 4|样例 5|样例 6 (是的,可以处理正常图片)|
|
| 15 |
+
|-|-|-|-|
|
| 16 |
+
|原图||||
|
| 17 |
+
|生成图||||
|
| 18 |
+
|
| 19 |
+
## 使用说明
|
| 20 |
+
|
| 21 |
+
本模型基于框架 [DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio/tree/main/examples/flux) 训练,请先安装
|
| 22 |
+
|
| 23 |
+
```
|
| 24 |
+
git clone https://github.com/modelscope/DiffSynth-Studio.git
|
| 25 |
+
cd DiffSynth-Studio
|
| 26 |
+
pip install -e .
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
```python
|
| 30 |
+
import torch
|
| 31 |
+
from diffsynth.pipelines.flux_image_new import FluxImagePipeline, ModelConfig
|
| 32 |
+
from PIL import Image
|
| 33 |
+
from modelscope import snapshot_download
|
| 34 |
+
|
| 35 |
+
snapshot_download("DiffSynth-Studio/FLUX.1-Kontext-dev-lora-highresfix", cache_dir="./models")
|
| 36 |
+
pipe = FluxImagePipeline.from_pretrained(
|
| 37 |
+
torch_dtype=torch.bfloat16,
|
| 38 |
+
device="cuda",
|
| 39 |
+
model_configs=[
|
| 40 |
+
ModelConfig(model_id="black-forest-labs/FLUX.1-Kontext-dev", origin_file_pattern="flux1-kontext-dev.safetensors"),
|
| 41 |
+
ModelConfig(model_id="black-forest-labs/FLUX.1-dev", origin_file_pattern="text_encoder/model.safetensors"),
|
| 42 |
+
ModelConfig(model_id="black-forest-labs/FLUX.1-dev", origin_file_pattern="text_encoder_2/"),
|
| 43 |
+
ModelConfig(model_id="black-forest-labs/FLUX.1-dev", origin_file_pattern="ae.safetensors"),
|
| 44 |
+
],
|
| 45 |
+
)
|
| 46 |
+
pipe.load_lora(pipe.dit, "models/DiffSynth-Studio/FLUX.1-Kontext-dev-lora-highresfix/model.safetensors", alpha=1)
|
| 47 |
+
|
| 48 |
+
image = Image.open("your_image.jpg")
|
| 49 |
+
image = pipe(
|
| 50 |
+
prompt="Improve the clarity.",
|
| 51 |
+
kontext_images=image,
|
| 52 |
+
embedded_guidance=2.5,
|
| 53 |
+
seed=0,
|
| 54 |
+
)
|
| 55 |
+
image.save("output.jpg")
|
| 56 |
+
```
|
_cover_images_/image_0_fix.jpg
ADDED
|
_cover_images_/image_14_fix.jpg
ADDED
|
_cover_images_/image_1_fix.jpg
ADDED
|
_cover_images_/image_2_fix.jpg
ADDED
|
_cover_images_/image_3_fix.jpg
ADDED
|
_cover_images_/image_6_fix.jpg
ADDED
|
assets/image_0.jpg
ADDED
|
assets/image_0_fix.jpg
ADDED
|
assets/image_1.jpg
ADDED
|
assets/image_14.jpg
ADDED
|
assets/image_14_fix.jpg
ADDED
|
assets/image_1_fix.jpg
ADDED
|
assets/image_2.jpg
ADDED
|
assets/image_2_fix.jpg
ADDED
|
assets/image_3.jpg
ADDED
|
assets/image_3_fix.jpg
ADDED
|
assets/image_6.jpg
ADDED
|
assets/image_6_fix.jpg
ADDED
|
configuration.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"aigc_model": true,
|
| 3 |
+
"model_file_location": "model.safetensors",
|
| 4 |
+
"framework": "Pytorch",
|
| 5 |
+
"task": "other"
|
| 6 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:099984965d92bebee7cd2619536e5bdb9b395a93f76a3903c966d023c51180a9
|
| 3 |
+
size 306423688
|