代码拉取完成,页面将自动刷新
import launch
import sys
from importlib_metadata import version
python = sys.executable
def install():
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()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。