|
31 | 31 | __tensorrt_rtx_version__: str = "0.0" |
32 | 32 |
|
33 | 33 | LEGACY_BASE_VERSION_SUFFIX_PATTERN = re.compile("a0$") |
| 34 | +# CI_PIPELINE_ID is the environment variable set by DLFW ci build |
| 35 | +IS_DLFW_CI = os.environ.get("CI_PIPELINE_ID") is not None |
34 | 36 |
|
35 | 37 |
|
36 | 38 | def get_root_dir() -> Path: |
37 | | - return Path( |
38 | | - subprocess.check_output(["git", "rev-parse", "--show-toplevel"]) |
39 | | - .decode("ascii") |
40 | | - .strip() |
41 | | - ) |
| 39 | + return Path(__file__).parent.absolute() |
42 | 40 |
|
43 | 41 |
|
44 | 42 | def get_git_revision_short_hash() -> str: |
45 | | - return ( |
46 | | - subprocess.check_output(["git", "rev-parse", "--short", "HEAD"]) |
47 | | - .decode("ascii") |
48 | | - .strip() |
49 | | - ) |
| 43 | + # DLFW ci build does not have git |
| 44 | + try: |
| 45 | + return ( |
| 46 | + subprocess.check_output(["git", "rev-parse", "--short", "HEAD"]) |
| 47 | + .decode("ascii") |
| 48 | + .strip() |
| 49 | + ) |
| 50 | + except: |
| 51 | + print("WARNING: Could not get git revision short hash, using default one") |
| 52 | + # in release/ngc/25.10 branch this is the commit hash of the pytorch commit that is used for dlfw package |
| 53 | + return "0000000" |
50 | 54 |
|
51 | 55 |
|
52 | 56 | def get_base_version() -> str: |
@@ -718,58 +722,57 @@ def run(self): |
718 | 722 | with open(os.path.join(get_root_dir(), "README.md"), "r", encoding="utf-8") as fh: |
719 | 723 | long_description = fh.read() |
720 | 724 |
|
| 725 | +base_requirements = [ |
| 726 | + "packaging>=23", |
| 727 | + "typing-extensions>=4.7.0", |
| 728 | + "dllist", |
| 729 | +] |
721 | 730 |
|
722 | | -def get_requirements(): |
723 | | - requirements = [ |
724 | | - "packaging>=23", |
725 | | - "typing-extensions>=4.7.0", |
726 | | - "dllist", |
727 | | - ] |
728 | 731 |
|
| 732 | +def get_requirements(): |
729 | 733 | if IS_JETPACK: |
730 | | - requirements.extend( |
731 | | - [ |
732 | | - "torch>=2.8.0,<2.9.0", |
733 | | - "tensorrt>=10.3.0,<10.4.0", |
734 | | - "numpy<2.0.0", |
735 | | - ] |
736 | | - ) |
| 734 | + requirements = get_jetpack_requirements() |
737 | 735 | elif IS_SBSA: |
738 | | - requirements.extend( |
739 | | - [ |
740 | | - "torch>=2.9.0.dev,<2.10.0", |
741 | | - "tensorrt>=10.12.0,<10.13.0", |
742 | | - "tensorrt-cu12>=10.12.0,<10.13.0", |
743 | | - "tensorrt-cu12-bindings>=10.12.0,<10.13.0", |
744 | | - "tensorrt-cu12-libs>=10.12.0,<10.13.0", |
745 | | - "numpy", |
746 | | - ] |
747 | | - ) |
| 736 | + requirements = get_sbsa_requirements() |
748 | 737 | else: |
749 | | - requirements.extend( |
750 | | - [ |
751 | | - "torch>=2.9.0.dev,<2.10.0", |
752 | | - "numpy", |
753 | | - ] |
754 | | - ) |
755 | | - if USE_TRT_RTX: |
756 | | - requirements.extend( |
757 | | - [ |
758 | | - "tensorrt-rtx>=1.0.0.21", |
| 738 | + # standard linux and windows requirements |
| 739 | + requirements = base_requirements + ["numpy"] |
| 740 | + if not IS_DLFW_CI: |
| 741 | + requirements = requirements + ["torch>=2.9.0.dev,<2.10.0"] |
| 742 | + if USE_TRT_RTX: |
| 743 | + requirements = requirements + [ |
| 744 | + "tensorrt_rtx>=1.0.0.21", |
759 | 745 | ] |
760 | | - ) |
761 | | - else: |
762 | | - requirements.extend( |
763 | | - [ |
| 746 | + else: |
| 747 | + requirements = requirements + [ |
764 | 748 | "tensorrt>=10.12.0,<10.13.0", |
765 | 749 | "tensorrt-cu12>=10.12.0,<10.13.0", |
766 | 750 | "tensorrt-cu12-bindings>=10.12.0,<10.13.0", |
767 | 751 | "tensorrt-cu12-libs>=10.12.0,<10.13.0", |
768 | 752 | ] |
769 | | - ) |
770 | 753 | return requirements |
771 | 754 |
|
772 | 755 |
|
| 756 | +def get_jetpack_requirements(): |
| 757 | + jetpack_requirements = base_requirements + ["numpy<2.0.0"] |
| 758 | + if IS_DLFW_CI: |
| 759 | + return jetpack_requirements |
| 760 | + return jetpack_requirements + ["torch>=2.8.0,<2.9.0", "tensorrt>=10.3.0,<10.4.0"] |
| 761 | + |
| 762 | + |
| 763 | +def get_sbsa_requirements(): |
| 764 | + sbsa_requirements = base_requirements + ["numpy"] |
| 765 | + if IS_DLFW_CI: |
| 766 | + return sbsa_requirements |
| 767 | + return sbsa_requirements + [ |
| 768 | + "torch>=2.9.0.dev,<2.10.0", |
| 769 | + "tensorrt>=10.12.0,<10.13.0", |
| 770 | + "tensorrt-cu12>=10.12.0,<10.13.0", |
| 771 | + "tensorrt-cu12-bindings>=10.12.0,<10.13.0", |
| 772 | + "tensorrt-cu12-libs>=10.12.0,<10.13.0", |
| 773 | + ] |
| 774 | + |
| 775 | + |
773 | 776 | setup( |
774 | 777 | name="torch_tensorrt", |
775 | 778 | ext_modules=ext_modules, |
|
0 commit comments