Spaces:
No application file
No application file
Update config.py
Browse files
config.py
CHANGED
|
@@ -73,42 +73,7 @@ class Config:
|
|
| 73 |
d[config_file] = json.load(f)
|
| 74 |
return d
|
| 75 |
|
| 76 |
-
@staticmethod
|
| 77 |
-
def arg_parse() -> tuple:
|
| 78 |
-
exe = sys.executable or "python"
|
| 79 |
-
parser = argparse.ArgumentParser()
|
| 80 |
-
parser.add_argument("--port", type=int, default=7865, help="Listen port")
|
| 81 |
-
parser.add_argument("--pycmd", type=str, default=exe, help="Python command")
|
| 82 |
-
parser.add_argument("--colab", action="store_true", help="Launch in colab")
|
| 83 |
-
parser.add_argument(
|
| 84 |
-
"--noparallel", action="store_true", help="Disable parallel processing"
|
| 85 |
-
)
|
| 86 |
-
parser.add_argument(
|
| 87 |
-
"--noautoopen",
|
| 88 |
-
action="store_true",
|
| 89 |
-
help="Do not open in browser automatically",
|
| 90 |
-
)
|
| 91 |
-
parser.add_argument(
|
| 92 |
-
"--dml",
|
| 93 |
-
action="store_true",
|
| 94 |
-
help="torch_dml",
|
| 95 |
-
)
|
| 96 |
-
cmd_opts = parser.parse_args()
|
| 97 |
|
| 98 |
-
cmd_opts.port = cmd_opts.port if 0 <= cmd_opts.port <= 65535 else 7865
|
| 99 |
-
|
| 100 |
-
return (
|
| 101 |
-
cmd_opts.pycmd,
|
| 102 |
-
cmd_opts.port,
|
| 103 |
-
cmd_opts.colab,
|
| 104 |
-
cmd_opts.noparallel,
|
| 105 |
-
cmd_opts.noautoopen,
|
| 106 |
-
cmd_opts.dml,
|
| 107 |
-
)
|
| 108 |
-
|
| 109 |
-
# has_mps is only available in nightly pytorch (for now) and MasOS 12.3+.
|
| 110 |
-
# check `getattr` and try it for compatibility
|
| 111 |
-
@staticmethod
|
| 112 |
def has_mps() -> bool:
|
| 113 |
if not torch.backends.mps.is_available():
|
| 114 |
return False
|
|
|
|
| 73 |
d[config_file] = json.load(f)
|
| 74 |
return d
|
| 75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
def has_mps() -> bool:
|
| 78 |
if not torch.backends.mps.is_available():
|
| 79 |
return False
|