Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleSlim
提交
a4e43aff
P
PaddleSlim
项目概览
PaddlePaddle
/
PaddleSlim
1 年多 前同步成功
通知
51
Star
1434
Fork
344
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
53
列表
看板
标记
里程碑
合并请求
16
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleSlim
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
53
Issue
53
列表
看板
标记
里程碑
合并请求
16
合并请求
16
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
a4e43aff
编写于
6月 18, 2022
作者:
W
whs
提交者:
GitHub
6月 18, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix issues when hardware is gpu or gpu in ACT (#1180)
上级
6fa4ff18
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
14 deletion
+12
-14
paddleslim/auto_compression/auto_strategy.py
paddleslim/auto_compression/auto_strategy.py
+5
-11
paddleslim/auto_compression/compressor.py
paddleslim/auto_compression/compressor.py
+7
-3
未找到文件。
paddleslim/auto_compression/auto_strategy.py
浏览文件 @
a4e43aff
...
...
@@ -152,18 +152,13 @@ def prepare_strategy(executor,
""" prepare compression config automatically """
final_strategy
=
None
if
with_variable_shape
(
### use hardware latency tabel if support
if
not
with_variable_shape
(
model_dir
,
model_filename
=
model_filename
,
params_filename
=
params_filename
):
deploy_hardware
=
None
_logger
.
warning
(
"The model's inputs have variable shape. "
"And the latency predictor doesn't support variable shape. "
"So auto tuning will be skipped and a default strategy will be chosen."
)
### use hardware latency tabel if support
if
deploy_hardware
is
not
None
:
params_filename
=
params_filename
)
and
(
deploy_hardware
in
TableLatencyPredictor
.
hardware_list
):
compressed_time_dict
=
predict_compressed_model
(
executor
,
places
,
...
...
@@ -216,7 +211,6 @@ def prepare_strategy(executor,
if
final_strategy
is
None
:
final_strategy
=
candidate_s
[
0
]
### if deploy_hardware is not None
else
:
### default speedup ratio of quantization is 70% compare to fp32
### TODO(ceci3): full quant or skip some layer later
...
...
paddleslim/auto_compression/compressor.py
浏览文件 @
a4e43aff
...
...
@@ -221,11 +221,15 @@ class AutoCompression:
@
deploy_hardware
.
setter
def
deploy_hardware
(
self
,
value
):
supported_hardware
=
TableLatencyPredictor
.
hardware_list
+
[
'gpu'
,
# nvidia gpu
"cpu"
,
# intel cpu
]
if
value
is
not
None
:
# Fail-fast when deploy hardware is set explicitly
assert
(
value
in
TableLatencyPredictor
.
hardware_list
),
f
"Hardware should be in supported list
{
TableLatencyPredictor
.
hardware_list
}
but got
{
value
}
. Or you can set deploy_hardware None."
value
in
supported_hardware
),
f
"Hardware should be in supported list
{
supported_hardware
}
but got
{
value
}
. Or you can set deploy_hardware None."
self
.
_deploy_hardware
=
value
def
_get_eval_dataloader
(
self
,
train_dataloader
):
...
...
@@ -469,7 +473,7 @@ class AutoCompression:
return
tmp_dir
def
compress
(
self
):
self
.
tmp_dir
=
create_tmp_dir
(
self
.
final_dir
)
self
.
tmp_dir
=
self
.
create_tmp_dir
(
self
.
final_dir
)
for
strategy_idx
,
(
strategy
,
config
)
in
enumerate
(
zip
(
self
.
_strategy
,
self
.
_config
)):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录