Spaces:
Build error
Build error
update
Browse files- app.py +1 -3
- configs/generate_diffree.yaml +119 -0
app.py
CHANGED
|
@@ -388,6 +388,4 @@ with gr.Blocks(css="footer {visibility: hidden}") as demo:
|
|
| 388 |
# demo.launch(share=True)
|
| 389 |
|
| 390 |
|
| 391 |
-
|
| 392 |
-
demo.queue(concurrency_count=1)
|
| 393 |
-
demo.launch(share=False)
|
|
|
|
| 388 |
# demo.launch(share=True)
|
| 389 |
|
| 390 |
|
| 391 |
+
demo.queue().launch()
|
|
|
|
|
|
configs/generate_diffree.yaml
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File modified by authors of InstructPix2Pix from original (https://github.com/CompVis/stable-diffusion).
|
| 2 |
+
# See more details in LICENSE.
|
| 3 |
+
|
| 4 |
+
model:
|
| 5 |
+
base_learning_rate: 5.0e-05
|
| 6 |
+
target: ldm.models.diffusion.ddpm_diffree.LatentDiffusion
|
| 7 |
+
params:
|
| 8 |
+
linear_start: 0.00085
|
| 9 |
+
linear_end: 0.0120
|
| 10 |
+
num_timesteps_cond: 1
|
| 11 |
+
log_every_t: 200
|
| 12 |
+
timesteps: 1000
|
| 13 |
+
first_stage_key: edited
|
| 14 |
+
cond_stage_key: edit
|
| 15 |
+
first_stage_downsample: True
|
| 16 |
+
# image_size: 64
|
| 17 |
+
# image_size: 32
|
| 18 |
+
image_size: 16
|
| 19 |
+
channels: 4
|
| 20 |
+
cond_stage_trainable: false # Note: different from the one we trained before
|
| 21 |
+
conditioning_key: hybrid
|
| 22 |
+
monitor: val/loss_simple_ema
|
| 23 |
+
scale_factor: 0.18215
|
| 24 |
+
use_ema: true
|
| 25 |
+
load_ema: true
|
| 26 |
+
|
| 27 |
+
scheduler_config: # 10000 warmup steps
|
| 28 |
+
target: ldm.lr_scheduler.LambdaLinearScheduler
|
| 29 |
+
params:
|
| 30 |
+
warm_up_steps: [ 0 ]
|
| 31 |
+
cycle_lengths: [ 10000000000000 ] # incredibly large number to prevent corner cases
|
| 32 |
+
f_start: [ 1.e-6 ]
|
| 33 |
+
f_max: [ 1. ]
|
| 34 |
+
f_min: [ 1. ]
|
| 35 |
+
|
| 36 |
+
unet_config:
|
| 37 |
+
target: ldm.modules.diffusionmodules.openaimodel_diffree.UNetModel
|
| 38 |
+
params:
|
| 39 |
+
image_size: 32 # unused
|
| 40 |
+
in_channels: 8
|
| 41 |
+
# in_mask_channels: 12
|
| 42 |
+
out_channels: 4
|
| 43 |
+
model_channels: 320
|
| 44 |
+
attention_resolutions: [ 4, 2, 1 ]
|
| 45 |
+
num_res_blocks: 2
|
| 46 |
+
channel_mult: [ 1, 2, 4, 4 ]
|
| 47 |
+
num_heads: 8
|
| 48 |
+
use_spatial_transformer: True
|
| 49 |
+
transformer_depth: 1
|
| 50 |
+
context_dim: 768
|
| 51 |
+
use_checkpoint: True
|
| 52 |
+
legacy: False
|
| 53 |
+
|
| 54 |
+
omp_config:
|
| 55 |
+
target: ldm.modules.diffusionmodules.openaimodel_diffree.OMPModule
|
| 56 |
+
params:
|
| 57 |
+
image_size: 32 # unused
|
| 58 |
+
in_channels: 8
|
| 59 |
+
# in_mask_channels: 12
|
| 60 |
+
out_channels: 4
|
| 61 |
+
model_channels: 320
|
| 62 |
+
attention_resolutions: [ 4, 2, 1 ]
|
| 63 |
+
num_res_blocks: 2
|
| 64 |
+
channel_mult: [ 1, 2, 4, 4 ]
|
| 65 |
+
num_heads: 8
|
| 66 |
+
use_spatial_transformer: True
|
| 67 |
+
transformer_depth: 1
|
| 68 |
+
context_dim: 768
|
| 69 |
+
use_checkpoint: True
|
| 70 |
+
legacy: False
|
| 71 |
+
|
| 72 |
+
first_stage_config:
|
| 73 |
+
target: ldm.models.autoencoder.AutoencoderKL
|
| 74 |
+
params:
|
| 75 |
+
embed_dim: 4
|
| 76 |
+
monitor: val/rec_loss
|
| 77 |
+
ddconfig:
|
| 78 |
+
double_z: true
|
| 79 |
+
z_channels: 4
|
| 80 |
+
resolution: 256
|
| 81 |
+
in_channels: 3
|
| 82 |
+
out_ch: 3
|
| 83 |
+
ch: 128
|
| 84 |
+
ch_mult:
|
| 85 |
+
- 1
|
| 86 |
+
- 2
|
| 87 |
+
- 4
|
| 88 |
+
- 4
|
| 89 |
+
num_res_blocks: 2
|
| 90 |
+
attn_resolutions: []
|
| 91 |
+
dropout: 0.0
|
| 92 |
+
lossconfig:
|
| 93 |
+
target: torch.nn.Identity
|
| 94 |
+
|
| 95 |
+
cond_stage_config:
|
| 96 |
+
target: ldm.modules.encoders.modules.FrozenCLIPEmbedder
|
| 97 |
+
|
| 98 |
+
data:
|
| 99 |
+
target: main.DataModuleFromConfig
|
| 100 |
+
params:
|
| 101 |
+
batch_size: 128
|
| 102 |
+
num_workers: 1
|
| 103 |
+
wrap: false
|
| 104 |
+
validation:
|
| 105 |
+
target: edit_dataset_pam.EditDatasetMask
|
| 106 |
+
params:
|
| 107 |
+
path: data/clip-filtered-dataset
|
| 108 |
+
cache_dir: data/
|
| 109 |
+
cache_name: data_10k
|
| 110 |
+
split: val
|
| 111 |
+
min_text_sim: 0.2
|
| 112 |
+
min_image_sim: 0.75
|
| 113 |
+
min_direction_sim: 0.2
|
| 114 |
+
max_samples_per_prompt: 1
|
| 115 |
+
min_resize_res: 512
|
| 116 |
+
max_resize_res: 512
|
| 117 |
+
crop_res: 512
|
| 118 |
+
output_as_edit: False
|
| 119 |
+
real_input: True
|