未验证 提交 29eb61ec 编写于 作者: C ceci3 提交者: GitHub

cancel opt_model in requirement.txt (#1261)

上级 8c23dc93
......@@ -9,8 +9,21 @@ PaddleSlim推出全新自动化压缩工具(ACT),旨在通过Source-Free
## 环境准备
- 安装PaddlePaddle >= 2.3版本 (从[Paddle官网](https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/install/pip/linux-pip.html)下载安装)
- 安装PaddleSlim develop版本
- 安装PaddlePaddle >= 2.3 (从[Paddle官网](https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/install/pip/linux-pip.html)下载安装)
- 安装PaddleSlim >=2.3
(1)安装paddlepaddle:
```shell
# CPU
pip install paddlepaddle
# GPU
pip install paddlepaddle-gpu
```
(2)安装paddleslim:
```shell
pip install paddleslim
```
## 快速上手
......
......@@ -32,7 +32,7 @@
#### 3.1 准备环境
- PaddlePaddle >= 2.3 (可从[Paddle官网](https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/install/pip/linux-pip.html)下载安装)
- PaddleSlim develop版本
- PaddleSlim >= 2.3
- PaddleDet >= 2.4
- opencv-python
......@@ -46,8 +46,7 @@ pip install paddlepaddle-gpu
安装paddleslim:
```shell
https://github.com/PaddlePaddle/PaddleSlim.git
python setup.py install
pip install paddleslim
```
安装paddledet:
......
......@@ -56,7 +56,7 @@
- python >= 3.6
- PaddlePaddle >= 2.3 (可从[Paddle官网](https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/install/pip/linux-pip.html)下载安装)
- PaddleSlim develop版本
- PaddleSlim >= 2.3
安装paddlepaddle:
```shell
......@@ -68,8 +68,7 @@ pip install paddlepaddle-gpu
安装paddleslim:
```shell
https://github.com/PaddlePaddle/PaddleSlim.git
python setup.py install
pip install paddleslim
```
#### 3.2 准备数据集
......
......@@ -48,7 +48,7 @@
#### 3.1 准备环境
- python >= 3.6
- PaddlePaddle >= 2.3 (可从[Paddle官网](https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/install/pip/linux-pip.html)下载安装)
- PaddleSlim develop版本
- PaddleSlim >= 2.3
- PaddleNLP >= 2.3
安装paddlepaddle:
......@@ -61,8 +61,7 @@ pip install paddlepaddle-gpu
安装paddleslim:
```shell
https://github.com/PaddlePaddle/PaddleSlim.git
python setup.py install
pip install paddleslim
```
安装paddlenlp:
......
......@@ -44,7 +44,7 @@
#### 3.1 准备环境
- python >= 3.6
- PaddlePaddle >= 2.3 (可从[Paddle官网](https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/install/pip/linux-pip.html)下载安装)
- PaddleSlim develop版本或PaddleSlim>=2.3.0
- PaddleSlim >= 2.3
- X2Paddle develop版本
- transformers >= 4.18.0
- PaddleNLP >= 2.3
......@@ -62,8 +62,7 @@ pip install paddlepaddle-gpu
安装paddleslim:
```shell
git clone https://github.com/PaddlePaddle/PaddleSlim.git
python setup.py install
pip install paddleslim
```
安装X2Paddle:
......
......@@ -33,7 +33,7 @@
#### 3.1 准备环境
- PaddlePaddle >= 2.3 (可从[Paddle官网](https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/install/pip/linux-pip.html)下载安装)
- PaddleSlim develop版本
- PaddleSlim >= 2.3
- PaddleDet >= 2.4
- [X2Paddle](https://github.com/PaddlePaddle/X2Paddle) >= 1.3.6
- opencv-python
......@@ -48,8 +48,7 @@ pip install paddlepaddle-gpu
(2)安装paddleslim:
```shell
https://github.com/PaddlePaddle/PaddleSlim.git
python setup.py install
pip install paddleslim
```
(3)安装paddledet:
......
......@@ -58,7 +58,7 @@
#### 3.1 准备环境
- PaddlePaddle >= 2.3 (可从[Paddle官网](https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/install/pip/linux-pip.html)下载安装)
- PaddleSlim develop版本
- PaddleSlim >= 2.3
- PaddleSeg >= 2.5
安装paddlepaddle:
......@@ -71,8 +71,7 @@ pip install paddlepaddle-gpu
安装paddleslim:
```shell
https://github.com/PaddlePaddle/PaddleSlim.git
python setup.py install
pip install paddleslim
```
安装paddleseg
......
......@@ -32,7 +32,7 @@
#### 3.1 准备环境
- PaddlePaddle >= 2.3 (可从[Paddle官网](https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/install/pip/linux-pip.html)下载安装)
- PaddleSlim develop版本
- PaddleSlim >= 2.3
- [X2Paddle](https://github.com/PaddlePaddle/X2Paddle) >= 1.3.6
- opencv-python
......@@ -46,8 +46,7 @@ pip install paddlepaddle-gpu
(2)安装paddleslim:
```shell
https://github.com/PaddlePaddle/PaddleSlim.git
python setup.py install
pip install paddleslim
```
(3)安装TensorFlow:
......
......@@ -15,6 +15,9 @@
# limitations under the License.
import os
import pip
import platform
import logging
import pickle
import shutil
import subprocess
......@@ -25,9 +28,12 @@ import paddle
from .parse_ops import get_key_from_op
from .extract_features import get_data_from_tables, get_features_from_paramkey
from ._utils import opt_model, load_predictor, nearest_interpolate, _get_download
from ..common import get_logger
from ..core import GraphWrapper
__all__ = ["LatencyPredictor", "TableLatencyPredictor"]
_logger = get_logger(__name__, level=logging.INFO)
TABLE_URL = 'https://paddlemodels.bj.bcebos.com/PaddleSlim/analysis/'
......@@ -71,6 +77,7 @@ class TableLatencyPredictor(LatencyPredictor):
hardware_list = ['SD625', 'SD710', 'RK3288']
def __init__(self, table_file='SD710'):
self._check_opt_model()
self.table_file = table_file
self.table_dict = {}
self.hardware = None
......@@ -83,6 +90,22 @@ class TableLatencyPredictor(LatencyPredictor):
def add_hardware(cls, hardware):
cls.hardware_list.append(hardware)
def _check_opt_model(self):
if platform.system().lower() == 'windows':
raise NotImplementedError(
'latency predictor does NOT support running on Windows.')
elif platform.system().lower() == 'darwin':
py_verion = platform.python_version().split('.')
if int(py_version[0]) != 3 or int(py_version[1]) != 9:
raise NotImplementedError(
'latency predictor does NOT support running on macOS when python version is not 3.9.'
)
_logger.info("pip install paddleslim-opt-tools")
out = shutil.which('paddle_lite_opt')
if out is None:
pip.main(['install', 'paddleslim-opt-tools'])
def _initial_table(self):
if self.table_file in TableLatencyPredictor.hardware_list:
self.hardware = self.table_file
......
......@@ -62,7 +62,12 @@ def predict_compressed_model(executor,
model_file = os.path.join(model_dir, model_filename)
param_file = os.path.join(model_dir, params_filename)
predictor = TableLatencyPredictor(hardware)
try:
predictor = TableLatencyPredictor(hardware)
except NotImplementedError:
raise NotImplementedError(
"Latency predictor cannot used on the platform: {}. That means you can not use latency predictor to select compress strategy automatically, you can set deploy_hardware to None or set compress strategy in the yaml".
format(platform.system()))
latency = predictor.predict(
model_file=model_file, param_file=param_file, data_type='fp32')
latency_dict.update({'origin_fp32': latency})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册