Skip to content

Commit 5707d1f

Browse files
committed
fixes
1 parent 337865d commit 5707d1f

File tree

10 files changed

+34
-44
lines changed

10 files changed

+34
-44
lines changed

src/benchmark/frameworks/processes.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import abc
22
import json
33
import os
4-
import platform
54
from datetime import datetime
65
from pathlib import Path
76

src/benchmark/frameworks/tvm/tvm_process.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from pathlib import Path
2-
import platform
32
from ..processes import ProcessHandler
43

54

@@ -108,7 +107,7 @@ def _fill_command_line(self):
108107
else:
109108
raise Exception('Incorrect model parameters. Set model name or file names.')
110109
common_params += '-f mxnet '
111-
python = ProcessHandler.get_cmd_python_version()
110+
python = ProcessHandler.get_cmd_python_version(self._test)
112111
time_limit = self._test.indep_parameters.test_time_limit
113112
common_params += super()._fill_command_line()
114113
common_params += f' --time {time_limit}'
@@ -144,7 +143,7 @@ def _fill_command_line(self):
144143
common_params += (f'-m {model_pt} ')
145144
else:
146145
raise Exception('Incorrect model parameters. Set model name or file names.')
147-
python = ProcessHandler.get_cmd_python_version()
146+
python = ProcessHandler.get_cmd_python_version(self._test)
148147
time_limit = self._test.indep_parameters.test_time_limit
149148
common_params += super()._fill_command_line()
150149
common_params += f' --time {time_limit}'

src/benchmark/tests/test_processes.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,6 @@ class DotDict(dict):
5959
WRAPPER_REGISTRY = FrameworkWrapperRegistry()
6060

6161

62-
@pytest.mark.parametrize('os', [['Linux', 'python3'], ['Windows', 'python']])
63-
def test_python_version(os, mocker):
64-
mocker.patch('platform.system', return_value=os[0])
65-
assert ProcessHandler.get_cmd_python_version() == os[1]
66-
67-
6862
@pytest.mark.parametrize('inference_framework', [['OpenVINO DLDT', OpenVINOProcess],
6963
['Caffe', IntelCaffeProcess],
7064
['TensorFlow', TensorFlowProcess],

src/deployment/jenkins/logger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ def configure_logger(name='', level=log.INFO, use_default_formatter=False):
2424
logger.addHandler(file_handler)
2525

2626
logger.propagate = False
27-
return logger
27+
return logger

src/deployment/jenkins/tvm_build_envs.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import sys
22
import argparse
3-
import os
43
import subprocess
54

65

@@ -17,14 +16,17 @@ def _run(self, cmd):
1716
def create_envs(self):
1817
if len(self.frameworks) != 0:
1918
for framework in self.frameworks:
20-
self._run(f'{self.conda_prefix}/bin/conda create -y --name tvm_{framework}_{self.branch} --clone tvm_main_{self.branch}')
19+
command1 = f'{self.conda_prefix}/bin/conda create -y '
20+
command2 = f'--name tvm_{framework}_{self.branch} --clone tvm_main_{self.branch}'
21+
self._run(command1 + command2)
2122
if framework != 'mxnet':
2223
self._run(f'{self.conda_prefix}/envs/tvm_{framework}_{self.branch}/bin/pip3 install {framework}')
2324
else:
24-
self._run(f'{self.conda_prefix}/envs/tvm_{framework}_{self.branch}/bin/pip3 install {framework}==1.9.1')
25-
self._run(f'{self.conda_prefix}/envs/tvm_{framework}_{self.branch}/bin/pip3 install gluoncv[full]')
26-
self._run(f'{self.conda_prefix}/envs/tvm_{framework}_{self.branch}/bin/pip3 uninstall -y numpy')
27-
self._run(f'{self.conda_prefix}/envs/tvm_{framework}_{self.branch}/bin/pip3 install numpy==1.23.1')
25+
pip_str = f'{self.conda_prefix}/envs/tvm_{framework}_{self.branch}/bin/pip3'
26+
self._run(pip_str + f' install {framework}==1.9.1')
27+
self._run(pip_str + f' install gluoncv[full]')
28+
self._run(pip_str + f' uninstall -y numpy')
29+
self._run(pip_str + f' install numpy==1.23.1')
2830

2931

3032
def cli_arguments_parse():
@@ -54,11 +56,12 @@ def cli_arguments_parse():
5456

5557
return parser.parse_args()
5658

59+
5760
def main():
5861
args = cli_arguments_parse()
5962
cr = EnvCreator(args.frameworks, args.py, args.conda, args.branch)
6063
cr.create_envs()
6164

6265

63-
if __name__=='__main__':
64-
sys.exit(main() or 0)
66+
if __name__ == '__main__':
67+
sys.exit(main() or 0)

src/deployment/jenkins/tvm_build_pipeline.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import sys
22
import argparse
3-
import os
43
import subprocess
54

65

@@ -19,7 +18,10 @@ def build_tvm(self):
1918
self._run(f'{self.conda}/bin/conda install -n tvm_main_{self.branch} -c conda-forge -y gxx_linux-64')
2019
self._run(f'{self.conda}/envs/tvm_main_{self.branch}/bin/pip3 install -r requirements.txt')
2120
self._run(f'git clone --recursive https://github.com/apache/tvm -b {self.branch}')
22-
self._run(f'cd tvm && mkdir -p build && cd build && cmake -DUSE_LLVM=ON -DUSE_BLAS=openblas ../ && make -j$(nproc --all) && cd ../python && {self.conda}/envs/tvm_main_{self.branch}/bin/python setup.py install --user')
21+
command1 = 'cd tvm && mkdir -p build && cd build && cmake -DUSE_LLVM=ON -DUSE_BLAS=openblas ../ && '
22+
command2 = 'make -j$(nproc --all) && cd ../python && '
23+
command3 = f'{self.conda}/envs/tvm_main_{self.branch}/bin/python setup.py install --user'
24+
self._run(command1 + command2 + command3)
2325

2426

2527
def cli_arguments_parse():

src/deployment/jenkins/tvm_compile_pipeline.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import sys
33
import subprocess
44
from logger import configure_logger
5-
import traceback
65
from pathlib import Path
76

87
sys.path.append(str(Path(__file__).parents[3]))
@@ -18,7 +17,7 @@ def __init__(self, filepath):
1817

1918
def parse(self):
2019
if not self.filepath.exists():
21-
raise FileNotFoundError('File doesn\'t exist.')
20+
raise FileNotFoundError('File not found.')
2221
log.info(f'Parsing file: {self.filepath.as_posix()}')
2322
with self.filepath.open() as file:
2423
self.lines = file.read().splitlines()
@@ -42,18 +41,18 @@ def __init__(self, models_dir, conda, output_dir, vm, branch):
4241
self.output_dir = output_dir
4342
else:
4443
self.output_dir = models_dir
45-
self._command_line = f''
44+
self._command_line = ''
4645

4746
def _add_argument(self, name_of_arg, value_of_arg):
4847
if value_of_arg != '':
4948
self._command_line += f' {name_of_arg} {value_of_arg}'
5049

5150
def _add_option(self, name_of_arg):
52-
self._command_line += f' {name_of_arg}'
51+
self._command_line += f' {name_of_arg}'
5352

5453
def create_command_line(self, model_name, target, batch, opt_level):
5554
self._command_line = (f'{self.conda}/envs/tvm_main_{self.branch}/bin/python3 ' + f'{self.converter}')
56-
self._add_argument('--mod', f'{self.models_dir}/{model_name}/batch_{batch}/{model_name}.json')
55+
self._add_argument('--mod', f'{self.models_dir}/{model_name}/batch_{batch}/{model_name}.json')
5756
self._add_argument('--params', f'{self.models_dir}/{model_name}/batch_{batch}/{model_name}.params')
5857
self._add_argument('-t', f'"{target}"')
5958
self._add_argument('--opt_level', f'{opt_level}')
@@ -69,7 +68,6 @@ def execute(self):
6968
self._command_line = ''
7069

7170

72-
7371
def cli_arguments_parse():
7472
parser = argparse.ArgumentParser()
7573

@@ -128,12 +126,10 @@ def main():
128126
for level in args.opt_levels:
129127
proc.create_command_line(
130128
model_name, args.target,
131-
batch, level
129+
batch, level,
132130
)
133131
proc.execute()
134132

135133

136-
137-
138-
if __name__=='__main__':
139-
sys.exit(main() or 0)
134+
if __name__ == '__main__':
135+
sys.exit(main() or 0)

src/deployment/jenkins/tvm_convert_pipeline.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import sys
33
import subprocess
44
from logger import configure_logger
5-
import traceback
65
from pathlib import Path
76

87
sys.path.append(str(Path(__file__).parents[3]))
@@ -18,7 +17,7 @@ def __init__(self, filepath):
1817

1918
def parse(self):
2019
if not self.filepath.exists():
21-
raise FileNotFoundError('File doesn\'t exist.')
20+
raise FileNotFoundError('File not found.')
2221
log.info(f'Parsing file: {self.filepath.as_posix()}')
2322
with self.filepath.open() as file:
2423
self.lines = file.read().splitlines()
@@ -37,22 +36,22 @@ def __init__(self, models_dir, conda, branch):
3736
self.converter = str(self.converter.joinpath('tvm_converter.py'))
3837
self.models_dir = models_dir.absolute().as_posix()
3938
self.branch = branch
40-
self._command_line = f''
39+
self._command_line = ''
4140

4241
def _add_argument(self, name_of_arg, value_of_arg):
4342
if value_of_arg != '':
4443
self._command_line += f' {name_of_arg} {value_of_arg}'
4544

4645
def _add_option(self, name_of_arg):
47-
self._command_line += f' {name_of_arg}'
46+
self._command_line += f' {name_of_arg}'
4847

4948
def create_command_line(self, model_name, model, weights,
5049
framework, input_shape, batch, input_name):
5150
self._command_line = (f'{self.conda}/envs/tvm_{framework}_{self.branch}/bin/python3 ' + f'{self.converter}')
5251
self._add_argument('-mn', model_name)
5352
if model != '':
5453
self._add_argument('-m', f'{self.models_dir}/{model}')
55-
if weights != '':
54+
if weights != '':
5655
self._add_argument('-w', f'{self.models_dir}/{weights}')
5756
if framework == 'torch':
5857
framework = 'pytorch'
@@ -70,7 +69,6 @@ def execute(self):
7069
self._command_line = ''
7170

7271

73-
7472
def cli_arguments_parse():
7573
parser = argparse.ArgumentParser()
7674

@@ -110,12 +108,10 @@ def main():
110108
model_name, model,
111109
weights, framework,
112110
input_shape, batch,
113-
input_name
111+
input_name,
114112
)
115113
proc.execute()
116114

117115

118-
119-
120-
if __name__=='__main__':
121-
sys.exit(main() or 0)
116+
if __name__ == '__main__':
117+
sys.exit(main() or 0)

src/deployment/remote_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def __init__(self, log):
66
self.my_log = log
77

88
@staticmethod
9-
def get_remote_helper(os_type, python ,log):
9+
def get_remote_helper(os_type, python, log):
1010
if os_type == 'linux':
1111
from linux_remote_helper import LinuxRemoteHelper
1212
return LinuxRemoteHelper(python, log)

tests/smoke_test/configs/dl_models/mobilenet-v1-1.0-224-tf_OpenVINO_DLDT_async_mode.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
<Device>CPU</Device>
4949
<IterationCount>5</IterationCount>
5050
<TestTimeLimit>1</TestTimeLimit>
51+
<PythonInterpreter>python3</PythonInterpreter>
5152
</FrameworkIndependent>
5253
<FrameworkDependent>
5354
<Mode>async</Mode>

0 commit comments

Comments
 (0)