diff --git a/library/basic_caption_gui.py b/library/basic_caption_gui.py index 550d757..57ff558 100644 --- a/library/basic_caption_gui.py +++ b/library/basic_caption_gui.py @@ -16,6 +16,10 @@ def caption_images( if images_dir_input == '': msgbox('Image folder is missing...') return + + if caption_file_ext == '': + msgbox('Please provide an extension for the caption files.') + return if not caption_text_input == '': print( @@ -83,7 +87,8 @@ def gradio_basic_caption_gui_tab(): ) caption_file_ext = gr.Textbox( label='Caption file extension', - placeholder='(Optional) Default: .caption', + placeholder='Extention for caption file. eg: .caption, .txt', + value='.txt', interactive=True, ) overwrite_input = gr.Checkbox( diff --git a/library/blip_caption_gui.py b/library/blip_caption_gui.py index aadb394..b9ae8ae 100644 --- a/library/blip_caption_gui.py +++ b/library/blip_caption_gui.py @@ -26,6 +26,10 @@ def caption_images( if train_data_dir == '': msgbox('Image folder is missing...') return + + if caption_file_ext == '': + msgbox('Please provide an extension for the caption files.') + return print(f'Captioning files in {train_data_dir}...') run_cmd = f'.\\venv\\Scripts\\python.exe "finetune/make_captions.py"' @@ -82,7 +86,8 @@ def gradio_blip_caption_gui_tab(): with gr.Row(): caption_file_ext = gr.Textbox( label='Caption file extension', - placeholder='(Optional) Default: .caption', + placeholder='Extention for caption file. eg: .caption, .txt', + value='.txt', interactive=True, ) diff --git a/library/common_gui.py b/library/common_gui.py index 7514854..fd2d83d 100644 --- a/library/common_gui.py +++ b/library/common_gui.py @@ -200,7 +200,7 @@ def find_replace(folder='', caption_file_ext='.caption', find='', replace=''): files = [f for f in os.listdir(folder) if f.endswith(caption_file_ext)] for file in files: - with open(os.path.join(folder, file), 'r') as f: + with open(os.path.join(folder, file), 'r', errors="ignore") as f: content = f.read() f.close content = content.replace(find, replace) diff --git a/library/wd14_caption_gui.py b/library/wd14_caption_gui.py index 13645ce..d50c32a 100644 --- a/library/wd14_caption_gui.py +++ b/library/wd14_caption_gui.py @@ -14,6 +14,10 @@ def caption_images(train_data_dir, caption_extension, batch_size, thresh): if train_data_dir == '': msgbox('Image folder is missing...') return + + if caption_extension == '': + msgbox('Please provide an extension for the caption files.') + return print(f'Captioning files in {train_data_dir}...') run_cmd = f'accelerate launch "./finetune/tag_images_by_wd14_tagger.py"' @@ -56,7 +60,8 @@ def gradio_wd14_caption_gui_tab(): caption_extension = gr.Textbox( label='Caption file extension', - placeholder='(Optional) Default: .caption', + placeholder='Extention for caption file. eg: .caption, .txt', + value='.txt', interactive=True, ) thresh = gr.Number(value=0.35, label='Threshold') diff --git a/lora_gui.py b/lora_gui.py index d9b99fc..e35e193 100644 --- a/lora_gui.py +++ b/lora_gui.py @@ -267,6 +267,10 @@ def train_model( if output_dir == '': msgbox('Output folder path is missing') return + + if stop_text_encoder_training_pct > 0: + msgbox('Output "stop text encoder training" is not yet supported. Ignoring') + stop_text_encoder_training_pct = 0 # If string is empty set string to 0. if text_encoder_lr == '':