Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hpvm-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
llvm
hpvm-release
Commits
da71c5c7
Commit
da71c5c7
authored
3 years ago
by
Hashim Sharif
Browse files
Options
Downloads
Patches
Plain Diff
Adding argparse options to Keras frontend test script
parent
65434337
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hpvm/test/dnn_benchmarks/keras/test_benchmarks.py
+27
-11
27 additions, 11 deletions
hpvm/test/dnn_benchmarks/keras/test_benchmarks.py
with
27 additions
and
11 deletions
hpvm/test/dnn_benchmarks/keras/test_benchmarks.py
+
27
−
11
View file @
da71c5c7
...
@@ -3,8 +3,10 @@
...
@@ -3,8 +3,10 @@
import
os
import
os
import
sys
import
sys
import
subprocess
import
subprocess
import
argparse
from
Config
import
*
from
Config
import
*
class
Benchmark
:
class
Benchmark
:
def
__init__
(
self
,
binary_path
,
output_dir
,
test_accuracy
):
def
__init__
(
self
,
binary_path
,
output_dir
,
test_accuracy
):
...
@@ -50,10 +52,15 @@ class Benchmark:
...
@@ -50,10 +52,15 @@ class Benchmark:
return
test_success
return
test_success
def
runHPVM
(
self
):
def
runHPVM
(
self
,
weights_dump
):
# Test Bechmark accuracy with pretrained weights (hpvm_relaod)
if
weights_dump
:
run_cmd
=
"
python3
"
+
self
.
binary_path
+
"
keras_reload frontend compile compile_tuner
"
# Test Benchmark with Keras weight dumping
run_cmd
=
"
python3
"
+
self
.
binary_path
+
"
keras_reload frontend compile compile_tuner
"
else
:
# Test Benchmark accuracy with pretrained weights (hpvm_relaod)
run_cmd
=
"
python3
"
+
self
.
binary_path
+
"
hpvm_reload frontend compile compile_tuner
"
try
:
try
:
subprocess
.
call
(
run_cmd
,
shell
=
True
)
subprocess
.
call
(
run_cmd
,
shell
=
True
)
except
:
except
:
...
@@ -120,10 +127,10 @@ class BenchmarkTests:
...
@@ -120,10 +127,10 @@ class BenchmarkTests:
self
.
passed_tests
.
append
(
benchmark
.
getPath
())
self
.
passed_tests
.
append
(
benchmark
.
getPath
())
def
runHPVMTests
(
self
):
def
runHPVMTests
(
self
,
weights_dump
):
for
benchmark
in
self
.
benchmarks
:
for
benchmark
in
self
.
benchmarks
:
test_success
=
benchmark
.
runHPVM
()
test_success
=
benchmark
.
runHPVM
(
weights_dump
)
if
not
test_success
:
if
not
test_success
:
self
.
failed_hpvm_tests
.
append
(
benchmark
.
getPath
())
self
.
failed_hpvm_tests
.
append
(
benchmark
.
getPath
())
...
@@ -173,10 +180,21 @@ class BenchmarkTests:
...
@@ -173,10 +180,21 @@ class BenchmarkTests:
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
if
len
(
sys
.
argv
)
<
2
:
print
(
"
Usage: python3 test_dnnbenchmarks.py ${work_dir}
"
)
work_dir
=
sys
.
argv
[
1
]
parser
=
argparse
.
ArgumentParser
(
description
=
'
Process some integers.
'
)
parser
.
add_argument
(
'
--work-dir
'
,
type
=
str
,
help
=
'
working dir for dumping frontend generated files
'
)
parser
.
add_argument
(
'
--dump-weights
'
,
action
=
"
store_true
"
,
help
=
'
dump h5 weights to bin (default: False)
'
)
args
=
parser
.
parse_args
()
work_dir
=
args
.
work_dir
dump_weights
=
args
.
dump_weights
#print (dump_weights)
#sys.exit(0)
if
os
.
path
.
exists
(
work_dir
):
if
os
.
path
.
exists
(
work_dir
):
print
(
"
Work Directory Exists. Delete it or use a different work directory.
"
)
print
(
"
Work Directory Exists. Delete it or use a different work directory.
"
)
sys
.
exit
(
0
)
sys
.
exit
(
0
)
...
@@ -210,12 +228,10 @@ if __name__ == "__main__":
...
@@ -210,12 +228,10 @@ if __name__ == "__main__":
#testMgr.runKerasTests()
#testMgr.runKerasTests()
#testMgr.printKerasSummary()
#testMgr.printKerasSummary()
testMgr
.
runHPVMTests
()
testMgr
.
runHPVMTests
(
dump_weights
)
tests_passed
=
testMgr
.
printHPVMSummary
()
tests_passed
=
testMgr
.
printHPVMSummary
()
if
not
tests_passed
:
if
not
tests_passed
:
sys
.
exit
(
-
1
)
sys
.
exit
(
-
1
)
#testMgr.runKerasTests()
#testMgr.printKerasSummary()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment