File size: 2,245 Bytes
c31821c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | import launch
import sys
python = sys.executable
def install():
if not launch.is_installed("importlib_metadata"):
launch.run_pip("install importlib_metadata", "importlib_metadata", live=True)
from importlib_metadata import version
if launch.is_installed("tensorrt"):
if not version("tensorrt") == "9.0.1.post11.dev4":
launch.run(
["python", "-m", "pip", "uninstall", "-y", "tensorrt"],
"removing old version of tensorrt",
)
if not launch.is_installed("tensorrt"):
print("TensorRT is not installed! Installing...")
launch.run_pip(
"install nvidia-cudnn-cu11==8.9.4.25 --no-cache-dir", "nvidia-cudnn-cu11"
)
launch.run_pip(
"install --pre --extra-index-url https://pypi.nvidia.com tensorrt==9.0.1.post11.dev4 --no-cache-dir",
"tensorrt",
live=True,
)
launch.run(
["python", "-m", "pip", "uninstall", "-y", "nvidia-cudnn-cu11"],
"removing nvidia-cudnn-cu11",
)
if launch.is_installed("nvidia-cudnn-cu11"):
if version("nvidia-cudnn-cu11") == "8.9.4.25":
launch.run(
["python", "-m", "pip", "uninstall", "-y", "nvidia-cudnn-cu11"],
"removing nvidia-cudnn-cu11",
)
# Polygraphy
if not launch.is_installed("polygraphy"):
print("Polygraphy is not installed! Installing...")
launch.run_pip(
"install polygraphy --extra-index-url https://pypi.ngc.nvidia.com",
"polygraphy",
live=True,
)
# ONNX GS
if not launch.is_installed("onnx_graphsurgeon"):
print("GS is not installed! Installing...")
launch.run_pip("install protobuf==3.20.2", "protobuf", live=True)
launch.run_pip(
"install onnx-graphsurgeon --extra-index-url https://pypi.ngc.nvidia.com",
"onnx-graphsurgeon",
live=True,
)
# OPTIMUM
if not launch.is_installed("optimum"):
print("Optimum is not installed! Installing...")
launch.run_pip(
"install optimum",
"optimum",
live=True,
)
install()
|