Skip to content

Commit

Permalink
Merge pull request #2398 from bmaltais/dev
Browse files Browse the repository at this point in the history
v24.0.8
  • Loading branch information
bmaltais committed Apr 27, 2024
2 parents b826d61 + 074de82 commit f66a238
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 17 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TENSORBOARD_PORT=6006
2 changes: 1 addition & 1 deletion .release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v24.0.7
v24.0.8
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ The GUI allows you to set the training parameters and generate and run the requi
- [SDXL training](#sdxl-training)
- [Masked loss](#masked-loss)
- [Change History](#change-history)
- [2024/04/26 (v24.0.8)](#20240426-v2408)
- [2024/04/25 (v24.0.7)](#20240425-v2407)
- [2024/04/22 (v24.0.6)](#20240422-v2406)
- [2024/04/19 (v24.0.5)](#20240419-v2405)
Expand Down Expand Up @@ -105,7 +106,7 @@ To set up the project, follow these steps:
2. Clone the repository by running the following command:

```shell
git clone https://github.com/bmaltais/kohya_ss.git
git clone --recursive https://github.com/bmaltais/kohya_ss.git
```

3. Change into the `kohya_ss` directory:
Expand Down Expand Up @@ -153,7 +154,7 @@ To set up the project on Linux or macOS, perform the following steps:
2. Clone the repository by running the following command:
```shell
git clone https://github.com/bmaltais/kohya_ss.git
git clone --recursive https://github.com/bmaltais/kohya_ss.git
```
3. Change into the `kohya_ss` directory:
Expand Down Expand Up @@ -198,7 +199,7 @@ To install the necessary components for Runpod and run kohya_ss, follow these st
```shell
cd /workspace
git clone https://github.com/bmaltais/kohya_ss.git
git clone --recursive https://github.com/bmaltais/kohya_ss.git
```
4. Run the setup script:
Expand Down Expand Up @@ -266,7 +267,7 @@ Install the NVIDIA Container Toolkit with this guide.
#### Use the pre-built Docker image
```bash
git clone https://github.com/bmaltais/kohya_ss.git
git clone --recursive https://github.com/bmaltais/kohya_ss.git
cd kohya_ss
docker compose up -d
```
Expand Down Expand Up @@ -453,6 +454,10 @@ ControlNet dataset is used to specify the mask. The mask images should be the RG
## Change History
### 2024/04/26 (v24.0.8)
- Set `max_train_steps` to 0 if not specified in older `.json` config files.
### 2024/04/25 (v24.0.7)
- Prevent crash if tkinter is not installed
Expand Down
4 changes: 3 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ services:
- 7860:7860
environment:
SAFETENSORS_FAST_GPU: 1
TENSORBOARD_PORT: ${TENSORBOARD_PORT:-6006}
tmpfs:
- /tmp
volumes:
Expand Down Expand Up @@ -42,7 +43,8 @@ services:
container_name: tensorboard
image: tensorflow/tensorflow:latest-gpu
ports:
- 6006:6006
# !Please change the port in .env file
- ${TENSORBOARD_PORT:-6006}:6006
volumes:
- ./dataset/logs:/app/logs
command: tensorboard --logdir=/app/logs --bind_all
Expand Down
25 changes: 16 additions & 9 deletions kohya_gui/class_tensorboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ def get_button_states(self, started=False):
visible=visibility and (not started or self.headless)
), gr.Button(visible=visibility and (started or self.headless))

def open_tensorboard_url(self):
tensorboard_url = f"http://localhost:{self.tensorboard_port}"
self.log.info(f"Opening TensorBoard URL in browser: {tensorboard_url}")
webbrowser.open(tensorboard_url)

def start_tensorboard(self, logging_dir=None):
if self.tensorboard_proc is not None:
self.log.info(
Expand Down Expand Up @@ -74,17 +79,13 @@ def start_tensorboard(self, logging_dir=None):
self.log.error("Failed to start Tensorboard:", e)
return self.get_button_states(started=False)

def open_tensorboard_url():
time.sleep(self.wait_time)
if not self.stop_event.is_set():
tensorboard_url = f"http://localhost:{self.tensorboard_port}"
self.log.info(f"Opening TensorBoard URL in browser: {tensorboard_url}")
webbrowser.open(tensorboard_url)

if not self.headless:
self.stop_event.clear()
self.thread = Thread(target=open_tensorboard_url)
self.thread.start()

time.sleep(self.wait_time)
if not self.stop_event.is_set():
self.thread = Thread(target=self.open_tensorboard_url)
self.thread.start()

return self.get_button_states(started=True)

Expand Down Expand Up @@ -119,6 +120,12 @@ def gradio_interface(self):
visible=visibility and self.headless,
elem_id="myTensorButtonStop",
)
button_open_tensorboard = gr.Button(
value="Open tensorboard",
elem_id="myTensorButton",
visible=not visibility,
link=f"http://localhost:{self.tensorboard_port}",
)
button_start_tensorboard.click(
self.start_tensorboard,
inputs=[self.logging_dir],
Expand Down
2 changes: 1 addition & 1 deletion kohya_gui/common_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ def update_my_data(my_data):
my_data[key] = int(value)
except ValueError:
# Handle the case where the string is not a valid float
my_data[key] = int(1600)
my_data[key] = int(0)

# Convert values to int if they are strings
for key in ["max_token_length"]:
Expand Down
2 changes: 1 addition & 1 deletion test/config/dreambooth-AdamW8bit.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"max_timestep": 1000,
"max_token_length": 75,
"max_train_epochs": 0,
"max_train_steps": 0,
"max_train_steps": "",
"mem_eff_attn": false,
"min_bucket_reso": 256,
"min_snr_gamma": 0,
Expand Down

0 comments on commit f66a238

Please sign in to comment.