Skip to content

Commit

Permalink
Default to FP16 TensorRT exports ultralytics#6777
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBaldsiefen authored Mar 4, 2022
1 parent c891005 commit fd186fc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions export.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,8 @@ def export_engine(model, im, file, train, half, simplify, workspace=4, verbose=F
for out in outputs:
LOGGER.info(f'{prefix}\toutput "{out.name}" with shape {out.shape} and dtype {out.dtype}')

half &= builder.platform_has_fast_fp16
LOGGER.info(f'{prefix} building FP{16 if half else 32} engine in {f}')
if half:
LOGGER.info(f'{prefix} building FP{16 if builder.platform_has_fast_fp16 else 32} engine in {f}')
if builder.platform_has_fast_fp16:
config.set_flag(trt.BuilderFlag.FP16)
with builder.build_engine(network, config) as engine, open(f, 'wb') as t:
t.write(engine.serialize())
Expand Down

0 comments on commit fd186fc

Please sign in to comment.