-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc and example update for ITEX support (#1360)
- Loading branch information
1 parent
74b3b38
commit 6ab5570
Showing
139 changed files
with
4,376 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
...les/tensorflow/image_recognition/SavedModel/quantization/ptq/efficientnet_v2_b0_itex.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# | ||
# Copyright (c) 2021 Intel Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
version: 1.0 | ||
|
||
model: # mandatory. neural_compressor uses this model name and framework name to decide where to save tuning history and deploy yaml. | ||
name: efficientnet_v2_b0 | ||
framework: tensorflow_itex # mandatory. supported values are tensorflow, tensorflow_itex, pytorch, pytorch_ipex, onnxrt_integer, onnxrt_qlinear or mxnet; allow new framework backend extension. | ||
|
||
device: gpu # optional. set cpu if installed intel-extension-for-tensorflow[cpu], set gpu if installed intel-extension-for-tensorflow[gpu]. | ||
quantization: # optional. tuning constraints on model-wise for advance user to reduce tuning space. | ||
calibration: | ||
sampling_size: 5, 10, 50, 100 # optional. default value is the size of whole dataset. used to set how many portions of calibration dataset is used. exclusive with iterations field. | ||
dataloader: | ||
dataset: | ||
ImagenetRaw: | ||
data_path: /path/to/calibration/dataset # NOTE: modify to calibration dataset location if needed | ||
image_list: /path/to/calibration/label # data file, record image_names and their labels | ||
transform: | ||
PaddedCenterCrop: | ||
size: 224 | ||
crop_padding: 32 | ||
Resize: | ||
size: 224 | ||
interpolation: bicubic | ||
Normalize: | ||
mean: [123.675, 116.28, 103.53] | ||
std: [58.395, 57.12, 57.375] | ||
|
||
evaluation: # optional. required if user doesn't provide eval_func in neural_compressor.Quantization. | ||
accuracy: # optional. required if user doesn't provide eval_func in neural_compressor.Quantization. | ||
metric: | ||
topk: 1 # built-in metrics are topk, map, f1, allow user to register new metric. | ||
dataloader: | ||
batch_size: 32 | ||
dataset: | ||
ImagenetRaw: | ||
data_path: /path/to/evaluation/dataset # NOTE: modify to evaluation dataset location if needed | ||
image_list: /path/to/evaluation/label # data file, record image_names and their labels | ||
transform: | ||
PaddedCenterCrop: | ||
size: 224 | ||
crop_padding: 32 | ||
Resize: | ||
size: 224 | ||
interpolation: bicubic | ||
Normalize: | ||
mean: [123.675, 116.28, 103.53] | ||
std: [58.395, 57.12, 57.375] | ||
performance: # optional. used to benchmark performance of passing model. | ||
iteration: 100 | ||
configs: | ||
cores_per_instance: 4 | ||
num_of_instance: 7 | ||
dataloader: | ||
batch_size: 1 | ||
dataset: | ||
ImagenetRaw: | ||
data_path: /path/to/evaluation/dataset # NOTE: modify to evaluation dataset location if needed | ||
image_list: /path/to/evaluation/label # data file, record image_names and their labels | ||
transform: | ||
PaddedCenterCrop: | ||
size: 224 | ||
crop_padding: 32 | ||
Resize: | ||
size: 224 | ||
interpolation: bicubic | ||
Normalize: | ||
mean: [123.675, 116.28, 103.53] | ||
std: [58.395, 57.12, 57.375] | ||
|
||
tuning: | ||
accuracy_criterion: | ||
relative: 0.01 # optional. default value is relative, other value is absolute. this example allows relative accuracy loss: 1%. | ||
exit_policy: | ||
timeout: 0 # optional. tuning timeout (seconds). default value is 0 which means early stop. combine with max_trials field to decide when to exit. | ||
random_seed: 9527 # optional. random seed for deterministic tuning. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
examples/tensorflow/image_recognition/SavedModel/quantization/ptq/mobilenet_v1_itex.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# | ||
# Copyright (c) 2021 Intel Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
model: # mandatory. used to specify model specific information. | ||
name: mobilenet_v1 | ||
framework: tensorflow_itex # mandatory. supported values are tensorflow, tensorflow_itex, pytorch, pytorch_ipex, onnxrt_integer, onnxrt_qlinear or mxnet; allow new framework backend extension. | ||
|
||
device: gpu # optional. set cpu if installed intel-extension-for-tensorflow[cpu], set gpu if installed intel-extension-for-tensorflow[gpu]. | ||
|
||
quantization: # optional. tuning constraints on model-wise for advance user to reduce tuning space. | ||
calibration: | ||
sampling_size: 20, 50 # optional. default value is 100. used to set how many samples should be used in calibration. | ||
dataloader: | ||
batch_size: 10 | ||
dataset: | ||
ImageRecord: | ||
root: /path/to/calibration/dataset # NOTE: modify to calibration dataset location if needed | ||
transform: | ||
BilinearImagenet: | ||
height: 224 | ||
width: 224 | ||
model_wise: # optional. tuning constraints on model-wise for advance user to reduce tuning space. | ||
activation: | ||
algorithm: minmax | ||
weight: | ||
granularity: per_channel | ||
|
||
evaluation: # optional. required if user doesn't provide eval_func in neural_compressor.Quantization. | ||
accuracy: # optional. required if user doesn't provide eval_func in neural_compressor.Quantization. | ||
metric: | ||
topk: 1 # built-in metrics are topk, map, f1, allow user to register new metric. | ||
dataloader: | ||
batch_size: 32 | ||
dataset: | ||
ImageRecord: | ||
root: /path/to/evaluation/dataset # NOTE: modify to evaluation dataset location if needed | ||
transform: | ||
BilinearImagenet: | ||
height: 224 | ||
width: 224 | ||
performance: # optional. used to benchmark performance of passing model. | ||
iteration: 100 | ||
configs: | ||
cores_per_instance: 4 | ||
num_of_instance: 7 | ||
dataloader: | ||
batch_size: 1 | ||
dataset: | ||
ImageRecord: | ||
root: /path/to/evaluation/dataset # NOTE: modify to evaluation dataset location if needed | ||
transform: | ||
BilinearImagenet: | ||
height: 224 | ||
width: 224 | ||
|
||
tuning: | ||
accuracy_criterion: | ||
relative: 0.01 # optional. default value is relative, other value is absolute. this example allows relative accuracy loss: 1%. | ||
exit_policy: | ||
timeout: 0 # optional. tuning timeout (seconds). default value is 0 which means early stop. combine with max_trials field to decide when to exit. | ||
random_seed: 9527 # optional. random seed for deterministic tuning. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
examples/tensorflow/image_recognition/SavedModel/quantization/ptq/mobilenet_v2_itex.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# | ||
# Copyright (c) 2021 Intel Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
model: # mandatory. used to specify model specific information. | ||
name: mobilenet_v2 | ||
framework: tensorflow_itex # mandatory. supported values are tensorflow, tensorflow_itex, pytorch, pytorch_ipex, onnxrt_integer, onnxrt_qlinear or mxnet; allow new framework backend extension. | ||
|
||
device: gpu # optional. set cpu if installed intel-extension-for-tensorflow[cpu], set gpu if installed intel-extension-for-tensorflow[gpu]. | ||
|
||
quantization: # optional. tuning constraints on model-wise for advance user to reduce tuning space. | ||
calibration: | ||
sampling_size: 20, 50 # optional. default value is 100. used to set how many samples should be used in calibration. | ||
dataloader: | ||
batch_size: 10 | ||
dataset: | ||
ImageRecord: | ||
root: /path/to/calibration/dataset # NOTE: modify to calibration dataset location if needed | ||
transform: | ||
BilinearImagenet: | ||
height: 224 | ||
width: 224 | ||
model_wise: # optional. tuning constraints on model-wise for advance user to reduce tuning space. | ||
activation: | ||
algorithm: minmax | ||
weight: | ||
granularity: per_channel | ||
|
||
op_wise: { | ||
'MobilenetV2/expanded_conv/depthwise/depthwise': { | ||
'activation': {'dtype': ['fp32']}, | ||
}, | ||
'MobilenetV2/Conv_1/Conv2D': { | ||
'activation': {'dtype': ['fp32']}, | ||
} | ||
} | ||
|
||
evaluation: # optional. required if user doesn't provide eval_func in neural_compressor.Quantization. | ||
accuracy: # optional. required if user doesn't provide eval_func in neural_compressor.Quantization. | ||
metric: | ||
topk: 1 # built-in metrics are topk, map, f1, allow user to register new metric. | ||
dataloader: | ||
batch_size: 32 | ||
dataset: | ||
ImageRecord: | ||
root: /path/to/evaluation/dataset # NOTE: modify to evaluation dataset location if needed | ||
transform: | ||
BilinearImagenet: | ||
height: 224 | ||
width: 224 | ||
performance: # optional. used to benchmark performance of passing model. | ||
iteration: 100 | ||
configs: | ||
cores_per_instance: 4 | ||
num_of_instance: 7 | ||
dataloader: | ||
batch_size: 1 | ||
dataset: | ||
ImageRecord: | ||
root: /path/to/evaluation/dataset # NOTE: modify to evaluation dataset location if needed | ||
transform: | ||
BilinearImagenet: | ||
height: 224 | ||
width: 224 | ||
|
||
tuning: | ||
accuracy_criterion: | ||
relative: 0.01 # optional. default value is relative, other value is absolute. this example allows relative accuracy loss: 1%. | ||
exit_policy: | ||
timeout: 0 # optional. tuning timeout (seconds). default value is 0 which means early stop. combine with max_trials field to decide when to exit. | ||
random_seed: 9527 # optional. random seed for deterministic tuning. |
Oops, something went wrong.