Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleSlim
提交
f3bb87d7
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看板
提交
f3bb87d7
编写于
7月 07, 2020
作者:
B
baiyfbupt
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix conflicts
上级
3d1bd8ae
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
0 addition
and
30 deletion
+0
-30
paddleslim/nas/darts/search_space/conv_bert/cls.py
paddleslim/nas/darts/search_space/conv_bert/cls.py
+0
-14
paddleslim/nas/darts/search_space/conv_bert/model/transformer_encoder.py
...darts/search_space/conv_bert/model/transformer_encoder.py
+0
-16
未找到文件。
paddleslim/nas/darts/search_space/conv_bert/cls.py
浏览文件 @
f3bb87d7
...
...
@@ -91,19 +91,6 @@ class AdaBERTClassifier(Layer):
use_fixed_gumbel
=
self
.
use_fixed_gumbel
,
gumbel_alphas
=
gumbel_alphas
)
for
s_emb
,
t_emb
in
zip
(
self
.
student
.
emb_names
(),
self
.
teacher
.
emb_names
()):
t_emb
.
stop_gradient
=
True
if
fix_emb
:
s_emb
.
stop_gradient
=
True
print
(
"Assigning embedding[{}] from teacher to embedding[{}] in student."
.
format
(
t_emb
.
name
,
s_emb
.
name
))
fluid
.
layers
.
assign
(
input
=
t_emb
,
output
=
s_emb
)
print
(
"Assigned embedding[{}] from teacher to embedding[{}] in student."
.
format
(
t_emb
.
name
,
s_emb
.
name
))
fix_emb
=
False
for
s_emb
,
t_emb
in
zip
(
self
.
student
.
emb_names
(),
self
.
teacher
.
emb_names
()):
...
...
@@ -173,4 +160,3 @@ class AdaBERTClassifier(Layer):
total_loss
=
(
1
-
self
.
_gamma
)
*
ce_loss
+
self
.
_gamma
*
kd_loss
return
total_loss
,
accuracy
,
ce_loss
,
kd_loss
,
s_logits
paddleslim/nas/darts/search_space/conv_bert/model/transformer_encoder.py
浏览文件 @
f3bb87d7
...
...
@@ -262,7 +262,6 @@ class EncoderLayer(Layer):
default_initializer
=
NormalInitializer
(
loc
=
0.0
,
scale
=
1e-3
))
self
.
pool2d_avg
=
Pool2D
(
pool_type
=
'avg'
,
global_pooling
=
True
)
self
.
bns
=
[]
self
.
outs
=
[]
...
...
@@ -305,21 +304,6 @@ class EncoderLayer(Layer):
def
forward
(
self
,
enc_input_0
,
enc_input_1
,
epoch
,
flops
=
[],
model_size
=
[]):
=======
self
.
outs
.
append
(
out
)
self
.
use_fixed_gumbel
=
use_fixed_gumbel
self
.
gumbel_alphas
=
gumbel_softmax
(
self
.
alphas
)
if
gumbel_alphas
is
not
None
:
self
.
gumbel_alphas
=
np
.
array
(
gumbel_alphas
).
reshape
(
self
.
alphas
.
shape
)
else
:
self
.
gumbel_alphas
=
gumbel_softmax
(
self
.
alphas
)
self
.
gumbel_alphas
.
stop_gradient
=
True
print
(
"gumbel_alphas: {}"
.
format
(
self
.
gumbel_alphas
))
def
forward
(
self
,
enc_input_0
,
enc_input_1
,
flops
=
[],
model_size
=
[]):
alphas
=
self
.
gumbel_alphas
if
self
.
use_fixed_gumbel
else
gumbel_softmax
(
self
.
alphas
,
epoch
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录