Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions runtime-modeling/main_tflite.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def gen_model_fn(features, labels, mode, params):
if FLAGS.min_depth:
override_params['min_depth'] = FLAGS.min_depth

logits, _ = models.build_model(
logits, _ = models.build_mnasnet_model(
features,
model_name=FLAGS.model_name,
training=is_training,
Expand Down Expand Up @@ -560,8 +560,9 @@ def export(est, export_dir, post_quantize=True):
serving_input_receiver_fn=image_serving_input_fn)

tf.logging.info('Starting to export TFLite.')
converter = tf.contrib.lite.TFLiteConverter.from_saved_model(
os.path.join(export_dir, subfolder),
converter = tf.lite.TFLiteConverter.from_saved_model(
# os.path.join(export_dir, str(subfolder)),
subfolder.decode(),
input_arrays=['truediv'],
output_arrays=['logits'])
tflite_model = converter.convert()
Expand All @@ -570,8 +571,9 @@ def export(est, export_dir, post_quantize=True):

if post_quantize:
tf.logging.info('Starting to export quantized TFLite.')
converter = tf.contrib.lite.TFLiteConverter.from_saved_model(
os.path.join(export_dir, subfolder),
converter = tf.lite.TFLiteConverter.from_saved_model(
# os.path.join(export_dir, subfolder),
subfolder.decode(),
input_arrays=['truediv'],
output_arrays=['logits'])
converter.post_training_quantize = True
Expand Down
4 changes: 3 additions & 1 deletion runtime-modeling/profiler_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ def profiler_template(path):
}
return template

import sys, json
import os, sys, json
if __name__ == '__main__':

path = sys.argv[1]
template = profiler_template(path)

profiler_cfg_ = path + "profiler.json"
if not os.path.exists(os.path.dirname(profiler_cfg_)):
os.makedirs(os.path.dirname(profiler_cfg_))
with open(profiler_cfg_, 'w') as f:
json.dump(template, f)

Expand Down