mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-07-08 05:51:40 -07:00
fix for linux
This commit is contained in:
parent
dbf28eeebf
commit
7f609d0f0a
5 changed files with 31 additions and 41 deletions
|
@ -357,13 +357,8 @@ class InteractBase(object):
|
|||
return result
|
||||
|
||||
def input_process(self, stdin_fd, sq, str):
|
||||
import sys
|
||||
if sys.platform != 'win32':
|
||||
# fix for Linux , Ignoring :
|
||||
# /usr/lib/python3.6/multiprocessing/semaphore_tracker.py:143:
|
||||
# UserWarning: semaphore_tracker: There appear to be 1 leaked semaphores to clean up at shutdown
|
||||
import warnings
|
||||
warnings.simplefilter(action='ignore', category=UserWarning)
|
||||
from core import osex
|
||||
osex.linux_ignore_UserWarning()
|
||||
|
||||
sys.stdin = os.fdopen(stdin_fd)
|
||||
try:
|
||||
|
@ -386,19 +381,15 @@ class InteractBase(object):
|
|||
if time.time() - t > max_time_sec:
|
||||
break
|
||||
p.terminate()
|
||||
sq.close()
|
||||
old_stdin = sys.stdin
|
||||
sys.stdin = os.fdopen( os.dup(sys.stdin.fileno()) )
|
||||
old_stdin.close()
|
||||
return inp
|
||||
|
||||
def input_process_skip_pending(self, stdin_fd):
|
||||
import sys
|
||||
if sys.platform != 'win32':
|
||||
# fix for Linux , Ignoring :
|
||||
# /usr/lib/python3.6/multiprocessing/semaphore_tracker.py:143:
|
||||
# UserWarning: semaphore_tracker: There appear to be 1 leaked semaphores to clean up at shutdown
|
||||
import warnings
|
||||
warnings.simplefilter(action='ignore', category=UserWarning)
|
||||
from core import osex
|
||||
osex.linux_ignore_UserWarning()
|
||||
|
||||
sys.stdin = os.fdopen(stdin_fd)
|
||||
while True:
|
||||
|
|
|
@ -55,17 +55,12 @@ class Subprocessor(object):
|
|||
def progress_bar_inc(self, c): self.c2s.put ( {'op': 'progress_bar_inc' , 'c':c } )
|
||||
|
||||
def _subprocess_run(self, client_dict, s2c, c2s):
|
||||
import sys
|
||||
if sys.platform != 'win32':
|
||||
# fix for Linux , Ignoring :
|
||||
# /usr/lib/python3.6/multiprocessing/semaphore_tracker.py:143:
|
||||
# UserWarning: semaphore_tracker: There appear to be 1 leaked semaphores to clean up at shutdown
|
||||
import warnings
|
||||
warnings.simplefilter(action='ignore', category=UserWarning)
|
||||
from core import osex
|
||||
osex.linux_ignore_UserWarning()
|
||||
|
||||
self.s2c = s2c
|
||||
self.c2s = c2s
|
||||
data = None
|
||||
is_error = False
|
||||
try:
|
||||
self.on_initialize(client_dict)
|
||||
|
||||
|
@ -86,16 +81,18 @@ class Subprocessor(object):
|
|||
|
||||
self.on_finalize()
|
||||
c2s.put ( {'op': 'finalized'} )
|
||||
return
|
||||
except Subprocessor.SilenceException as e:
|
||||
pass
|
||||
c2s.put ( {'op': 'error', 'data' : data} )
|
||||
except Exception as e:
|
||||
c2s.put ( {'op': 'error', 'data' : data} )
|
||||
if data is not None:
|
||||
print ('Exception while process data [%s]: %s' % (self.get_data_name(data), traceback.format_exc()) )
|
||||
else:
|
||||
print ('Exception: %s' % (traceback.format_exc()) )
|
||||
|
||||
c2s.put ( {'op': 'error', 'data' : data} )
|
||||
c2s.close()
|
||||
s2c.close()
|
||||
self.c2s = None
|
||||
|
||||
# disable pickling
|
||||
def __getstate__(self):
|
||||
|
|
|
@ -34,3 +34,11 @@ def get_screen_size():
|
|||
pass
|
||||
|
||||
return (1366, 768)
|
||||
|
||||
def linux_ignore_UserWarning():
|
||||
if sys.platform[0:3] != 'win':
|
||||
# fix for Linux , Ignoring :
|
||||
# /usr/lib/python3.6/multiprocessing/semaphore_tracker.py:143:
|
||||
# UserWarning: semaphore_tracker: There appear to be 1 leaked semaphores to clean up at shutdown
|
||||
import warnings
|
||||
warnings.simplefilter(action='ignore', category=UserWarning)
|
|
@ -25,6 +25,6 @@ linux_font_name_map = {
|
|||
|
||||
def get_default_ttf_font_name():
|
||||
platform = sys.platform
|
||||
if platform == 'win32': return windows_font_name_map.get(system_language, 'cour')
|
||||
if platform[0:3] == 'win': return windows_font_name_map.get(system_language, 'cour')
|
||||
elif platform == 'darwin': return darwin_font_name_map.get(system_language, 'cour')
|
||||
else: return linux_font_name_map.get(system_language, 'cour')
|
||||
|
|
10
main.py
10
main.py
|
@ -3,13 +3,8 @@ if __name__ == "__main__":
|
|||
import multiprocessing
|
||||
multiprocessing.set_start_method("spawn")
|
||||
|
||||
import sys
|
||||
if sys.platform != 'win32':
|
||||
# fix for Linux , Ignoring :
|
||||
# /usr/lib/python3.6/multiprocessing/semaphore_tracker.py:143:
|
||||
# UserWarning: semaphore_tracker: There appear to be 1 leaked semaphores to clean up at shutdown
|
||||
import warnings
|
||||
warnings.simplefilter(action='ignore', category=UserWarning)
|
||||
from core import osex
|
||||
osex.linux_ignore_UserWarning()
|
||||
|
||||
from core.leras import nn
|
||||
nn.initialize_main_env()
|
||||
|
@ -20,7 +15,6 @@ if __name__ == "__main__":
|
|||
import argparse
|
||||
|
||||
from core import pathex
|
||||
from core import osex
|
||||
from pathlib import Path
|
||||
from core.interact import interact as io
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue