I want to make kohya ss available through the http service [port 7860] button.
I installed kohya_ss on my pod.
I created a starting script for it
I added some variables in the runpod ui.
The wierd thing is that the button works but it does not update to a "working" status. Is this related to how the service detection is handled by runpod? Is the starting script wrong? How can I fix this?
Thanks
The kohya starting script:
`#!/bin/bash
set -e # Exit immediately if any command fails
# Variables
KOYA_PATH="/workspace/kohya_ss/kohya_ss"
KOYA_VENV="/workspace/kohya_ss/kohya_venv" # Full path to conda environment
LOG_FILE="/workspace/kohya_ss/kohya_ss.log"
PORT=${KOYA_PORT:-7860} # Use env variable KOYA_PORT if set, otherwise default to 7860
HOST="0.0.0.0" # Change to 127.0.0.1 if you want local access only
USERNAME="" # Optionally set username for authentication
PASSWORD="" # Optionally set password for authentication
# Path to conda initialization script
CONDA_INIT_SCRIPT="/opt/miniconda3/etc/profile.d/conda.sh"
# Function to start Kohya SS using the full path to conda env
start_kohya() {
echo "Sourcing Conda initialization script..."
source $CONDA_INIT_SCRIPT # Source the conda initialization script to set up environment
echo "Activating Kohya SS virtual environment..."
conda activate $KOYA_VENV # Use the full path to the conda environment
# Set environment variable for HTTP service detection
export RUNPOD_SERVICE_PORT=$PORT
echo "Starting Kohya SS on port $PORT..."
bash $KOYA_PATH/gui.sh --listen $HOST --server_port $PORT &> $LOG_FILE &
echo "Waiting for Kohya SS to be available on port $PORT..."
while ! curl -s http://$HOST:$PORT > /dev/null; do
sleep 1
done
echo "Kohya SS started and running on port $PORT. Logs can be found at $LOG_FILE."
# Optionally, deactivate the environment after starting
conda deactivate
}
# Execute the function
start_kohya
0 Replies