The default device in app.py is hardcoded to "cuda":
st.session_state.setdefault("device", "cuda")
This causes a RuntimeError when users try to load a model on a CPU-only machine, even though the GUI explicitly supports cpu, cuda, and mps as device options in the sidebar dropdown.
The app is expected to dynamically detect the available device at runtime instead of assuming CUDA is always available.
Proposed Fix
if "device" not in st.session_state:
if torch.cuda.is_available():
default_device = "cuda"
elif torch.backends.mps.is_available():
default_device = "mps"
else:
default_device = "cpu"
st.session_state.device = default_device
The default device in
app.pyis hardcoded to"cuda":This causes a
RuntimeErrorwhen users try to load a model on a CPU-only machine, even though the GUI explicitly supportscpu,cuda, andmpsas device options in the sidebar dropdown.The app is expected to dynamically detect the available device at runtime instead of assuming CUDA is always available.
Proposed Fix