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

Let Tensorboard works in docker #1137

Merged
merged 4 commits into from
Jul 9, 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
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