Loading .gitignore +0 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,6 @@ result ballontranslator/data/models ballontranslator/data/testpacks/eng_dontupload ballontranslator/data/testpacks/testpacks ballontranslator/data/*.png release tmp.py Loading ballontranslator/__main__.py +7 −2 Original line number Diff line number Diff line Loading @@ -16,13 +16,18 @@ def main(): else: os.environ['QT_API'] = args.qt_api import qtpy from qtpy.QtWidgets import QApplication from qtpy.QtCore import QTranslator, QLocale from ui.mainwindow import MainWindow from ui.constants import PROGRAM_PATH from ui import constants os.chdir(PROGRAM_PATH) if qtpy.API_NAME[-1] == '6': constants.FLAG_QT6 = True os.chdir(constants.PROGRAM_PATH) app = QApplication(sys.argv) translator = QTranslator() translator.load( Loading ballontranslator/dl/inpaint/__init__.py +12 −10 Original line number Diff line number Diff line Loading @@ -112,7 +112,8 @@ class AOTInpainter(InpainterBase): 'type': 'selector', 'options': [ 'cpu', 'cuda' 'cuda', 'hip' ], 'select': DEFAULT_DEVICE }, Loading Loading @@ -158,9 +159,9 @@ class AOTInpainter(InpainterBase): mask_torch[mask_torch < 0.5] = 0 mask_torch[mask_torch >= 0.5] = 1 if self.device == 'cuda': img_torch = img_torch.cuda() mask_torch = mask_torch.cuda() if self.device != 'cpu': img_torch = img_torch.to(self.device) mask_torch = mask_torch.to(self.device) img_torch *= (1 - mask_torch) return img_torch, mask_torch, img_original, mask_original, pad_bottom, pad_right Loading Loading @@ -217,7 +218,8 @@ class LamaInpainterMPE(InpainterBase): 'type': 'selector', 'options': [ 'cpu', 'cuda' 'cuda', 'hip' ], 'select': DEFAULT_DEVICE } Loading Loading @@ -266,11 +268,11 @@ class LamaInpainterMPE(InpainterBase): rel_pos = torch.LongTensor(rel_pos).unsqueeze_(0) direct = torch.LongTensor(direct).unsqueeze_(0) if self.device == 'cuda': img_torch = img_torch.cuda() mask_torch = mask_torch.cuda() rel_pos = rel_pos.cuda() direct = direct.cuda() if self.device != 'cpu': img_torch = img_torch.to(self.device) mask_torch = mask_torch.to(self.device) rel_pos = rel_pos.to(self.device) direct = direct.to(self.device) img_torch *= (1 - mask_torch) return img_torch, mask_torch, rel_pos, direct, img_original, mask_original, pad_bottom, pad_right Loading ballontranslator/dl/moduleparamparser.py +6 −1 Original line number Diff line number Diff line Loading @@ -18,4 +18,9 @@ class ModuleParamParser: import torch if hasattr(torch, 'cuda'): DEFAULT_DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu' else: DEFAULT_DEVICE = 'cpu' ballontranslator/dl/ocr/__init__.py +6 −3 Original line number Diff line number Diff line Loading @@ -63,7 +63,8 @@ class OCRMIT32px(OCRBase): 'type': 'selector', 'options': [ 'cpu', 'cuda' 'cuda', 'hip' ], 'select': DEFAULT_DEVICE }, Loading Loading @@ -115,7 +116,8 @@ class MangaOCR(OCRBase): 'type': 'selector', 'options': [ 'cpu', 'cuda' 'cuda', 'hip' ], 'select': DEFAULT_DEVICE } Loading Loading @@ -174,7 +176,8 @@ class OCRMIT48pxCTC(OCRBase): 'type': 'selector', 'options': [ 'cpu', 'cuda' 'cuda', 'hip' ], 'select': DEFAULT_DEVICE }, Loading Loading
.gitignore +0 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,6 @@ result ballontranslator/data/models ballontranslator/data/testpacks/eng_dontupload ballontranslator/data/testpacks/testpacks ballontranslator/data/*.png release tmp.py Loading
ballontranslator/__main__.py +7 −2 Original line number Diff line number Diff line Loading @@ -16,13 +16,18 @@ def main(): else: os.environ['QT_API'] = args.qt_api import qtpy from qtpy.QtWidgets import QApplication from qtpy.QtCore import QTranslator, QLocale from ui.mainwindow import MainWindow from ui.constants import PROGRAM_PATH from ui import constants os.chdir(PROGRAM_PATH) if qtpy.API_NAME[-1] == '6': constants.FLAG_QT6 = True os.chdir(constants.PROGRAM_PATH) app = QApplication(sys.argv) translator = QTranslator() translator.load( Loading
ballontranslator/dl/inpaint/__init__.py +12 −10 Original line number Diff line number Diff line Loading @@ -112,7 +112,8 @@ class AOTInpainter(InpainterBase): 'type': 'selector', 'options': [ 'cpu', 'cuda' 'cuda', 'hip' ], 'select': DEFAULT_DEVICE }, Loading Loading @@ -158,9 +159,9 @@ class AOTInpainter(InpainterBase): mask_torch[mask_torch < 0.5] = 0 mask_torch[mask_torch >= 0.5] = 1 if self.device == 'cuda': img_torch = img_torch.cuda() mask_torch = mask_torch.cuda() if self.device != 'cpu': img_torch = img_torch.to(self.device) mask_torch = mask_torch.to(self.device) img_torch *= (1 - mask_torch) return img_torch, mask_torch, img_original, mask_original, pad_bottom, pad_right Loading Loading @@ -217,7 +218,8 @@ class LamaInpainterMPE(InpainterBase): 'type': 'selector', 'options': [ 'cpu', 'cuda' 'cuda', 'hip' ], 'select': DEFAULT_DEVICE } Loading Loading @@ -266,11 +268,11 @@ class LamaInpainterMPE(InpainterBase): rel_pos = torch.LongTensor(rel_pos).unsqueeze_(0) direct = torch.LongTensor(direct).unsqueeze_(0) if self.device == 'cuda': img_torch = img_torch.cuda() mask_torch = mask_torch.cuda() rel_pos = rel_pos.cuda() direct = direct.cuda() if self.device != 'cpu': img_torch = img_torch.to(self.device) mask_torch = mask_torch.to(self.device) rel_pos = rel_pos.to(self.device) direct = direct.to(self.device) img_torch *= (1 - mask_torch) return img_torch, mask_torch, rel_pos, direct, img_original, mask_original, pad_bottom, pad_right Loading
ballontranslator/dl/moduleparamparser.py +6 −1 Original line number Diff line number Diff line Loading @@ -18,4 +18,9 @@ class ModuleParamParser: import torch if hasattr(torch, 'cuda'): DEFAULT_DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu' else: DEFAULT_DEVICE = 'cpu'
ballontranslator/dl/ocr/__init__.py +6 −3 Original line number Diff line number Diff line Loading @@ -63,7 +63,8 @@ class OCRMIT32px(OCRBase): 'type': 'selector', 'options': [ 'cpu', 'cuda' 'cuda', 'hip' ], 'select': DEFAULT_DEVICE }, Loading Loading @@ -115,7 +116,8 @@ class MangaOCR(OCRBase): 'type': 'selector', 'options': [ 'cpu', 'cuda' 'cuda', 'hip' ], 'select': DEFAULT_DEVICE } Loading Loading @@ -174,7 +176,8 @@ class OCRMIT48pxCTC(OCRBase): 'type': 'selector', 'options': [ 'cpu', 'cuda' 'cuda', 'hip' ], 'select': DEFAULT_DEVICE }, Loading