Skip to content

Commit

Permalink
Add trained model to MNIST sample
Browse files Browse the repository at this point in the history
  • Loading branch information
abrahamchan committed Jun 15, 2024
1 parent a5bfc91 commit 1016853
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
10 changes: 9 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,12 @@ ENV CPLUS_INCLUDE_PATH=/root/local/include:$CPLUS_INCLUDE_PATH
ENV LIBRARY_PATH=/root/local/lib:$LIBRARY_PATH
ENV LD_LIBRARY_PATH=/root/local/lib:$LD_LIBRARY_PATH

WORKDIR /home/LLTFI
WORKDIR /home/LLTFI

### Install GraphViz package to visualize tracing
RUN apt-get install graphviz
RUN apt-get install imagemagick

### Install vim for convenience
RUN apt-get install vim

Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
printf "\n[Compile Script]: Generating TF model\n"
python3 mnist-cnn.py
if [ -f "$FILE" ]; then
echo "$FILE exists. Run ./clean.sh to retrain model."
else
printf "\n[Compile Script]: Generating TF and ONNX models\n"
python3 mnist-cnn.py
python3 -m tf2onnx.convert --saved-model mnist-cnn.tf --output model.onnx
fi

printf "\n[Compile Script]: Convert TF model to LLVM IR\n"
python3 -m tf2onnx.convert --saved-model mnist-cnn.tf --output model.onnx
printf "\n[Compile Script]: Convert ONNX model to LLVM IR\n"
python3 ../../../../tools/ExtendONNXModel.py --model_path ./model.onnx --output_model_path ./extendedmodel.onnx > expected_op_seq.txt
onnx-mlir --EmitLLVMIR extendedmodel.onnx --instrument-onnx-ops="ALL" --InstrumentBeforeAndAfterOp
mlir-translate -mlir-to-llvmir extendedmodel.onnx.mlir > model.mlir.ll
Expand Down
Binary file not shown.

0 comments on commit 1016853

Please sign in to comment.