Skip to content

Commit

Permalink
Merge pull request kohya-ss#1137 from jim60105/master
Browse files Browse the repository at this point in the history
Let Tensorboard works in docker
  • Loading branch information
bmaltais committed Jul 9, 2023
2 parents 396f885 + 183bf14 commit 3bb308b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ COPY --chown=appuser . .

STOPSIGNAL SIGINT
ENV LD_PRELOAD=libtcmalloc.so
ENV PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
ENV PATH="$PATH:/home/appuser/.local/bin"
CMD python3 "./kohya_gui.py" ${CLI_ARGS} --listen 0.0.0.0 --server_port 7860
2 changes: 2 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ services:
context: .
ports:
- 127.0.0.1:3000:3000
- 7860:7860
- 6006:6006
tty: true
ipc: host
environment:
Expand Down
15 changes: 8 additions & 7 deletions library/tensorboard_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def start_tensorboard(logging_dir):
msgbox(msg='Error: log folder is empty')
return

run_cmd = [f'{TENSORBOARD}', '--logdir', f'{logging_dir}']
run_cmd = [f'{TENSORBOARD}', '--logdir', f'{logging_dir}', '--host', '0.0.0.0', '--port', '6006']

log.info(run_cmd)
if tensorboard_proc is not None:
Expand All @@ -34,14 +34,15 @@ def start_tensorboard(logging_dir):
log.info('Starting tensorboard...')
tensorboard_proc = subprocess.Popen(run_cmd)

# Wait for some time to allow TensorBoard to start up
time.sleep(5)
if os.name == 'posix' and len(os.environ.get('DISPLAY'))>0:
# Wait for some time to allow TensorBoard to start up
time.sleep(5)

# Open the TensorBoard URL in the default browser
log.info('Opening tensorboard url in browser...')
import webbrowser
# Open the TensorBoard URL in the default browser
log.info('Opening tensorboard url in browser...')
import webbrowser

webbrowser.open('http://localhost:6006')
webbrowser.open('http://localhost:6006')


def stop_tensorboard():
Expand Down

0 comments on commit 3bb308b

Please sign in to comment.