Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert bitsandbytes-windows update #1061

Merged
merged 5 commits into from
Jun 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@

Newer Tutorial: [How To Install And Use Kohya LoRA GUI / Web UI on RunPod IO](https://www.youtube.com/watch?v=3uzCNrQao3o):

[![How To Install And Use Kohya LoRA GUI / Web UI on RunPod IO With Stable Diffusion & Automatic1111](https://github-production-user-asset-6210df.s3.amazonaws.com/19240467/238678226-0c9c3f7d-c308-4793-b790-999fdc271372.png)](https://www

.youtube.com/watch?v=3uzCNrQao3o)
[![How To Install And Use Kohya LoRA GUI / Web UI on RunPod IO With Stable Diffusion & Automatic1111](https://github-production-user-asset-6210df.s3.amazonaws.com/19240467/238678226-0c9c3f7d-c308-4793-b790-999fdc271372.png)](https://www.youtube.com/watch?v=3uzCNrQao3o)

## Installation

Expand Down Expand Up @@ -365,7 +363,7 @@

The setup solution is now much more modulat and will simplify requirements support across different environments... hoping this will make it easier to run on different OS.
* 2023/06/19 (v21.7.10)
- Quick fix for linux GUI startup where it would try to install darwin requirements on top of linux. Ugly fix but work. Hopefulle some linux user will improve via a PR.

Check warning on line 366 in README.md

View workflow job for this annotation

GitHub Actions / build

"Hopefulle" should be "Hopefully".

Check warning on line 366 in README.md

View workflow job for this annotation

GitHub Actions / build

"Hopefulle" should be "Hopefully".
* 2023/06/18 (v21.7.9)
- Implement temporary fix for validation of image dataset. Will no longer stop execution but will let training continue... this is changed to avoid stopping training on false positive... yet still raise awaireness that something might be wrong with the image dataset structure.
* 2023/06/14 (v21.7.8)
Expand Down
42 changes: 23 additions & 19 deletions examples/pull kohya_ss sd-scripts updates in.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
# Pull sd-scripts update in a local branch
## Updating a Local Branch with the Latest sd-scripts Changes

For reference for anyone that would like to pull the latest from kohya/sd-scripts, you can:
To update your local branch with the most recent changes from kohya/sd-scripts, follow these steps:

`git remote add sd-scripts https://github.com/kohya-ss/sd-scripts.git`
1. Add sd-scripts as an alternative remote by executing the following command:

to add it as an alternative remote, then when you want to update:
```
git remote add sd-scripts https://github.com/kohya-ss/sd-scripts.git
```

```
git checkout dev
git pull sd-scripts main
```
2. When you wish to perform an update, execute the following commands:

or, if you want the absolute latest and potentially broken code:
```
git checkout dev
git pull sd-scripts main
```

```
git checkout dev
git pull sd-scripts dev
```
Alternatively, if you want to obtain the latest code, even if it may be unstable:

You'll probably get a conflict for the Readme, but you can get around it with:
```
git checkout dev
git pull sd-scripts dev
```

```
git add README.md
git merge --continue
```
3. If you encounter a conflict with the Readme file, you can resolve it by taking the following steps:

which will probably open a text editor for a commit message, but you can just save and close that and you should be good to go. If there are more merge conflicts than that, you now have a potential learning experience and chance for personal growth.
```
git add README.md
git merge --continue
```

This may open a text editor for a commit message, but you can simply save and close it to proceed. Following these steps should resolve the conflict. If you encounter additional merge conflicts, consider them as valuable learning opportunities for personal growth.
31 changes: 20 additions & 11 deletions library/basic_caption_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,43 +20,51 @@ def caption_images(
find_text,
replace_text,
):
# Check for images_dir
# Check if images_dir is provided
if not images_dir:
msgbox('Image folder is missing...')
msgbox('Image folder is missing. Please provide the directory containing the images to caption.')
return

# Check if caption_ext is provided
if not caption_ext:
msgbox('Please provide an extension for the caption files.')
return

if caption_text:
log.info(f'Captioning files in {images_dir} with {caption_text}...')

# Build the command to run caption.py
run_cmd = f'python "tools/caption.py"'
run_cmd += f' --caption_text="{caption_text}"'

# Add optional flags to the command
if overwrite:
run_cmd += f' --overwrite'
if caption_ext:
run_cmd += f' --caption_file_ext="{caption_ext}"'

run_cmd += f' "{images_dir}"'

log.info(run_cmd)

# Run the command
# Run the command based on the operating system
if os.name == 'posix':
os.system(run_cmd)
else:
subprocess.run(run_cmd)

# Check if overwrite option is enabled
if overwrite:
if prefix or postfix:
# Add prefix and postfix
# Add prefix and postfix to caption files
add_pre_postfix(
folder=images_dir,
caption_file_ext=caption_ext,
prefix=prefix,
postfix=postfix,
)
if find_text:
# Find and replace text in caption files
find_replace(
folder_path=images_dir,
caption_file_ext=caption_ext,
Expand All @@ -65,18 +73,19 @@ def caption_images(
)
else:
if prefix or postfix:
# Show a message if modification is not possible without overwrite option enabled
msgbox(
'Could not modify caption files with requested change because the "Overwrite existing captions in folder" option is not selected...'
'Could not modify caption files with requested change because the "Overwrite existing captions in folder" option is not selected.'
)

log.info('...captioning done')
log.info('Captioning done.')


# Gradio UI
def gradio_basic_caption_gui_tab(headless=False):
with gr.Tab('Basic Captioning'):
gr.Markdown(
'This utility will allow the creation of simple caption files for each image in a folder.'
'This utility allows you to create simple caption files for each image in a folder.'
)
with gr.Row():
images_dir = gr.Textbox(
Expand All @@ -94,7 +103,7 @@ def gradio_basic_caption_gui_tab(headless=False):
)
caption_ext = gr.Textbox(
label='Caption file extension',
placeholder='Extension for caption file. eg: .caption, .txt',
placeholder='Extension for caption file (e.g., .caption, .txt)',
value='.txt',
interactive=True,
)
Expand All @@ -111,7 +120,7 @@ def gradio_basic_caption_gui_tab(headless=False):
)
caption_text = gr.Textbox(
label='Caption text',
placeholder='Eg: , by some artist. Leave empty if you just want to add pre or postfix',
placeholder='e.g., "by some artist". Leave empty if you only want to add a prefix or postfix.',
interactive=True,
)
postfix = gr.Textbox(
Expand All @@ -122,12 +131,12 @@ def gradio_basic_caption_gui_tab(headless=False):
with gr.Row():
find_text = gr.Textbox(
label='Find text',
placeholder='Eg: , by some artist. Leave empty if you just want to add pre or postfix',
placeholder='e.g., "by some artist". Leave empty if you only want to add a prefix or postfix.',
interactive=True,
)
replace_text = gr.Textbox(
label='Replacement text',
placeholder='Eg: , by some artist. Leave empty if you just want to replace with nothing',
placeholder='e.g., "by some artist". Leave empty if you want to replace with nothing.',
interactive=True,
)
caption_button = gr.Button('Caption images')
Expand Down
15 changes: 6 additions & 9 deletions library/blip_caption_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import subprocess
import os
from .common_gui import get_folder_path, add_pre_postfix

from library.custom_logging import setup_logging

# Set up logging
Expand All @@ -24,21 +23,19 @@ def caption_images(
prefix,
postfix,
):
# Check for caption_text_input
# if caption_text_input == "":
# msgbox("Caption text is missing...")
# return

# Check for images_dir_input
# Check if the image folder is provided
if train_data_dir == '':
msgbox('Image folder is missing...')
return

# Check if the caption file extension is provided
if caption_file_ext == '':
msgbox('Please provide an extension for the caption files.')
return

log.info(f'Captioning files in {train_data_dir}...')

# Construct the command to run
run_cmd = f'{PYTHON} "finetune/make_captions.py"'
run_cmd += f' --batch_size="{int(batch_size)}"'
run_cmd += f' --num_beams="{int(num_beams)}"'
Expand Down Expand Up @@ -79,7 +76,7 @@ def caption_images(
def gradio_blip_caption_gui_tab(headless=False):
with gr.Tab('BLIP Captioning'):
gr.Markdown(
'This utility will use BLIP to caption files for each images in a folder.'
'This utility uses BLIP to caption files for each image in a folder.'
)
with gr.Row():
train_data_dir = gr.Textbox(
Expand All @@ -98,7 +95,7 @@ def gradio_blip_caption_gui_tab(headless=False):
with gr.Row():
caption_file_ext = gr.Textbox(
label='Caption file extension',
placeholder='Extention for caption file. eg: .caption, .txt',
placeholder='Extension for caption file, e.g., .caption, .txt',
value='.txt',
interactive=True,
)
Expand Down
Loading
Loading