@@ -701,19 +701,6 @@ def create_dockerfile(ddir, dockerfile_name, argmap):
701
701
702
702
703
703
def container_build (images ):
704
- # Set the docker build-args based on container version
705
- if FLAGS .container_version in CONTAINER_VERSION_MAP :
706
- if FLAGS .upstream_container_version is not None :
707
- upstream_container_version = FLAGS .upstream_container_version
708
- else :
709
- upstream_container_version = CONTAINER_VERSION_MAP [
710
- FLAGS .container_version ][0 ]
711
- onnx_runtime_version = CONTAINER_VERSION_MAP [FLAGS .container_version ][1 ]
712
- onnx_runtime_openvino_version = CONTAINER_VERSION_MAP [
713
- FLAGS .container_version ][2 ]
714
- else :
715
- fail ('unsupported container version {}' .format (FLAGS .container_version ))
716
-
717
704
# The build and install directories within the container.
718
705
build_dir = os .path .join (os .sep , 'tmp' , 'tritonbuild' )
719
706
install_dir = os .path .join (os .sep , 'tmp' , 'tritonbuild' , 'install' )
@@ -726,21 +713,21 @@ def container_build(images):
726
713
base_image = images ['base' ]
727
714
else :
728
715
base_image = 'nvcr.io/nvidia/tritonserver:{}-py3' .format (
729
- upstream_container_version )
716
+ FLAGS . upstream_container_version )
730
717
731
718
if 'pytorch' in images :
732
719
pytorch_image = images ['pytorch' ]
733
720
else :
734
721
pytorch_image = 'nvcr.io/nvidia/pytorch:{}-py3' .format (
735
- upstream_container_version )
722
+ FLAGS . upstream_container_version )
736
723
737
724
dockerfileargmap = {
738
725
'TRITON_VERSION' : FLAGS .version ,
739
726
'TRITON_CONTAINER_VERSION' : FLAGS .container_version ,
740
727
'BASE_IMAGE' : base_image ,
741
728
'PYTORCH_IMAGE' : pytorch_image ,
742
- 'ONNX_RUNTIME_VERSION' : onnx_runtime_version ,
743
- 'ONNX_RUNTIME_OPENVINO_VERSION' : onnx_runtime_openvino_version
729
+ 'ONNX_RUNTIME_VERSION' : FLAGS . onnx_runtime_version ,
730
+ 'ONNX_RUNTIME_OPENVINO_VERSION' : FLAGS . onnx_runtime_openvino_version
744
731
}
745
732
746
733
cachefrommap = [
@@ -804,6 +791,10 @@ def container_build(images):
804
791
# --container-version is removed so that a direct build is
805
792
# performed within the container
806
793
#
794
+ # Add --upstream-container-version, --onnx-runtime-version and
795
+ # --onnx-runtime-openvino-version if necessary since these
796
+ # FLAGS can be set manually and so may not be in sys.argv
797
+ #
807
798
# --build-dir is added/overridden to 'build_dir'
808
799
#
809
800
# --install-dir is added/overridden to 'install_dir'
@@ -822,6 +813,18 @@ def container_build(images):
822
813
continue
823
814
runargs .append (a )
824
815
816
+ if FLAGS .upstream_container_version is not None :
817
+ runargs += [
818
+ '--upstream-container-version' , FLAGS .upstream_container_version
819
+ ]
820
+ if FLAGS .onnx_runtime_version is not None :
821
+ runargs += ['--onnx-runtime-version' , FLAGS .onnx_runtime_version ]
822
+ if FLAGS .onnx_runtime_openvino_version is not None :
823
+ runargs += [
824
+ '--onnx-runtime-openvino-version' ,
825
+ FLAGS .onnx_runtime_openvino_version
826
+ ]
827
+
825
828
runargs += ['--build-dir' , build_dir ]
826
829
runargs += ['--install-dir' , install_dir ]
827
830
@@ -971,6 +974,20 @@ def container_build(images):
971
974
help =
972
975
'The upstream container version to use when performing a container build. If not specified the upstream container version will be chosen automaticallly based on --container-version.'
973
976
)
977
+ parser .add_argument (
978
+ '--onnx-runtime-version' ,
979
+ type = str ,
980
+ required = False ,
981
+ help =
982
+ 'The ONNX Runtime version to use. If not specified the upstream container version will be chosen automaticallly based on --container-version.'
983
+ )
984
+ parser .add_argument (
985
+ '--onnx-runtime-openvino-version' ,
986
+ type = str ,
987
+ required = False ,
988
+ help =
989
+ 'The ONNX Runtime OpenVINO version to use. If not specified the upstream container version will be chosen automaticallly based on --container-version.'
990
+ )
974
991
parser .add_argument (
975
992
'--container-prebuild-command' ,
976
993
type = str ,
@@ -1066,6 +1083,21 @@ def container_build(images):
1066
1083
if FLAGS .filesystem is None :
1067
1084
FLAGS .filesystem = []
1068
1085
1086
+ if FLAGS .container_version is not None :
1087
+ if FLAGS .container_version in CONTAINER_VERSION_MAP :
1088
+ if FLAGS .upstream_container_version is None :
1089
+ FLAGS .upstream_container_version = CONTAINER_VERSION_MAP [
1090
+ FLAGS .container_version ][0 ]
1091
+ if FLAGS .onnx_runtime_version is None :
1092
+ FLAGS .onnx_runtime_version = CONTAINER_VERSION_MAP [
1093
+ FLAGS .container_version ][1 ]
1094
+ if FLAGS .onnx_runtime_openvino_version is None :
1095
+ FLAGS .onnx_runtime_openvino_version = CONTAINER_VERSION_MAP [
1096
+ FLAGS .container_version ][2 ]
1097
+ else :
1098
+ fail ('unsupported container version {}' .format (
1099
+ FLAGS .container_version ))
1100
+
1069
1101
# Initialize map of docker images.
1070
1102
images = {}
1071
1103
for img in FLAGS .image :
0 commit comments