Skip to content
Snippets Groups Projects
Commit 244065c7 authored by huangbo77's avatar huangbo77
Browse files

fixes wavenet GPU and CPU

parent 20855fa1
No related branches found
No related tags found
No related merge requests found
......@@ -195,10 +195,10 @@ def save_ref_audio(hparam, ref, length, target_wav_path_):
if __name__ == '__main__':
device_id = int(os.getenv("DEVICE_ID"))
if args.platform == 'CPU':
if args.platform != 'Ascend':
context.set_context(mode=0, device_target=args.platform, save_graphs=False)
else:
device_id = int(os.getenv("DEVICE_ID"))
context.set_context(mode=1, device_target=args.platform, device_id=device_id)
speaker_id = int(args.speaker_id) if args.speaker_id != '' else None
......
......@@ -15,7 +15,8 @@
# ============================================================================
if [ $# == 5 ]
then
python ./evaluate.py --data_path=$1 --preset=$2 --pretrain_ckpt=$3 --is_numpy --output_path=$5 > eval.log 2>&1 &
python ./evaluate.py --data_path=$1 --preset=$2 --pretrain_ckpt=$3 --is_numpy --output_path=$5 --platform=CPU \
> eval.log 2>&1 &
else
python ./evaluate.py --data_path=$1 --preset=$2 --pretrain_ckpt=$3 --output_path=$4 > eval.log 2>&1 &
python ./evaluate.py --data_path=$1 --preset=$2 --pretrain_ckpt=$3 --output_path=$4 --platform=CPU > eval.log 2>&1 &
fi
......@@ -66,10 +66,15 @@ if __name__ == '__main__':
else:
context.set_context(mode=context.PYNATIVE_MODE, device_target=target, save_graphs=False)
rank_id = int(os.getenv('RANK_ID'))
group_size = int(os.getenv('RANK_SIZE'))
device_id = int(os.getenv("DEVICE_ID"))
context.set_context(device_id=device_id)
if target == 'Ascend':
rank_id = int(os.getenv('RANK_ID'))
group_size = int(os.getenv('RANK_SIZE'))
device_id = int(os.getenv("DEVICE_ID"))
context.set_context(device_id=device_id)
else:
rank_id = 0
group_size = 1
device_id = 0
if args.is_distributed:
context.reset_auto_parallel_context()
......@@ -154,7 +159,7 @@ if __name__ == '__main__':
else:
lr = get_lr(hparams.optimizer_params["lr"], hparams.nepochs, step_size_per_epoch)
lr = Tensor(lr)
if arg.checkpoint != '':
if args.checkpoint != '':
param_dict = load_checkpoint(args.checkpoint)
load_param_into_net(model, param_dict)
print('Successfully loading the pre-trained model')
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment