Add default for caption extension tools
This commit is contained in:
parent
f265197ba9
commit
fcad6bfd98
@ -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(
|
||||
|
@ -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,
|
||||
)
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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')
|
||||
|
@ -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 == '':
|
||||
|
Loading…
Reference in New Issue
Block a user