You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Install conda-build, required to create conda packages
@@ -24,6 +28,9 @@ def install_miniconda():
24
28
ifexit_code==0:
25
29
print(f"'conda' already present on the system. Proceeding without a fresh minconda installation.")
26
30
return
31
+
ifos.name=="nt":
32
+
print("Identified as Windows system. Please install miniconda using this URL: https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe")
TorchServe can be used with Intel® Extension for PyTorch* (IPEX) to give performance boost on Intel hardware.
3
+
TorchServe can be used with Intel® Extension for PyTorch* (IPEX) to give performance boost on Intel hardware<sup>1</sup>.
4
4
Here we show how to use TorchServe with IPEX.
5
5
6
+
<sup>1. While IPEX benefits all platforms, plaforms with AVX512 benefit the most. </sup>
7
+
6
8
## Contents of this Document
7
9
*[Install Intel Extension for PyTorch](#install-intel-extension-for-pytorch)
8
10
*[Serving model with Intel Extension for PyTorch](#serving-model-with-intel-extension-for-pytorch)
11
+
*[TorchServe with Launcher](#torchserve-with-launcher)
9
12
*[Creating and Exporting INT8 model for IPEX](#creating-and-exporting-int8-model-for-ipex)
10
-
*[Torchserve with Launcher](#torchserve-with-launcher)
11
13
*[Benchmarking with Launcher](#benchmarking-with-launcher)
12
14
13
15
@@ -19,7 +21,50 @@ After installation, all it needs to be done to use TorchServe with IPEX is to en
19
21
```
20
22
ipex_enable=true
21
23
```
22
-
Once IPEX is enabled, deploying PyTorch model follows the same procedure shown [here](https://pytorch.org/serve/use_cases.html). Torchserve with IPEX can deploy any model and do inference.
24
+
Once IPEX is enabled, deploying PyTorch model follows the same procedure shown [here](https://pytorch.org/serve/use_cases.html). TorchServe with IPEX can deploy any model and do inference.
25
+
26
+
## TorchServe with Launcher
27
+
Launcher is a script to automate the process of tunining configuration setting on intel hardware to boost performance. Tuning configurations such as OMP_NUM_THREADS, thread affininty, memory allocator can have a dramatic effect on performance. Please refer to [here](https://github.com/intel/intel-extension-for-pytorch/blob/master/docs/tutorials/performance_tuning/tuning_guide.md) and [here](https://github.com/intel/intel-extension-for-pytorch/blob/master/docs/tutorials/performance_tuning/launch_script.md) for details on performance tuning with launcher.
28
+
29
+
All it needs to be done to use TorchServe with launcher is to set its configuration in `config.properties`.
30
+
31
+
Add the following lines in `config.properties` to use launcher with its default configuration.
32
+
```
33
+
ipex_enable=true
34
+
cpu_launcher_enable=true
35
+
```
36
+
37
+
Launcher by default uses `numactl` if its installed to ensure socket is pinned and thus memory is allocated from local numa node. To use launcher without numactl, add the following lines in `config.properties`.
38
+
```
39
+
ipex_enable=true
40
+
cpu_launcher_enable=true
41
+
cpu_launcher_args=--disable_numactl
42
+
```
43
+
44
+
Launcher by default uses only non-hyperthreaded cores if hyperthreading is present to avoid core compute resource sharing. To use launcher with all cores, both physical and logical, add the following lines in `config.properties`.
45
+
```
46
+
ipex_enable=true
47
+
cpu_launcher_enable=true
48
+
cpu_launcher_args=--use_logical_core
49
+
```
50
+
51
+
Below is an example of passing multiple args to `cpu_launcher_args`.
* PyTorch by default uses GNU OpenMP. Launcher by default uses Intel OpenMP. Intel OpenMP library generally gives better performance.
63
+
3. Socket id: [`--socket_id`]
64
+
* Launcher by default uses all physical cores. Limit memory access to local memories on the Nth socket to avoid Non-Uniform Memory Access (NUMA).
65
+
66
+
Please refer to [here](https://github.com/intel/intel-extension-for-pytorch/blob/master/docs/tutorials/performance_tuning/launch_script.md) for a full list of tunable configuration of launcher.
67
+
23
68
24
69
## Creating and Exporting INT8 model for IPEX
25
70
Intel Extension for PyTorch supports both eager and torchscript mode. In this section, we show how to deploy INT8 model for IPEX.
@@ -30,11 +75,10 @@ First create `.pt` serialized file using IPEX INT8 inference. Here we show two e
30
75
#### BERT
31
76
32
77
```
78
+
import torch
33
79
import intel_extension_for_pytorch as ipex
34
-
from transformers import AutoModelForSequenceClassification, AutoConfig
35
80
import transformers
36
-
from datasets import load_dataset
37
-
import torch
81
+
from transformers import AutoModelForSequenceClassification, AutoConfig
38
82
39
83
# load the model
40
84
config = AutoConfig.from_pretrained(
@@ -43,99 +87,101 @@ model = AutoModelForSequenceClassification.from_pretrained(
Registering and deploying the model follows the same steps shown [here](https://pytorch.org/serve/use_cases.html).
109
182
110
-
## Torchserve with Launcher
111
-
Launcher is a script to automate the process of tunining configuration setting on intel hardware to boost performance. Tuning configurations such as OMP_NUM_THREADS, thread affininty, memory allocator can have a dramatic effect on performance. Please refer to [here](https://github.com/intel/intel-extension-for-pytorch/blob/master/docs/tutorials/performance_tuning/tuning_guide.md) and [here](https://github.com/intel/intel-extension-for-pytorch/blob/master/docs/tutorials/performance_tuning/tuning_guide.md) for details on performance tuning with launcher.
112
-
113
-
All it needs to be done to use Torchserve with launcher is to set its configuration in `config.properties`.
114
-
115
-
116
-
Add the following lines in `config.properties` to use launcher with its default configuration.
117
-
```
118
-
ipex_enable=true
119
-
cpu_launcher_enable=true
120
-
```
121
-
122
-
Launcher by default uses `numactl` if its installed to ensure socket is pinned and thus memory is allocated from local numa node. To use launcher without numactl, add the following lines in `config.properties`.
123
-
```
124
-
ipex_enable=true
125
-
cpu_launcher_enable=true
126
-
cpu_launcher_args=--disable_numactl
127
-
```
128
-
129
-
Launcher by default uses only non-hyperthreaded cores if hyperthreading is present to avoid core compute resource sharing. To use launcher with all cores, both physical and logical, add the following lines in `config.properties`.
130
-
```
131
-
ipex_enable=true
132
-
cpu_launcher_enable=true
133
-
cpu_launcher_args=--use_logical_core
134
-
```
135
-
Please refer to [here](https://github.com/intel/intel-extension-for-pytorch/blob/master/docs/tutorials/performance_tuning/launch_script.md) for a full list of tunable configuration of launcher.
136
-
137
183
## Benchmarking with Launcher
138
-
Launcher can be used with Torchserve official [benchmark](https://github.com/pytorch/serve/tree/master/benchmarks) to launch server and benchmark requests with optimal configuration on Intel hardware.
184
+
Launcher can be used with TorchServe official [benchmark](https://github.com/pytorch/serve/tree/master/benchmarks) to launch server and benchmark requests with optimal configuration on Intel hardware.
139
185
140
186
In this section we provide examples of benchmarking with launcher with its default configuration.
0 commit comments