-
Notifications
You must be signed in to change notification settings - Fork 486
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Other acceleration trick, reopened (#95)
* feat : face segmentation mask * feat : * feat : conditioning dataset
- Loading branch information
1 parent
431df66
commit 5240d32
Showing
5 changed files
with
161 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from .lora import * | ||
from .dataset import * | ||
from .utils import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from PIL import Image | ||
|
||
|
||
def image_grid(_imgs, rows, cols): | ||
|
||
w, h = _imgs[0].size | ||
grid = Image.new("RGB", size=(cols * w, rows * h)) | ||
grid_w, grid_h = grid.size | ||
|
||
for i, img in enumerate(_imgs): | ||
grid.paste(img, box=(i % cols * w, i // cols * h)) | ||
return grid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
export MODEL_NAME="runwayml/stable-diffusion-v1-5" | ||
export INSTANCE_DIR="./data_example_small" | ||
export OUTPUT_DIR="./exps/output_example_enid_w_mask" | ||
|
||
lora_pti \ | ||
--pretrained_model_name_or_path=$MODEL_NAME \ | ||
--instance_data_dir=$INSTANCE_DIR \ | ||
--output_dir=$OUTPUT_DIR \ | ||
--train_text_encoder \ | ||
--resolution=512 \ | ||
--train_batch_size=1 \ | ||
--gradient_accumulation_steps=1 \ | ||
--learning_rate_unet=3e-4 \ | ||
--learning_rate_text=3e-4 \ | ||
--learning_rate_ti=1e-3 \ | ||
--color_jitter \ | ||
--lr_scheduler="constant" \ | ||
--lr_warmup_steps=100 \ | ||
--placeholder_tokens="<s1>|<s2>|<s3>" \ | ||
--placeholder_token_at_data="<s>|<s1><s2><s3>"\ | ||
--initializer_tokens="girl|<rand>|<rand>" \ | ||
--save_steps=100 \ | ||
--max_train_steps_ti=500 \ | ||
--max_train_steps_tuning=1000 \ | ||
--perform_inversion=True \ | ||
--use_template="object"\ | ||
--weight_decay_ti=0.1 \ | ||
--weight_decay_lora=0.001\ | ||
--continue_inversion_lr=1e-4\ | ||
--device="cuda:0"\ | ||
--use_face_segmentation_condition\ |