R
RunPod6mo ago
fdoelker

Console for kohya_ss / Stable Diffusion

Is there a way to access the concole for running processes in prebuilt pods? I am running kohya_ss and Stable Diffusion and would like to see what’s going on “behind the WebUI layer”. Any help is greatly apprechiated. 🙂
2 Replies
digigoblin
digigoblin6mo ago
Read the README for information on how to view the logs.
fdoelker
fdoelkerOP6mo ago
Awesome this helped a lot. I have this script running in a notebook now
import time
import os
import collections
from IPython.display import clear_output

log_file_path = "/workspace/logs/webui.log"
# log_file_path = "/workspace/logs/kohya_ss.log"

# Function to get the last N lines from a file
def get_last_n_lines(file_path, n=30): # Changed to 50 lines
with open(file_path, 'rb') as file:
# Deque to store the last N lines
last_n_lines = collections.deque(maxlen=n)
try:
# Read lines and append to deque
for line in file:
last_n_lines.append(line)
except Exception as e:
print(f"An error occurred: {e}")
# Decode lines from bytes to string
return [line.decode('utf-8').strip() for line in last_n_lines]

while True:
# Clear the previous output
clear_output(wait=True)

# Get the last n lines from the log file
last_n_lines = get_last_n_lines(log_file_path) # Changed to 50 lines

# Display the last n lines in JupyterLab
for line in last_n_lines:
print(line)

# Wait for a brief moment before checking for updates
time.sleep(0.1)
import time
import os
import collections
from IPython.display import clear_output

log_file_path = "/workspace/logs/webui.log"
# log_file_path = "/workspace/logs/kohya_ss.log"

# Function to get the last N lines from a file
def get_last_n_lines(file_path, n=30): # Changed to 50 lines
with open(file_path, 'rb') as file:
# Deque to store the last N lines
last_n_lines = collections.deque(maxlen=n)
try:
# Read lines and append to deque
for line in file:
last_n_lines.append(line)
except Exception as e:
print(f"An error occurred: {e}")
# Decode lines from bytes to string
return [line.decode('utf-8').strip() for line in last_n_lines]

while True:
# Clear the previous output
clear_output(wait=True)

# Get the last n lines from the log file
last_n_lines = get_last_n_lines(log_file_path) # Changed to 50 lines

# Display the last n lines in JupyterLab
for line in last_n_lines:
print(line)

# Wait for a brief moment before checking for updates
time.sleep(0.1)
Works like a charm. Thank you @digigoblin !
Want results from more Discord servers?
Add your server