未验证 提交 597ee656 编写于 作者: D duanyanhui 提交者: GitHub

fix npu tipc script (#8213)

上级 73291012
...@@ -45,7 +45,7 @@ class JDE_Detector(Detector): ...@@ -45,7 +45,7 @@ class JDE_Detector(Detector):
""" """
Args: Args:
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU, default is CPU device (str): Choose the device you want to run, it can be: CPU/GPU/XPU/NPU, default is CPU
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16) run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
batch_size (int): size of pre batch in inference batch_size (int): size of pre batch in inference
trt_min_shape (int): min shape for dynamic shape in trt trt_min_shape (int): min shape for dynamic shape in trt
...@@ -502,7 +502,7 @@ if __name__ == '__main__': ...@@ -502,7 +502,7 @@ if __name__ == '__main__':
FLAGS = parser.parse_args() FLAGS = parser.parse_args()
print_arguments(FLAGS) print_arguments(FLAGS)
FLAGS.device = FLAGS.device.upper() FLAGS.device = FLAGS.device.upper()
assert FLAGS.device in ['CPU', 'GPU', 'XPU' assert FLAGS.device in ['CPU', 'GPU', 'XPU', 'NPU'
], "device should be CPU, GPU or XPU" ], "device should be CPU, GPU, NPU or XPU"
main() main()
...@@ -46,7 +46,7 @@ class SDE_Detector(Detector): ...@@ -46,7 +46,7 @@ class SDE_Detector(Detector):
Args: Args:
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
tracker_config (str): tracker config path tracker_config (str): tracker config path
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU, default is CPU device (str): Choose the device you want to run, it can be: CPU/GPU/XPU/NPU, default is CPU
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16) run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
batch_size (int): size of pre batch in inference batch_size (int): size of pre batch in inference
trt_min_shape (int): min shape for dynamic shape in trt trt_min_shape (int): min shape for dynamic shape in trt
...@@ -946,7 +946,7 @@ if __name__ == '__main__': ...@@ -946,7 +946,7 @@ if __name__ == '__main__':
FLAGS = parser.parse_args() FLAGS = parser.parse_args()
print_arguments(FLAGS) print_arguments(FLAGS)
FLAGS.device = FLAGS.device.upper() FLAGS.device = FLAGS.device.upper()
assert FLAGS.device in ['CPU', 'GPU', 'XPU' assert FLAGS.device in ['CPU', 'GPU', 'XPU', 'NPU'
], "device should be CPU, GPU or XPU" ], "device should be CPU, GPU, NPU or XPU"
main() main()
...@@ -64,7 +64,7 @@ def argsparser(): ...@@ -64,7 +64,7 @@ def argsparser():
"--device", "--device",
type=str, type=str,
default='cpu', default='cpu',
help="Choose the device you want to run, it can be: CPU/GPU/XPU, default is CPU." help="Choose the device you want to run, it can be: CPU/GPU/XPU/NPU, default is CPU."
) )
parser.add_argument( parser.add_argument(
"--use_gpu", "--use_gpu",
......
...@@ -33,6 +33,8 @@ FILENAME=$1 ...@@ -33,6 +33,8 @@ FILENAME=$1
# change gpu to npu in tipc txt configs # change gpu to npu in tipc txt configs
sed -i "s/use_gpu:True/use_npu:True/g" $FILENAME sed -i "s/use_gpu:True/use_npu:True/g" $FILENAME
sed -i "s/--device:gpu|cpu/--device:npu|cpu/g" $FILENAME sed -i "s/--device:gpu|cpu/--device:npu|cpu/g" $FILENAME
sed -i "s/--device:gpu/--device:npu/g" $FILENAME
sed -i "s/--device:cpu|gpu/--device:cpu|npu/g" $FILENAME
sed -i "s/trainer:pact_train/trainer:norm_train/g" $FILENAME sed -i "s/trainer:pact_train/trainer:norm_train/g" $FILENAME
sed -i "s/trainer:fpgm_train/trainer:norm_train/g" $FILENAME sed -i "s/trainer:fpgm_train/trainer:norm_train/g" $FILENAME
sed -i "s/--slim_config _template_pact/ /g" $FILENAME sed -i "s/--slim_config _template_pact/ /g" $FILENAME
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册