Skip to content

Commit

Permalink
raise error when run on cpu but set use_gpu as True
Browse files Browse the repository at this point in the history
  • Loading branch information
LDOUBLEV committed Aug 18, 2021
1 parent 49c4a3a commit 30b10d2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tools/infer/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ def create_predictor(args, mode, logger):
precision = inference.PrecisionType.Float32

if args.use_gpu:
gpu_id = get_infer_gpuid()
if gpu_id is None:
raise ValueError(
"Not found GPU in current device. Please check your device or set args.use_gpu as False"
)
config.enable_use_gpu(args.gpu_mem, 0)
if args.use_tensorrt:
config.enable_tensorrt_engine(
Expand Down

0 comments on commit 30b10d2

Please sign in to comment.