diff --git a/Dockerfile b/Dockerfile index 4ea1e5974..bfb282224 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/docker-compose.yaml b/docker-compose.yaml index aa5f848bb..f85ec8181 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -7,6 +7,8 @@ services: context: . ports: - 127.0.0.1:3000:3000 + - 7860:7860 + - 6006:6006 tty: true ipc: host environment: diff --git a/library/tensorboard_gui.py b/library/tensorboard_gui.py index bfaf79968..f0cbfe407 100644 --- a/library/tensorboard_gui.py +++ b/library/tensorboard_gui.py @@ -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: @@ -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():