forked from enyac-group/single-path-nas
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofiler_scripts.py
More file actions
56 lines (49 loc) · 1.54 KB
/
profiler_scripts.py
File metadata and controls
56 lines (49 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# author: dstamoulis
#
# This code extends codebase from the "MNasNet on TPU" GitHub repo:
# https://github.com/tensorflow/tpu/tree/master/models/official/mnasnet
#
# This project incorporates material from the project listed above, and it
# is accessible under their original license terms (Apache License 2.0)
# ==============================================================================
"""Creating .json FAI-PEP profiler-compatible file."""
def profiler_template(path):
dirs = path.split('/')
model_ = "mnasnet-backbone.tflite"
name_ = dirs[-2]
template = {"model": {
"category": "CNN",
"cooldown": 30,
"description": "MNasNet model on TFLite",
"files": {
"graph": {
"filename": model_,
"location": "/home/profiler/FAI-PEP/specifications/models/tflite/ext-search-space/"+name_+"/"+model_
}
},
"format": "tflite",
"name": name_
},
"tests": [
{
"commands": [
"{program} --graph={files.graph} --warmup_runs={warmup} --num_runs={iter} --input_layer=truediv --input_layer_shape=\"1,224,224,3\" --num_threads=1"
],
"identifier": name_ + "-6-thread",
"iter": 50,
"metric": "delay",
"warmup": 1,
"platform_args": {
"taskset": "8"
}
}
]
}
return template
import sys, json
if __name__ == '__main__':
path = sys.argv[1]
template = profiler_template(path)
profiler_cfg_ = path + "profiler.json"
with open(profiler_cfg_, 'w') as f:
json.dump(template, f)