Paddle jetson nano部署CPU推理正常 GPU推理报错

6pp0gazn  于 2021-11-29  发布在  Java
关注(0)|答案(25)|浏览(720)

问题类型:模型部署
问题描述
部署环境:Jetson nano,Jetpack 4.5 python3.6+nv_jetson-cuda10.2-cudnn8-trt7
安装官方提供的库 paddlepaddle_gpu-2.1.0-cp36-cp36m-linux_aarch64.whl
代码步骤如:https://paddleinference.paddlepaddle.org.cn/demo_tutorial/cuda_jetson_demo.html
config.EnableUseGpu(500, 0);
[使用GPU报错,停用GPU正常。报错代码如下图

t40tm48m

t40tm48m1#

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网API文档常见问题历史IssueAI社区来寻求解答。祝您生活愉快~

Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the APIFAQGithub Issue and AI community to get the answer.Have a nice day!

ycl3bljg

ycl3bljg2#

关闭TensorRT 是否能正常预测,你的模型是哪个

1wnzp6jl

1wnzp6jl3#

用的mobileNetV1 关闭TensorRT也一样

1qczuiv0

1qczuiv04#

我在Nano上测试了一下,可以运行GPU版本的预测

Nano 环境:

使用的模型是:
MobileNetV1_infer.tar.zip

执行预测的逻辑是:python3 infer.py --model_file ./MobileNetV1_infer/inference.pdmodel --params_file ./MobileNetV1_infer/inference.pdiparams
代码是:

import paddle
import argparse
import numpy as np
import paddle.inference as inference
from paddle.inference import Config
from paddle.inference import create_predictor
import cv2
import os

def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument("--model_file", type=str, help="model filename")
    parser.add_argument("--params_file", type=str, help="parameter filename")
    parser.add_argument("--batch_size", type=int, default=1, help="batch size")

    return parser.parse_args()

def set_config(args):
    config = Config(args.model_file, args.params_file)
    config.disable_gpu()
    config.switch_use_feed_fetch_ops(False)
    config.switch_specify_input_names(True)
    return config

def main():
    args = parse_args()

    # 设置AnalysisConfig
    config = set_config(args)
    config.enable_use_gpu(200, 0) # use_gpu
    config.enable_memory_optim()
    config.enable_tensorrt_engine(
                precision_mode=inference.PrecisionType.Float32,
                max_batch_size=2)
    predictor = create_predictor(config)
    input_names = predictor.get_input_names()
    input_handle = predictor.get_input_handle(input_names[0])

    fake_input = np.random.randn(1, 3, 224, 224).astype("float32")
    print("fake_input:",fake_input.shape)
    input_handle.copy_from_cpu(fake_input)
    # 运行predictor
    predictor.run()
    # 获取输出
    output_names = predictor.get_output_names()
    output_handle = predictor.get_output_handle(output_names[0])
    out = output_handle.copy_to_cpu()   # numpy.ndarray类型

    print("out: ",out.shape)

main()
mwg9r5ms

mwg9r5ms5#

我手中版本是nano 2G版本,运行至这个地方一直没动静了

yptwkmov

yptwkmov8#

你关闭TRT预测吧,把这一行屏蔽掉

config.enable_tensorrt_engine(
                precision_mode=inference.PrecisionType.Float32,
                max_batch_size=2)
deikduxw

deikduxw9#

还是一样没动静。。。

44u64gxh

44u64gxh10#

关闭GPU就正常了

xqkwcwgp

xqkwcwgp12#

测试其他模型是否能GPU预测,如果也不行,那应该是环境问题,可以尝试

  • 检查cuda、cudnn是否都安装好了
  • 更换其他paddle版本
zfciruhq

zfciruhq13#

cuda cudnn 都没问题
paddle发布了2.1.1在哪可下载适合的whl库文件?

4uqofj5v

4uqofj5v15#

我看到桌面出现System throttled due to over-current,会不会是过流受限制了?

相关问题