Skip to content

Commit

Permalink
various fixes to export PyTorch ABTF model to ONNX
Browse files Browse the repository at this point in the history
  • Loading branch information
gfursin committed Apr 24, 2024
1 parent 13ec506 commit 2150f0d
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 7 deletions.
9 changes: 7 additions & 2 deletions docs/test-abtf-model/README-cuda.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ cmr "get generic-python-lib _torchvision_cuda" --extra-index-url=https://downloa



## Test Model with a test image
## Test ABTF model inference with a sample image

```bash
cmr "test abtf ssd-resnet50 cognata pytorch inference _cuda" --input=0000008766.png --output=0000008766_prediction_test.jpg --config=baseline_8MP_ss_scales --num-classes=13
cmr "test abtf ssd-resnet50 cognata pytorch inference _cuda" --input=0000008766.png --output=0000008766_prediction_test.jpg --config=baseline_8MP_ss_scales --num-classes=15
```

## Benchmark model with MLPerf loadgen
Expand All @@ -59,6 +59,8 @@ cmr "generic loadgen python _pytorch _cuda _custom _cmc" --samples=5 --modelsamp
```




## Benchmarking other models

Other ways to download public or private model code and weights:
Expand All @@ -84,6 +86,9 @@ cmr "generic loadgen python _pytorch _cuda _custom _cmc" --samples=5 --modelsamp






## Feedback

Join MLCommons discord or get in touch with developer: [email protected]
Expand Down
29 changes: 27 additions & 2 deletions docs/test-abtf-model/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ cmr "get generic-python-lib _torchvision" --version=0.17.0
```


## Run ABTF Model with a test image and prepare for loadgen
## Test ABTF Model with a sample image and prepare for loadgen

```bash
cmr "test abtf ssd-resnet50 cognata pytorch inference" --model=baseline_8MP_ss_scales_all_ep60.pth --config=baseline_8MP_ss_scales_all --input=0000008766.png --output=0000008766_prediction_test.jpg
Expand All @@ -142,6 +142,13 @@ You can run it in silent mode to skip CM workflow information using `-s` or `--s
cmr "test abtf ssd-resnet50 cognata pytorch inference" --model=baseline_8MP_ss_scales_all_ep60.pth --config=baseline_8MP_ss_scales_all --input=0000008766.png --output=0000008766_prediction_test.jpg -s
```

## Export PyTorch ABTF model to ONNX

```bash
cmr "test abtf ssd-resnet50 cognata pytorch inference" --model=baseline_8MP_ss_scales_all_ep60.pth --config=baseline_8MP_ss_scales_all --input=0000008766.png --output=0000008766_prediction_test.jpg -s --export_model_to_onnx=baseline_8MP_ss_scales_all_ep60.onnx
```


## Benchmark performance of ABTF model with MLPerf loadgen

### Build MLPerf loadgen
Expand All @@ -150,7 +157,7 @@ cmr "test abtf ssd-resnet50 cognata pytorch inference" --model=baseline_8MP_ss_s
cmr "get mlperf inference loadgen _copy" --version=main
```

### Run ABTF model with loadgen
### Test ABTF model inference with loadgen

```bash
cmr "test abtf ssd-resnet50 cognata pytorch inference" --model=baseline_8MP_ss_scales_all_ep60.pth --config=baseline_8MP_ss_scales_all --input=0000008766.png --output=0000008766_prediction_test.jpg
Expand All @@ -165,6 +172,24 @@ cmr "generic loadgen python _pytorch _custom _cmc" --samples=5 --modelsamplepath
```


## Test ABTF model with a Cognata sub-set

```bash
cmr "get raw dataset mlcommons-cognata" --serial_numbers=10002_Urban_Clear_Morning --group_names=Cognata_Camera_01_8M --file_names=Cognata_Camera_01_8M_ann.zip;Cognata_Camera_01_8M_ann_laneline.zip;Cognata_Camera_01_8M.zip

cmr "test abtf ssd-resnet50 cognata pytorch inference _dataset" --model=baseline_8MP_ss_scales_all_ep60.pth --config=baseline_8MP_ss_scales_all

cmr "test abtf ssd-resnet50 cognata pytorch inference _dataset" --model=baseline_8MP_ss_scales_all_ep60.pth --config=baseline_8MP_ss_scales_all --visualize
```


## Prepare and use Docker container






## Benchmarking other models

Other ways to download public or private model code and weights:
Expand Down
6 changes: 3 additions & 3 deletions script/get-dataset-cognata-mlcommons/README-extra.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ cmr "get raw dataset mlcommons-cognata" --path=D:\Work2\cognata-downloaded -j

```bash
cmr "get raw dataset mlcommons-cognata" --serial_numbers=10002_Urban_Clear_Morning
cmr "get raw dataset mlcommons-cognata" --serial_numbers=10002_Urban_Clear_Morning --group_names=Cognata_Camera_02_8M
cmr "get raw dataset mlcommons-cognata" --serial_numbers=10002_Urban_Clear_Morning --group_names=Cognata_Camera_02_8M --file_names=Cognata_Camera_02_8M_ann.zip;Cognata_Camera_02_8M_ann_laneline.zip;Cognata_Camera_02_8M.zip
cmr "get raw dataset mlcommons-cognata" --serial_numbers=10002_Urban_Clear_Morning --group_names=Cognata_Camera_02_8M --file_names=Cognata_Camera_02_8M_ann.zip;Cognata_Camera_02_8M_ann_laneline.zip;Cognata_Camera_02_8M.zip
cmr "get raw dataset mlcommons-cognata" --serial_numbers=10002_Urban_Clear_Morning --group_names=Cognata_Camera_01_8M
cmr "get raw dataset mlcommons-cognata" --serial_numbers=10002_Urban_Clear_Morning --group_names=Cognata_Camera_01_8M --file_names=Cognata_Camera_01_8M_ann.zip;Cognata_Camera_01_8M_ann_laneline.zip;Cognata_Camera_01_8M.zip
cmr "get raw dataset mlcommons-cognata" --serial_numbers=10002_Urban_Clear_Morning --group_names=Cognata_Camera_01_8M --file_names=Cognata_Camera_01_8M_ann.zip;Cognata_Camera_01_8M_ann_laneline.zip;Cognata_Camera_01_8M.zip

```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ deps:
enable_if_env:
CM_ABTF_EXPORT_MODEL_TO_ONNX:
- True
- tags: get,generic-python-lib,_package.onnxruntime
enable_if_env:
CM_ABTF_EXPORT_MODEL_TO_ONNX:
- True


########################################################################
Expand Down

0 comments on commit 2150f0d

Please sign in to comment.