-
Notifications
You must be signed in to change notification settings - Fork 164
Installer Update with Cuda 12, Latest Trt support #285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ranareehanaslam
wants to merge
5
commits into
NVIDIA:main
Choose a base branch
from
ranareehanaslam:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a697e40
Update trt.py
ranareehanaslam d3f8627
Update ui_trt.py
ranareehanaslam d690058
The key changes made in the updated installation script
ranareehanaslam c7aeef4
Update install.py
ranareehanaslam 159b4e4
Merge branch 'main' into main
ranareehanaslam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,70 +1,46 @@ | ||
| import launch | ||
| import sys | ||
|
|
||
| python = sys.executable | ||
| import pkg_resources | ||
|
|
||
| def get_installed_version(package_name): | ||
| try: | ||
| return pkg_resources.get_distribution(package_name).version | ||
| except pkg_resources.DistributionNotFound: | ||
| return None | ||
|
|
||
| def install_package(package_name, version_spec=None, uninstall_first=False, extra_index_url=None, no_cache_dir=False): | ||
| package_install_cmd = f"{package_name}{'==' + version_spec if version_spec else ''}" | ||
| if extra_index_url: | ||
| package_install_cmd += f" --extra-index-url {extra_index_url}" | ||
| if no_cache_dir: | ||
| package_install_cmd += " --no-cache-dir" | ||
|
|
||
| if uninstall_first and launch.is_installed(package_name): | ||
| launch.run(["python", "-m", "pip", "uninstall", "-y", package_name], f"removing {package_name}") | ||
|
|
||
| launch.run_pip(f"install {package_install_cmd}", package_name, live=True) | ||
|
|
||
|
|
||
| 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", | ||
| ) | ||
| # TensorRT installation or upgrade | ||
| tensorrt_version = get_installed_version("tensorrt") | ||
| if not tensorrt_version or tensorrt_version != "9.3.0.post12.dev1": | ||
| # nvidia-cudnn-cu11 installation | ||
| if launch.is_installed("nvidia-cudnn-cu12") and get_installed_version("nvidia-cudnn-cu12") != "8.9.6.50": | ||
| install_package("nvidia-cudnn-cu12", "8.9.6.50", uninstall_first=True, no_cache_dir=True) | ||
| install_package("tensorrt", "9.3.0.post12.dev1", uninstall_first=True, extra_index_url="https://pypi.nvidia.com", no_cache_dir=True) | ||
|
|
||
| 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 | ||
| # Polygraphy installation | ||
| 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, | ||
| ) | ||
| install_package("polygraphy", extra_index_url="https://pypi.ngc.nvidia.com", no_cache_dir=True) | ||
|
|
||
| # ONNX GS | ||
| # ONNX Graph Surgeon installation | ||
| 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, | ||
| ) | ||
| install_package("protobuf", "3.20.3", no_cache_dir=True) | ||
| install_package("onnx-graphsurgeon", extra_index_url="https://pypi.ngc.nvidia.com", no_cache_dir=True) | ||
|
|
||
| # OPTIMUM | ||
| # Optimum installation | ||
| if not launch.is_installed("optimum"): | ||
| print("Optimum is not installed! Installing...") | ||
| launch.run_pip( | ||
| "install optimum", | ||
| "optimum", | ||
| live=True, | ||
| ) | ||
|
|
||
| install_package("optimum", no_cache_dir=True) | ||
|
|
||
| install() | ||
| install() |
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Against whitespace changes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might reccomend reconsidering the get-intsalled-version function defaults (no_cache_dir gets passed to the function with true rather than being default) Otherwise good code.