Restrict TRT autoinstall to Linux-only (#7549)

May partially resolve concerns in https://github.com/ultralytics/yolov5/pull/7537#discussion_r856843711
This commit is contained in:
Glenn Jocher authored and GitHub committed 2022-04-23 09:36:36 -07:00
1 parent 404b4fefbe
commit 1f1ec1c3e7
1 file changed
+1
+1
View File
@@ -218,6 +218,7 @@ def export_engine(model, im, file, train, half, simplify, workspace=4, verbose=F
# YOLOv5 TensorRT export https://developer.nvidia.com/tensorrt # YOLOv5 TensorRT export https://developer.nvidia.com/tensorrt
try: try:
assert im.device.type != 'cpu', 'export running on CPU but must be on GPU, i.e. `python export.py --device 0`' assert im.device.type != 'cpu', 'export running on CPU but must be on GPU, i.e. `python export.py --device 0`'
if platform.system() == 'Linux':
check_requirements(('nvidia-tensorrt',), cmds=('-U --index-url https://pypi.ngc.nvidia.com',)) check_requirements(('nvidia-tensorrt',), cmds=('-U --index-url https://pypi.ngc.nvidia.com',))
import tensorrt as trt import tensorrt as trt