Add preset, fix make_caption library path

pull/1540/head
bmaltais 2023-09-10 15:56:20 -04:00
parent f323578dbc
commit cf4d4e1f28
3 changed files with 130 additions and 1 deletions

View File

@ -12,7 +12,7 @@ import numpy as np
import torch
from torchvision import transforms
from torchvision.transforms.functional import InterpolationMode
sys.path.append(os.path.dirname(__file__))
sys.path.append(os.path.join(os.path.dirname(__file__), '..')) # sys.path.append(os.path.dirname(__file__))
from blip.blip import blip_decoder
import library.train_util as train_util

View File

@ -0,0 +1,97 @@
{
"LoRA_type": "Standard",
"adaptive_noise_scale": 0.00357,
"additional_parameters": "",
"block_alphas": "",
"block_dims": "",
"block_lr_zero_threshold": "",
"bucket_no_upscale": false,
"bucket_reso_steps": 32,
"cache_latents": true,
"cache_latents_to_disk": true,
"caption_dropout_every_n_epochs": 0.0,
"caption_dropout_rate": 0,
"caption_extension": ".txt",
"clip_skip": "1",
"color_aug": false,
"conv_alpha": 4,
"conv_block_alphas": "",
"conv_block_dims": "",
"conv_dim": 4,
"decompose_both": false,
"dim_from_weights": false,
"down_lr_weight": "",
"enable_bucket": true,
"epoch": 10,
"factor": -1,
"flip_aug": false,
"full_bf16": false,
"full_fp16": false,
"gradient_accumulation_steps": 1,
"gradient_checkpointing": true,
"keep_tokens": 1,
"learning_rate": 0.0001,
"lora_network_weights": "",
"lr_scheduler": "cosine",
"lr_scheduler_args": "",
"lr_scheduler_num_cycles": "1",
"lr_scheduler_power": "",
"lr_warmup": 0,
"max_bucket_reso": 2048,
"max_data_loader_n_workers": "0",
"max_resolution": "1024,1024",
"max_timestep": 1000,
"max_token_length": "75",
"max_train_epochs": "",
"max_train_steps": "",
"mem_eff_attn": false,
"mid_lr_weight": "",
"min_bucket_reso": 64,
"min_snr_gamma": 0,
"min_timestep": 0,
"mixed_precision": "bf16",
"module_dropout": 0,
"multires_noise_discount": 0,
"multires_noise_iterations": 0,
"network_alpha": 46,
"network_dim": 92,
"network_dropout": 0,
"no_token_padding": false,
"noise_offset": 0.0357,
"noise_offset_type": "Original",
"num_cpu_threads_per_process": 2,
"optimizer": "AdamW8bit",
"optimizer_args": "",
"persistent_data_loader_workers": false,
"prior_loss_weight": 1.0,
"random_crop": false,
"rank_dropout": 0,
"save_every_n_epochs": 2,
"save_every_n_steps": 0,
"save_last_n_steps": 0,
"save_last_n_steps_state": 0,
"save_precision": "bf16",
"scale_v_pred_loss_like_noise_pred": false,
"scale_weight_norms": 1,
"sdxl": true,
"sdxl_cache_text_encoder_outputs": false,
"sdxl_no_half_vae": true,
"seed": "12345",
"shuffle_caption": false,
"stop_text_encoder_training_pct": 0,
"text_encoder_lr": 0.0001,
"train_batch_size": 1,
"train_on_input": false,
"training_comment": "20 1024x1024 cropped images, 20 repeats, Blip captions, but 'woman' replaced with 'khls woman'",
"unet_lr": 0.0001,
"unit": 1,
"up_lr_weight": "",
"use_cp": false,
"use_wandb": false,
"v2": false,
"v_parameterization": false,
"v_pred_like_loss": 0,
"vae_batch_size": 0,
"weighted_captions": false,
"xformers": "xformers"
}

View File

@ -0,0 +1,32 @@
import os
import argparse
def main(folder_path):
# Validate if the folder exists
if not os.path.exists(folder_path):
print("The specified folder does not exist.")
return
# Loop through all files in the directory
for filename in os.listdir(folder_path):
# Check if the file is an image file (webp, jpg, png)
if filename.lower().endswith(('.webp', '.jpg', '.png')):
# Remove the file extension from the filename
name_without_extension = os.path.splitext(filename)[0]
# Construct the name of the txt file
txt_filename = f"{name_without_extension}.txt"
# Extract the content before the underscore
content = name_without_extension.split("_")[0]
# Write the content to the txt file
with open(os.path.join(folder_path, txt_filename), "w") as txt_file:
txt_file.write(content)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Process a folder.')
parser.add_argument('folder_path', type=str, help='Path to the folder to process')
args = parser.parse_args()
main(args.folder_path)