Skip to content

Commit

Permalink
修改GPUID的配置读取
Browse files Browse the repository at this point in the history
  • Loading branch information
TransparentLC committed Mar 6, 2023
1 parent a11366f commit 2bb85f6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
10 changes: 5 additions & 5 deletions i18n.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ResizeModeWidth = 等比放大到宽度
ResizeModeHeight = 等比放大到高度
StartProcessing = 开始
DownsampleMode = 降采样方式
UsedGPUID = 使用的 GPU ID
UsedGPUID = 使用的 GPU ID(-1 为自动选择)
TileSize = 拆分大小
TileSizeAuto = 自动决定
PreferWebP = 优先保存为无损 WebP
Expand Down Expand Up @@ -46,7 +46,7 @@ ResizeModeWidth = 等比放大到寬度
ResizeModeHeight = 等比放大到高度
StartProcessing = 開始
DownsampleMode = 降採樣方式
UsedGPUID = 使用的 GPU ID
UsedGPUID = 使用的 GPU ID(-1 為自動選擇)
TileSize = 拆分大小
TileSizeAuto = 自動決定
PreferWebP = 優先保存為無損 WebP
Expand Down Expand Up @@ -83,7 +83,7 @@ ResizeModeWidth = 等比放大到寬度
ResizeModeHeight = 等比放大到高度
StartProcessing = 開始
DownsampleMode = 降採樣方式
UsedGPUID = 使用的 GPU ID
UsedGPUID = 使用的 GPU ID(-1 為自動選擇)
TileSize = 拆分大小
TileSizeAuto = 自動決定
PreferWebP = 優先保存為無損 WebP
Expand Down Expand Up @@ -120,7 +120,7 @@ ResizeModeWidth = Scale to width
ResizeModeHeight = Scale to height
StartProcessing = Start
DownsampleMode = Downsampling algorithm
UsedGPUID = GPU ID
UsedGPUID = GPU ID (Use -1 for auto select)
TileSize = Tile size
TileSizeAuto = Auto
PreferWebP = Prefer lossless WebP output
Expand Down Expand Up @@ -157,7 +157,7 @@ ResizeModeWidth = Масштаб за шириною
ResizeModeHeight = Масштаб за висотою
StartProcessing = Запуск
DownsampleMode = Алгоритм дискретизації
UsedGPUID = ідентифікатор графічного процесора
UsedGPUID = ідентифікатор графічного процесора (Використовуйте -1 для автоматичного вибору)
TileSize = Розмір плитки
TileSizeAuto = Авто
PreferWebP = Віддавати перевагу виводу без втрат у WebP
Expand Down
5 changes: 2 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def __init__(self, parent: tk.Tk):
'ResizeHeight': 1024,
'Model': self.models[0],
'DownsampleIndex': 0,
'GPUID': 0,
'GPUID': -1,
'TileSizeIndex': 0,
'LossyQuality': 80,
'UseWebP': False,
Expand Down Expand Up @@ -178,8 +178,7 @@ def setupWidgets(self):
self.comboDownsample.pack(padx=10, pady=5, fill=tk.X)
self.comboDownsample.bind('<<ComboboxSelected>>', self.comboDownsample_click)
ttk.Label(self.frameAdvancedConfigLeft, text=i18n.getTranslatedString('UsedGPUID')).pack(padx=10, pady=5, fill=tk.X)
self.spinGPUID = ttk.Spinbox(self.frameAdvancedConfigLeft, from_=0, to=7, increment=1, width=12, textvariable=self.varintGPUID)
self.spinGPUID.set(0)
self.spinGPUID = ttk.Spinbox(self.frameAdvancedConfigLeft, from_=-1, to=7, increment=1, width=12, textvariable=self.varintGPUID)
self.spinGPUID.pack(padx=10, pady=5, fill=tk.X)
ttk.Label(self.frameAdvancedConfigLeft, text=i18n.getTranslatedString('TileSize')).pack(padx=10, pady=5, fill=tk.X)
self.comboTileSize = ttk.Combobox(self.frameAdvancedConfigLeft, state='readonly', values=(i18n.getTranslatedString('TileSizeAuto'), *self.tileSize[1:]))
Expand Down
2 changes: 1 addition & 1 deletion task.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def run(self) -> None:
'-s', str(self.config.modelFactor),
'-t', str(self.config.tileSize),
'-n', self.config.model,
'-g', str(self.config.gpuID),
'-g', 'auto' if self.config.gpuID < 0 else str(self.config.gpuID),
('-x' if self.config.useTTA else ''),
)
with subprocess.Popen(
Expand Down

0 comments on commit 2bb85f6

Please sign in to comment.