Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ILITV-3305] change to install latest INC & TF, add metric in fit #1517

Merged
merged 2 commits into from
Jan 9, 2024
Merged
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
Empty file modified examples/notebook/tensorflow/alexnet_mnist/conda_set_env.sh
100644 → 100755
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from neural_compressor.config import PostTrainingQuantConfig, AccuracyCriterion, TuningCriterion
from neural_compressor.data import DataLoader
from neural_compressor.quantization import fit
from neural_compressor import Metric

import mnist_dataset

Expand Down Expand Up @@ -58,11 +59,15 @@ def auto_tune(input_graph_path, batch_size):
criterion='relative',
tolerable_loss=0.01 )
)
top1 = Metric(name="topk", k=1)

q_model = fit(
model=input_graph_path,
conf=config,
calib_dataloader=dataloader,
eval_dataloader=dataloader)
eval_dataloader=dataloader,
eval_metric=top1
)


return q_model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,6 @@
"!./run_sample.sh"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d53543c9",
"metadata": {},
"outputs": [],
"source": [
"!ls"
]
},
{
"cell_type": "markdown",
"id": "b3cb8011-31c4-4a7c-be00-775d2ec940f4",
Expand Down Expand Up @@ -272,7 +262,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.10"
"version": "3.8.13"
},
"nbTranslate": {
"displayLangs": [
Expand Down
Empty file modified examples/notebook/tensorflow/alexnet_mnist/pip_set_env.sh
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions examples/notebook/tensorflow/alexnet_mnist/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
neural-compressor==2.0
neural-compressor
runipy
notebook
matplotlib
tensorflow==2.12.*
tensorflow
Empty file.
Empty file modified examples/notebook/tensorflow/alexnet_mnist/run_jupyter.sh
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions examples/notebook/tensorflow/alexnet_mnist/run_sample.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ echo "Enable Intel Optimized TensorFlow 2.6.0 and newer by setting environment v
echo "That will accelerate training and inference, and it's mandatory requirement of running Intel® Neural Compressor quantize Fp32 model or deploying the quantized model."

export TF_ENABLE_ONEDNN_OPTS=1
export CUDA_VISIBLE_DEVICES=-1

echo "Train Model by Keras/Tensorflow with MNIST"
python keras_tf_train_mnist.py
Expand Down