Skip to content

Commit

Permalink
Merge pull request meituan#297 from LRY89757/patch-1
Browse files Browse the repository at this point in the history
Fix the bug of gpu device specified when export onnx
  • Loading branch information
shensheng272 authored Jul 15, 2022
2 parents 626af5b + 783be34 commit 05da147
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion deploy/ONNX/export_onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

# Check device
cuda = args.device != 'cpu' and torch.cuda.is_available()
device = torch.device('cuda:0' if cuda else 'cpu')
device = torch.device(f'cuda:{args.device}' if cuda else 'cpu')
assert not (device.type == 'cpu' and args.half), '--half only compatible with GPU export, i.e. use --device 0'
# Load PyTorch model
model = load_checkpoint(args.weights, map_location=device, inplace=True, fuse=True) # load FP32 model
Expand Down

0 comments on commit 05da147

Please sign in to comment.