Skip to content

Commit

Permalink
fix(gui): fix subprocess errors in linux and fix wrong error logging (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
34j committed Apr 16, 2023
1 parent abd2aeb commit fd67db6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/so_vits_svc_fork/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import sounddevice as sd
import soundfile as sf
import torch
from pebble import ProcessFuture, ProcessPool
from pebble import ProcessFuture, ThreadPool
from tqdm.tk import tqdm_tk

from .utils import ensure_pretrained_model, get_optimal_device
Expand Down Expand Up @@ -513,7 +513,9 @@ def apply_preset(name: str) -> None:
del default_name
update_speaker()
update_devices()
with ProcessPool(max_workers=1) as pool:
# with ProcessPool(max_workers=1) as pool:
# with ProcessPool(max_workers=1, context="spawn") as pool:
with ThreadPool(max_workers=1) as pool:
future: None | ProcessFuture = None
infer_futures: set[ProcessFuture] = set()
while True:
Expand Down Expand Up @@ -673,18 +675,18 @@ def apply_preset(name: str) -> None:
except Exception as e:
LOG.exception(e)
if future is not None and future.done():
LOG.error("Error in realtime: ")
try:
future.result()
except Exception as e:
LOG.error("Error in realtime: ")
LOG.exception(e)
future = None
for future in copy(infer_futures):
if future.done():
LOG.error("Error in inference: ")
try:
future.result()
except Exception as e:
LOG.error("Error in inference: ")
LOG.exception(e)
infer_futures.remove(future)
if future:
Expand Down

0 comments on commit fd67db6

Please sign in to comment.