Skip to content

Commit 1f6163f

Browse files
Refined the docs for tuning strategy (#329)
* doc(strategy): update the introduction of tuining strategy. Signed-off-by: intel-zhangyi <yi5.zhang@intel.com> * doc(tuning_strategy): add usages of strategies for new API. Signed-off-by: intel-zhangyi <yi5.zhang@intel.com> * doc(strategy): fix typo. Signed-off-by: intel-zhangyi <yi5.zhang@intel.com> * doc(strategy): fix comments in sample code. Signed-off-by: intel-zhangyi <yi5.zhang@intel.com> * fix(): fix typos. Signed-off-by: intel-zhangyi <yi5.zhang@intel.com> * remove yaml setting Signed-off-by: yiliu30 <yi4.liu@intel.com> * refine some docs Signed-off-by: yiliu30 <yi4.liu@intel.com> * add the op cap png Signed-off-by: yiliu30 <yi4.liu@intel.com> * --amend Signed-off-by: yiliu30 <yi4.liu@intel.com> * fied typos Signed-off-by: yiliu30 <yi4.liu@intel.com> * update docs Signed-off-by: yiliu30 <yi4.liu@intel.com> * fixed typo Signed-off-by: yiliu30 <yi4.liu@intel.com> * format fix Signed-off-by: yiliu30 <yi4.liu@intel.com> * add new words to pyspelling Signed-off-by: yiliu30 <yi4.liu@intel.com> * remove duplicate word Signed-off-by: yiliu30 <yi4.liu@intel.com> * fixed typo Signed-off-by: yiliu30 <yi4.liu@intel.com> * doc(sigopt_strategy): some tiny fixes. Signed-off-by: intel-zhangyi <yi5.zhang@intel.com> * doc(tuning_strategies): tiny expressional fixes. Signed-off-by: intel-zhangyi <yi5.zhang@intel.com> * fix typo Signed-off-by: yiliu30 <yi4.liu@intel.com> * doc(strategy): some tiny changes of documents. Signed-off-by: intel-zhangyi <yi5.zhang@intel.com> * fix a typo. Signed-off-by: intel-zhangyi <yi5.zhang@intel.com> * doc(strategy): some punctuation fixes. Signed-off-by: intel-zhangyi <yi5.zhang@intel.com> --------- Signed-off-by: intel-zhangyi <yi5.zhang@intel.com> Signed-off-by: yiliu30 <yi4.liu@intel.com> Co-authored-by: intel-zhangyi <yi5.zhang@intel.com>
1 parent 35efed5 commit 1f6163f

File tree

6 files changed

+358
-324
lines changed

6 files changed

+358
-324
lines changed

.azure-pipelines/scripts/codeScan/pyspelling/inc_dict.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2463,6 +2463,7 @@ Namhoon
24632463
Thalaiyasingam
24642464
Torr
24652465
MixedPrecisionConfig
2466+
contrib
24662467
ONNXConfig
24672468
Arial
24682469
MatMulInteger
@@ -2472,4 +2473,4 @@ css
24722473
subgraph
24732474
AccuracyCriterion
24742475
AccuracyLoss
2475-
TuningCriterion
2476+
TuningCriterion
Loading

docs/source/sigopt_strategy.md

Lines changed: 60 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,84 @@
1-
# SigOpt Strategy
1+
SigOpt Strategy
2+
============
23

3-
[SigOpt](https://app.sigopt.com/) is available via online platform and can be used for model development and performance. [Optimization Loop](https://app.sigopt.com/docs/overview/optimization) is the backbone of using SigOpt, we can set metrics and realize the interaction between online platform and tuning configures based on this mechanism.
4+
1. [Introduction](#introduction)
45

5-
## Preparation
6+
1.1 [Preparation](#preparation)
7+
8+
1.2 [SigOpt Platform](#sigopt-platform)
9+
10+
1.3 [Neural Compressor Configuration](#neural-compressor-configuration)
611

7-
Before using `SigOpt` strategy, a SigOpt account is necessary.
8-
- Each account has its own api token. Find your api token and then fill in the configure item `sigopt_api_token`.
9-
- Create a new project and write the corresponding name into the configure item `sigopt_project_id`.
10-
- Set the name for this experiment in configure item `sigopt_experiment_id`, the default is nc-tune.
12+
2. [Performance](#performance)
13+
14+
2.1 [Benefit of SigOpt Strategy](#benefit-of-sigopt-strategy)
1115

12-
### SigOpt introduction
16+
2.2 [Performance Comparison of Different Strategies](#performance-comparison-of-different-strategies)
1317

14-
If you are using SigOpt products for the first time, please [sign-up](https://app.sigopt.com/signup), if not, please [login](https://app.sigopt.com/login). It is free to apply for an account. Although there are certain restrictions on the model parameters and the number of experiments created, it is sufficient for ordinary customers. If you want higher capacity, please contact support@sigopt.com.
18+
## Introduction
1519

16-
After logging in, you can use `the token api` to connect the local code and the online platform, corresponding to the configure item `sigopt_api_token`, it can be obtained [here](https://app.sigopt.com/tokens/info).
20+
[SigOpt](https://app.sigopt.com/) is an online model development platform that makes it easy to track runs, visualize training, and scale hyperparameter optimization for any type of model. [Optimization Loop](https://app.sigopt.com/docs/overview/optimization) is the backbone of using SigOpt. We can set metrics and realize the interaction between the online platform and tuning configurations based on this mechanism.
1721

18-
SigOpt has two concepts: [project](https://app.sigopt.com/projects) and [experiment](https://app.sigopt.com/experiments). Create a project before experimenting, corresponding to `sigopt_project_id` and `sigopt_experiment_name`, Multiple experiments can be created in each project. After creating experiment, run through these three simple steps, in a loop:
22+
### Preparation
1923

20-
- Receive a Suggestion from SigOpt
21-
- Evaluate your metric
22-
- Report an Observation to SigOpt
24+
Before using the `SigOpt` strategy, a SigOpt account is necessary.
25+
- Each account has its own API token. Find your API token and then fill it in the `sigopt_api_token` field.
26+
- Create a new project and fill the corresponding name into the `sigopt_project_id` field.
27+
- Set the name of this experiment in `sigopt_experiment_id` field optionally. The default name is "nc-tune".
2328

24-
In Neural Compressor sigopt strategy, the metrics add accuracy as constraint and optimize for latency.
29+
### SigOpt Platform
2530

26-
### Neural Compressor configuration
31+
If you are using the SigOpt products for the first time, please [sign-up](https://app.sigopt.com/signup), if not, please [login](https://app.sigopt.com/login). It is free to apply for an account. Although there are certain restrictions on the model parameters and the number of experiments created, it is sufficient for ordinary customers. If you want higher capacity, please contact support@sigopt.com.
2732

28-
Compare to `Basic` strategy, `sigopt_api_token` is necessary for `SigOpt` strategy. Create the corresponding project name `sigopt_project_id` in the account before using the strategy.
33+
After logging in, you can use `the token api` to connect the local code to the online platform, corresponding to `sigopt_api_token`. It can be obtained [here](https://app.sigopt.com/tokens/info).
2934

30-
```yaml
31-
tuning:
32-
strategy:
33-
name: sigopt
34-
sigopt_api_token: YOUR-ACCOUNT-API-TOKEN
35-
sigopt_project_id: PROJECT-ID
36-
sigopt_experiment_name: nc-tune
37-
accuracy_criterion:
38-
relative: 0.01
39-
exit_policy:
40-
timeout: 0
41-
random_seed: 9527
35+
SigOpt has two concepts: [project](https://app.sigopt.com/projects) and [experiment](https://app.sigopt.com/experiments). Create a project before experimenting, corresponding to `sigopt_project_id` and `sigopt_experiment_name`. Multiple experiments can be created on each project. After creating the experiment, SigOpt will execute three simple steps below in a loop:
4236

43-
```
37+
- Receive a Suggestion from SigOpt;
38+
- Evaluate your metrics;
39+
- Report an Observation to SigOpt;
40+
41+
In our build-in sigopt strategy, the metrics add accuracy as a constraint and optimize for latency.
42+
43+
### Neural Compressor Configuration
4444

45+
Compare to `Basic` strategy, `sigopt_api_token` and `sigopt_project_id` is necessary for `SigOpt` strategy. Before using the strategy, it is required to create the project corresponding to `sigopt_project_id` in your account.
46+
47+
```python
48+
from neural_compressor import config
49+
50+
conf = config.PostTrainingQuantConfig(
51+
tuning_criterion=config.TuningCriterion(
52+
strategy="sigopt",
53+
strategy_kwargs={
54+
"sigopt_api_token": "YOUR-ACCOUNT-API-TOKEN",
55+
"sigopt_project_id": "PROJECT-ID",
56+
"sigopt_experiment_name": "nc-tune",
57+
},
58+
),
59+
)
60+
```
4561

4662
## Performance
4763

48-
### Benefit for Sigopt strategy
64+
### Benefit of SigOpt Strategy
4965

50-
- Metric based the SigOpt is better than self-define and easy to use. you can read details from [here](https://app.sigopt.com/docs/overview/metric_constraints).
51-
- Through the token api, the results of each experiment are recorded in your account. You can use the SigOpt data analysis function to analyze the results, such as drawing a chart, calculating F1 score, etc.
66+
- Metric based SigOpt is better than self-defining and easy to use. You can read the details [here](https://app.sigopt.com/docs/overview/metric_constraints).
67+
- With the token api, results of each experiment are recorded in your account. You can use the SigOpt data analysis function to analyze the results, such as drawing a chart, calculating the F1 score, etc.
5268

53-
### Performance comparison of different strategies
69+
### Performance Comparison of Different Strategies
5470

55-
MobileNet_v1 tensorflow
71+
- MobileNet_v1(tensorflow)
5672

57-
|strategy|FP32 baseline|int8 accuracy|int8 duration(s)|
58-
|--------|-------------|-------------|----------------|
59-
| basic | 0.8266 | 0.8372 | 88.2132 |
60-
| sigopt | 0.8266 | 0.8372 | 83.7495 |
73+
|strategy|FP32 baseline|int8 accuracy|int8 duration(s)|
74+
|--------|-------------|-------------|----------------|
75+
| basic | 0.8266 | 0.8372 | 88.2132 |
76+
| sigopt | 0.8266 | 0.8372 | 83.7495 |
6177

62-
ResNet50_v1 tensorflow
78+
- ResNet50_v1(tensorflow)
6379

64-
|strategy|FP32 baseline|int8 accuracy|int8 duration(s)|
65-
|--------|-------------|-------------|----------------|
66-
| basic | 0.8299 | 0.8294 | 85.0837 |
67-
| sigopt | 0.8299 | 0.8291 | 83.4469 |
80+
|strategy|FP32 baseline|int8 accuracy|int8 duration(s)|
81+
|--------|-------------|-------------|----------------|
82+
| basic | 0.8299 | 0.8294 | 85.0837 |
83+
| sigopt | 0.8299 | 0.8291 | 83.4469 |
6884

0 commit comments

Comments
 (0)