Format code (#1011)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
github-actions[bot] 2023-08-15 10:40:59 +08:00 committed by GitHub
parent 72a4494c55
commit 56917dbeca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 7 deletions

View File

@ -36,7 +36,7 @@ class Config:
self.iscolab, self.iscolab,
self.noparallel, self.noparallel,
self.noautoopen, self.noautoopen,
self.dml self.dml,
) = self.arg_parse() ) = self.arg_parse()
self.instead = "" self.instead = ""
self.x_pad, self.x_query, self.x_center, self.x_max = self.device_config() self.x_pad, self.x_query, self.x_center, self.x_max = self.device_config()
@ -71,7 +71,7 @@ class Config:
cmd_opts.colab, cmd_opts.colab,
cmd_opts.noparallel, cmd_opts.noparallel,
cmd_opts.noautoopen, cmd_opts.noautoopen,
cmd_opts.dml cmd_opts.dml,
) )
# has_mps is only available in nightly pytorch (for now) and MasOS 12.3+. # has_mps is only available in nightly pytorch (for now) and MasOS 12.3+.
@ -149,26 +149,38 @@ class Config:
if self.dml: if self.dml:
print("use DirectML instead") print("use DirectML instead")
try: try:
os.rename("runtime\Lib\site-packages\onnxruntime","runtime\Lib\site-packages\onnxruntime-cuda") os.rename(
"runtime\Lib\site-packages\onnxruntime",
"runtime\Lib\site-packages\onnxruntime-cuda",
)
except: except:
pass pass
try: try:
os.rename("runtime\Lib\site-packages\onnxruntime-dml","runtime\Lib\site-packages\onnxruntime") os.rename(
"runtime\Lib\site-packages\onnxruntime-dml",
"runtime\Lib\site-packages\onnxruntime",
)
except: except:
pass pass
import torch_directml import torch_directml
self.device = torch_directml.device(torch_directml.default_device()) self.device = torch_directml.device(torch_directml.default_device())
self.is_half = False self.is_half = False
else: else:
if self.instead: if self.instead:
print(f"use {self.instead} instead") print(f"use {self.instead} instead")
try: try:
os.rename("runtime\Lib\site-packages\onnxruntime","runtime\Lib\site-packages\onnxruntime-dml") os.rename(
"runtime\Lib\site-packages\onnxruntime",
"runtime\Lib\site-packages\onnxruntime-dml",
)
except: except:
pass pass
try: try:
os.rename("runtime\Lib\site-packages\onnxruntime-cuda","runtime\Lib\site-packages\onnxruntime") os.rename(
"runtime\Lib\site-packages\onnxruntime-cuda",
"runtime\Lib\site-packages\onnxruntime",
)
except: except:
pass pass
return x_pad, x_query, x_center, x_max return x_pad, x_query, x_center, x_max