Skip to content

Commit

Permalink
Use opset_version 16 instead of 18 since 16 is the latest supported v…
Browse files Browse the repository at this point in the history
…ersion (#619)

* popular_on_huggingface/bert-base-uncased.py

Signed-off-by: jcwchen <[email protected]>

* add transformers models

Signed-off-by: jcwchen <[email protected]>

* remove gpt1 and gpt2 for now

Signed-off-by: jcwchen <[email protected]>

* config

Signed-off-by: jcwchen <[email protected]>

* get model name from build_dir

Signed-off-by: jcwchen <[email protected]>

* find_model_hash_name

Signed-off-by: jcwchen <[email protected]>

* subprocess.PIPE

Signed-off-by: jcwchen <[email protected]>

* 18 to 16

Signed-off-by: jcwchen <[email protected]>

* remove unnecessary models

Signed-off-by: jcwchen <[email protected]>

* use split to get model name

Signed-off-by: jcwchen <[email protected]>

* update

Signed-off-by: jcwchen <[email protected]>

* remove unstatble faster_rcnn

Signed-off-by: jcwchen <[email protected]>

---------

Signed-off-by: jcwchen <[email protected]>
  • Loading branch information
jcwchen authored Jul 18, 2023
1 parent 02ab9d0 commit c5612a4
Show file tree
Hide file tree
Showing 77 changed files with 109 additions and 112 deletions.
3 changes: 3 additions & 0 deletions models/mlagility/alexnet/alexnet-16.onnx
Git LFS file not shown
3 changes: 0 additions & 3 deletions models/mlagility/alexnet/alexnet-18.onnx

This file was deleted.

2 changes: 1 addition & 1 deletion models/mlagility/alexnet/test_data_set_0/input_0.pb
Git LFS file not shown
2 changes: 1 addition & 1 deletion models/mlagility/alexnet/test_data_set_0/output_0.pb
Git LFS file not shown
3 changes: 3 additions & 0 deletions models/mlagility/densenet121/densenet121-16.onnx
Git LFS file not shown
3 changes: 0 additions & 3 deletions models/mlagility/densenet121/densenet121-18.onnx

This file was deleted.

2 changes: 1 addition & 1 deletion models/mlagility/densenet121/test_data_set_0/input_0.pb
Git LFS file not shown
2 changes: 1 addition & 1 deletion models/mlagility/densenet121/test_data_set_0/output_0.pb
Git LFS file not shown

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 3 additions & 0 deletions models/mlagility/googlenet/googlenet-16.onnx
Git LFS file not shown
3 changes: 0 additions & 3 deletions models/mlagility/googlenet/googlenet-18.onnx

This file was deleted.

2 changes: 1 addition & 1 deletion models/mlagility/googlenet/test_data_set_0/input_0.pb
Git LFS file not shown
3 changes: 3 additions & 0 deletions models/mlagility/inception_v3/inception_v3-16.onnx
Git LFS file not shown
3 changes: 0 additions & 3 deletions models/mlagility/inception_v3/inception_v3-18.onnx

This file was deleted.

2 changes: 1 addition & 1 deletion models/mlagility/inception_v3/test_data_set_0/input_0.pb
Git LFS file not shown
2 changes: 1 addition & 1 deletion models/mlagility/inception_v3/test_data_set_0/output_0.pb
Git LFS file not shown
Git LFS file not shown

This file was deleted.

Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
3 changes: 3 additions & 0 deletions models/mlagility/mobilenet_v2/mobilenet_v2-16.onnx
Git LFS file not shown
3 changes: 0 additions & 3 deletions models/mlagility/mobilenet_v2/mobilenet_v2-18.onnx

This file was deleted.

2 changes: 1 addition & 1 deletion models/mlagility/mobilenet_v2/test_data_set_0/input_0.pb
Git LFS file not shown
2 changes: 1 addition & 1 deletion models/mlagility/mobilenet_v2/test_data_set_0/output_0.pb
Git LFS file not shown
Git LFS file not shown

This file was deleted.

Git LFS file not shown
Git LFS file not shown
3 changes: 3 additions & 0 deletions models/mlagility/resnet101/resnet101-16.onnx
Git LFS file not shown
3 changes: 0 additions & 3 deletions models/mlagility/resnet101/resnet101-18.onnx

This file was deleted.

2 changes: 1 addition & 1 deletion models/mlagility/resnet101/test_data_set_0/input_0.pb
Git LFS file not shown
2 changes: 1 addition & 1 deletion models/mlagility/resnet101/test_data_set_0/output_0.pb
Git LFS file not shown
3 changes: 3 additions & 0 deletions models/mlagility/resnet18/resnet18-16.onnx
Git LFS file not shown
3 changes: 0 additions & 3 deletions models/mlagility/resnet18/resnet18-18.onnx

This file was deleted.

2 changes: 1 addition & 1 deletion models/mlagility/resnet18/test_data_set_0/input_0.pb
Git LFS file not shown
2 changes: 1 addition & 1 deletion models/mlagility/resnet18/test_data_set_0/output_0.pb
Git LFS file not shown
3 changes: 3 additions & 0 deletions models/mlagility/resnet34/resnet34-16.onnx
Git LFS file not shown
3 changes: 0 additions & 3 deletions models/mlagility/resnet34/resnet34-18.onnx

This file was deleted.

2 changes: 1 addition & 1 deletion models/mlagility/resnet34/test_data_set_0/input_0.pb
Git LFS file not shown
2 changes: 1 addition & 1 deletion models/mlagility/resnet34/test_data_set_0/output_0.pb
Git LFS file not shown
3 changes: 3 additions & 0 deletions models/mlagility/resnet50/resnet50-16.onnx
Git LFS file not shown
3 changes: 0 additions & 3 deletions models/mlagility/resnet50/resnet50-18.onnx

This file was deleted.

2 changes: 1 addition & 1 deletion models/mlagility/resnet50/test_data_set_0/input_0.pb
Git LFS file not shown
2 changes: 1 addition & 1 deletion models/mlagility/resnet50/test_data_set_0/output_0.pb
Git LFS file not shown
3 changes: 3 additions & 0 deletions models/mlagility/ssd300_vgg16/ssd300_vgg16-16.onnx
Git LFS file not shown
3 changes: 0 additions & 3 deletions models/mlagility/ssd300_vgg16/ssd300_vgg16-18.onnx

This file was deleted.

4 changes: 2 additions & 2 deletions models/mlagility/ssd300_vgg16/test_data_set_0/input_0.pb
Git LFS file not shown
4 changes: 2 additions & 2 deletions models/mlagility/ssd300_vgg16/test_data_set_0/output_0.pb
Git LFS file not shown
4 changes: 2 additions & 2 deletions models/mlagility/ssd300_vgg16/test_data_set_0/output_1.pb
Git LFS file not shown
4 changes: 2 additions & 2 deletions models/mlagility/ssd300_vgg16/test_data_set_0/output_2.pb
Git LFS file not shown
3 changes: 3 additions & 0 deletions models/mlagility/ssd300_vgg16/test_data_set_0/output_3.pb
Git LFS file not shown
3 changes: 3 additions & 0 deletions models/mlagility/ssd300_vgg16/test_data_set_0/output_4.pb
Git LFS file not shown
3 changes: 3 additions & 0 deletions models/mlagility/ssd300_vgg16/test_data_set_0/output_5.pb
Git LFS file not shown
2 changes: 1 addition & 1 deletion models/mlagility/vgg16/test_data_set_0/input_0.pb
Git LFS file not shown
2 changes: 1 addition & 1 deletion models/mlagility/vgg16/test_data_set_0/output_0.pb
Git LFS file not shown
3 changes: 3 additions & 0 deletions models/mlagility/vgg16/vgg16-16.onnx
Git LFS file not shown
3 changes: 0 additions & 3 deletions models/mlagility/vgg16/vgg16-18.onnx

This file was deleted.

2 changes: 1 addition & 1 deletion models/mlagility/vgg16_bn/test_data_set_0/input_0.pb
Git LFS file not shown
2 changes: 1 addition & 1 deletion models/mlagility/vgg16_bn/test_data_set_0/output_0.pb
Git LFS file not shown
3 changes: 3 additions & 0 deletions models/mlagility/vgg16_bn/vgg16_bn-16.onnx
Git LFS file not shown
3 changes: 0 additions & 3 deletions models/mlagility/vgg16_bn/vgg16_bn-18.onnx

This file was deleted.

2 changes: 1 addition & 1 deletion models/mlagility/vgg19/test_data_set_0/input_0.pb
Git LFS file not shown
2 changes: 1 addition & 1 deletion models/mlagility/vgg19/test_data_set_0/output_0.pb
Git LFS file not shown
3 changes: 3 additions & 0 deletions models/mlagility/vgg19/vgg19-16.onnx
Git LFS file not shown
3 changes: 0 additions & 3 deletions models/mlagility/vgg19/vgg19-18.onnx

This file was deleted.

2 changes: 1 addition & 1 deletion models/mlagility/vgg19_bn/test_data_set_0/input_0.pb
Git LFS file not shown
2 changes: 1 addition & 1 deletion models/mlagility/vgg19_bn/test_data_set_0/output_0.pb
Git LFS file not shown
3 changes: 3 additions & 0 deletions models/mlagility/vgg19_bn/vgg19_bn-16.onnx
Git LFS file not shown
3 changes: 0 additions & 3 deletions models/mlagility/vgg19_bn/vgg19_bn-18.onnx

This file was deleted.

1 change: 0 additions & 1 deletion workflow_scripts/mlagility_config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
models_info = [
"torch_hub/alexnet.py",
"torch_hub/resnet50.py",
"torchvision/fasterrcnn_resnet50_fpn_v2.py",
"torchvision/maskrcnn_resnet50_fpn.py",
"torchvision/ssd300_vgg16.py",
"torch_hub/mobilenet_v2.py",
Expand Down
22 changes: 13 additions & 9 deletions workflow_scripts/run_mlagility.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,17 @@ def get_immediate_subdirectories_count(dir_name):
if osp.isdir(osp.join(dir_name, name))])


def find_model_hash_name(dir_name, cache_dir_prefix):
for dir in listdir(dir_name):
if dir.startswith(cache_dir_prefix):
return dir
raise Exception(f"Cannot find model hash name: {cache_dir_prefix} in cache directory.")
def find_model_hash_name(stdout):
for line in stdout.decode().split("\n"):
if "Build dir:" in line:
# handle Windows path
line = line.replace("\\", "/")
# last part of the path is the model hash name
return line.split("/")[-1]
raise Exception(f"Cannot find Build dir in {stdout}.")


ZOO_OPSET_VERSION = "18"
ZOO_OPSET_VERSION = "16"
base_name = f"-op{ZOO_OPSET_VERSION}-base.onnx"
cwd_path = Path.cwd()
mlagility_root = "mlagility/models"
Expand Down Expand Up @@ -52,11 +55,12 @@ def main():
if osp.exists(final_model_path) and args.skip:
print(f"Skip checking {model_zoo_dir} because {final_model_path} already exists.")
continue
subprocess.run(["benchit", osp.join(mlagility_root, model_info), "--cache-dir", cache_converted_dir,
cmd = subprocess.run(["benchit", osp.join(mlagility_root, model_info), "--cache-dir", cache_converted_dir,
"--onnx-opset", ZOO_OPSET_VERSION, "--export-only"],
cwd=cwd_path, stdout=sys.stdout,
cwd=cwd_path, stdout=subprocess.PIPE,
stderr=sys.stderr, check=True)
model_hash_name = find_model_hash_name(".cache", model_name + "_" + directory_name + "_")
model_hash_name = find_model_hash_name(cmd.stdout)
print(model_hash_name)
mlagility_created_onnx = osp.join(cache_converted_dir, model_hash_name, "onnx", model_hash_name + base_name)
if args.create:
ort_test_dir_utils.create_test_dir(mlagility_created_onnx, "./", final_model_dir)
Expand Down

0 comments on commit c5612a4

Please sign in to comment.