Merge pull request #1879 from QingshuChen/develop

speedyspeech support kunlun
pull/1885/head
pollyyan 3 years ago committed by GitHub
commit 018dda6ee9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -174,12 +174,17 @@ def main():
parser.add_argument(
"--inference-dir", type=str, help="dir to save inference models")
parser.add_argument(
"--ngpu", type=int, default=1, help="if ngpu == 0, use cpu.")
"--ngpu", type=int, default=1, help="if ngpu == 0, use cpu or xpu.")
parser.add_argument(
"--nxpu", type=int, default=0, help="if nxpu == 0 and ngpu == 0, use cpu.")
args, _ = parser.parse_known_args()
if args.ngpu == 0:
paddle.set_device("cpu")
if args.nxpu == 0:
paddle.set_device("cpu")
else:
paddle.set_device("xpu")
elif args.ngpu > 0:
paddle.set_device("gpu")
else:

@ -46,7 +46,10 @@ def train_sp(args, config):
# setup running environment correctly
world_size = paddle.distributed.get_world_size()
if (not paddle.is_compiled_with_cuda()) or args.ngpu == 0:
paddle.set_device("cpu")
if (not paddle.is_compiled_with_xpu()) or args.nxpu == 0:
paddle.set_device("cpu")
else:
paddle.set_device("xpu")
else:
paddle.set_device("gpu")
if world_size > 1:
@ -185,7 +188,9 @@ def main():
parser.add_argument("--dev-metadata", type=str, help="dev data.")
parser.add_argument("--output-dir", type=str, help="output dir.")
parser.add_argument(
"--ngpu", type=int, default=1, help="if ngpu == 0, use cpu.")
"--nxpu", type=int, default=0, help="if nxpu == 0 and ngpu == 0, use cpu.")
parser.add_argument(
"--ngpu", type=int, default=1, help="if ngpu == 0, use cpu or xpu")
parser.add_argument(
"--use-relative-path",

Loading…
Cancel
Save