Skip to content

Commit 906941f

Browse files
Roman Donchenkoeldercrow
authored andcommitted
downloader: remove the --config option
It's been deprecated for two releases now; time to get rid of it.
1 parent 1d989fa commit 906941f

File tree

5 files changed

+14
-51
lines changed

5 files changed

+14
-51
lines changed

tools/downloader/README.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -425,18 +425,6 @@ face-detection-retail-0005
425425

426426
Either `--print_all` or one of the filter options must be specified.
427427

428-
Deprecated options
429-
------------------
430-
431-
In earlier releases, the tools used a single configuration file instead of
432-
per-model configuration files. For compatibility, loading such a file is still
433-
supported. However, this feature is deprecated and will be removed in a future release.
434-
435-
To load a configuration file in the old format, use the `-c`/`--config` option:
436-
437-
```sh
438-
./TOOL.py --all --config my-config.yml
439-
```
440428
__________
441429

442430
OpenVINO is a trademark of Intel Corporation or its subsidiaries in the U.S.

tools/downloader/common.py

Lines changed: 14 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -400,45 +400,26 @@ def load_models(args):
400400
models = []
401401
model_names = set()
402402

403-
def add_model(model):
404-
models.append(model)
403+
model_root = (Path(__file__).resolve().parent / '../../models').resolve()
405404

406-
if models[-1].name in model_names:
407-
raise DeserializationError(
408-
'Duplicate model name "{}"'.format(models[-1].name))
409-
model_names.add(models[-1].name)
405+
for config_path in sorted(model_root.glob('**/model.yml')):
406+
subdirectory = config_path.parent.relative_to(model_root)
410407

411-
if args.config is None: # per-model configs
412-
model_root = (Path(__file__).resolve().parent / '../../models').resolve()
408+
with config_path.open('rb') as config_file, \
409+
deserialization_context('In config "{}"'.format(config_path)):
413410

414-
for config_path in sorted(model_root.glob('**/model.yml')):
415-
subdirectory = config_path.parent.relative_to(model_root)
411+
model = yaml.safe_load(config_file)
416412

417-
with config_path.open('rb') as config_file, \
418-
deserialization_context('In config "{}"'.format(config_path)):
413+
for bad_key in ['name', 'subdirectory']:
414+
if bad_key in model:
415+
raise DeserializationError('Unsupported key "{}"'.format(bad_key))
419416

420-
model = yaml.safe_load(config_file)
417+
models.append(Model.deserialize(model, subdirectory.name, subdirectory))
421418

422-
for bad_key in ['name', 'subdirectory']:
423-
if bad_key in model:
424-
raise DeserializationError('Unsupported key "{}"'.format(bad_key))
425-
426-
add_model(Model.deserialize(model, subdirectory.name, subdirectory))
427-
428-
else: # monolithic config
429-
print('########## Warning: the --config option is deprecated and will be removed in a future release',
430-
file=sys.stderr)
431-
with args.config.open('rb') as config_file, \
432-
deserialization_context('In config "{}"'.format(args.config)):
433-
for i, model in enumerate(yaml.safe_load(config_file)['topologies']):
434-
with deserialization_context('In model #{}'.format(i)):
435-
name = validate_string('"name"', model['name'])
436-
if not name: raise DeserializationError('"name": must not be empty')
437-
438-
with deserialization_context('In model "{}"'.format(name)):
439-
subdirectory = validate_relative_path('"output"', model['output'])
440-
441-
add_model(Model.deserialize(model, name, subdirectory))
419+
if models[-1].name in model_names:
420+
raise DeserializationError(
421+
'Duplicate model name "{}"'.format(models[-1].name))
422+
model_names.add(models[-1].name)
442423

443424
return models
444425

tools/downloader/converter.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@ def num_jobs_arg(value_str):
119119

120120
def main():
121121
parser = argparse.ArgumentParser()
122-
parser.add_argument('-c', '--config', type=Path, metavar='CONFIG.YML',
123-
help='model configuration file (deprecated)')
124122
parser.add_argument('-d', '--download_dir', type=Path, metavar='DIR',
125123
default=Path.cwd(), help='root of the directory tree with downloaded model files')
126124
parser.add_argument('-o', '--output_dir', type=Path, metavar='DIR',

tools/downloader/downloader.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,6 @@ def positive_int_arg(value_str):
200200

201201
def main():
202202
parser = DownloaderArgumentParser()
203-
parser.add_argument('-c', '--config', type=Path, metavar='CONFIG.YML',
204-
help='model configuration file (deprecated)')
205203
parser.add_argument('--name', metavar='PAT[,PAT...]',
206204
help='download only models whose names match at least one of the specified patterns')
207205
parser.add_argument('--list', type=Path, metavar='FILE.LST',

tools/downloader/info_dumper.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ def to_info(model):
3636

3737
def main():
3838
parser = argparse.ArgumentParser()
39-
parser.add_argument('-c', '--config', type=Path, metavar='CONFIG.YML',
40-
help='model configuration file (deprecated)')
4139
parser.add_argument('--name', metavar='PAT[,PAT...]',
4240
help='only dump info for models whose names match at least one of the specified patterns')
4341
parser.add_argument('--list', type=Path, metavar='FILE.LST',

0 commit comments

Comments
 (0)