Skip to content

Commit

Permalink
[DOCS] Fix the QNN TFLite tutorial build (apache#5641)
Browse files Browse the repository at this point in the history
* [TUTORIAL] Fix execution error of TFLite quantized tutorial

* Assign TensorCore to docs build
  • Loading branch information
tqchen authored and Trevor Morris committed Jun 9, 2020
1 parent 4087560 commit 93446e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
7 changes: 3 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,7 @@ stage('Unit Test') {
init_git()
unpack_lib('gpu', tvm_multilib)
timeout(time: max_time, unit: 'MINUTES') {
// TODO(trevmorr): neo-ai/tvm disable sphinx due to missing PRs from upstream
// sh "${docker_run} ${ci_gpu} ./tests/scripts/task_sphinx_precheck.sh"
sh "${docker_run} ${ci_gpu} ./tests/scripts/task_sphinx_precheck.sh"
sh "${docker_run} ${ci_gpu} ./tests/scripts/task_python_unittest.sh"
sh "${docker_run} ${ci_gpu} ./tests/scripts/task_python_integration.sh"
}
Expand Down Expand Up @@ -258,10 +257,10 @@ stage('Integration Test') {
}
}
}
}
},
// TODO: Fix the doc
// 'docs: GPU': {
// node('GPU') {
// node('TensorCore') {
// ws(per_exec_ws("tvm/docs-python-gpu")) {
// init_git()
// unpack_lib('gpu', tvm_multilib)
Expand Down
9 changes: 7 additions & 2 deletions tutorials/frontend/deploy_prequantized_tflite.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,13 @@ def get_real_image(im_height, im_width):
tflite_model_file = os.path.join(model_dir, "mobilenet_v2_1.0_224_quant.tflite")
tflite_model_buf = open(tflite_model_file, "rb").read()

tflite_model = tflite.Model.GetRootAsModel(tflite_model_buf, 0)

# Get TFLite model from buffer
try:
import tflite
tflite_model = tflite.Model.GetRootAsModel(tflite_model_buf, 0)
except AttributeError:
import tflite.Model
tflite_model = tflite.Model.Model.GetRootAsModel(tflite_model_buf, 0)

###############################################################################
# Lets run TFLite pre-quantized model inference and get the TFLite prediction.
Expand Down

0 comments on commit 93446e6

Please sign in to comment.