Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
443cf71a
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
443cf71a
编写于
6月 07, 2021
作者:
Z
zhangchunle
提交者:
GitHub
6月 07, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix undefined-variable (#33355)
上级
599e9e48
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
14 addition
and
10 deletion
+14
-10
python/paddle/distributed/fleet/meta_optimizers/dygraph_optimizer/hybrid_parallel_optimizer.py
...optimizers/dygraph_optimizer/hybrid_parallel_optimizer.py
+3
-0
python/paddle/fluid/contrib/model_stat.py
python/paddle/fluid/contrib/model_stat.py
+1
-0
python/paddle/fluid/tests/unittests/ir_memory_optimize_net_base.py
...ddle/fluid/tests/unittests/ir_memory_optimize_net_base.py
+1
-1
python/paddle/fluid/tests/unittests/test_auto_checkpoint.py
python/paddle/fluid/tests/unittests/test_auto_checkpoint.py
+1
-1
python/paddle/fluid/tests/unittests/test_dyn_rnn.py
python/paddle/fluid/tests/unittests/test_dyn_rnn.py
+1
-1
python/paddle/fluid/tests/unittests/test_onnx_export.py
python/paddle/fluid/tests/unittests/test_onnx_export.py
+1
-1
python/paddle/hapi/model.py
python/paddle/hapi/model.py
+6
-6
未找到文件。
python/paddle/distributed/fleet/meta_optimizers/dygraph_optimizer/hybrid_parallel_optimizer.py
浏览文件 @
443cf71a
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
from
__future__
import
print_function
from
__future__
import
print_function
import
sys
import
sys
import
paddle
from
paddle.optimizer
import
Optimizer
from
paddle.optimizer
import
Optimizer
from
paddle.fluid.clip
import
ClipGradByGlobalNorm
from
paddle.fluid.clip
import
ClipGradByGlobalNorm
from
...utils.hybrid_parallel_util
import
fused_allreduce_gradients
from
...utils.hybrid_parallel_util
import
fused_allreduce_gradients
...
@@ -22,6 +23,8 @@ from paddle.fluid.dygraph import base as imperative_base
...
@@ -22,6 +23,8 @@ from paddle.fluid.dygraph import base as imperative_base
from
paddle.fluid
import
framework
from
paddle.fluid
import
framework
from
paddle.fluid.framework
import
Variable
from
paddle.fluid.framework
import
Variable
from
...utils.log_util
import
logger
from
...utils.log_util
import
logger
from
paddle.fluid
import
core
from
paddle.fluid
import
layers
__all__
=
[]
__all__
=
[]
...
...
python/paddle/fluid/contrib/model_stat.py
浏览文件 @
443cf71a
...
@@ -150,6 +150,7 @@ def _format_summary(collected_ops_list):
...
@@ -150,6 +150,7 @@ def _format_summary(collected_ops_list):
'''
'''
_verify_dependent_package
()
_verify_dependent_package
()
from
prettytable
import
PrettyTable
summary_table
=
PrettyTable
(
summary_table
=
PrettyTable
(
[
"No."
,
"TYPE"
,
"INPUT"
,
"OUTPUT"
,
"PARAMs"
,
"FLOPs"
])
[
"No."
,
"TYPE"
,
"INPUT"
,
"OUTPUT"
,
"PARAMs"
,
"FLOPs"
])
summary_table
.
align
=
'r'
summary_table
.
align
=
'r'
...
...
python/paddle/fluid/tests/unittests/ir_memory_optimize_net_base.py
浏览文件 @
443cf71a
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
# limitations under the License.
# limitations under the License.
import
os
import
os
import
sys
import
six
import
six
import
unittest
import
unittest
import
time
import
time
...
...
python/paddle/fluid/tests/unittests/test_auto_checkpoint.py
浏览文件 @
443cf71a
...
@@ -268,7 +268,7 @@ class AutoCheckpointTest(AutoCheckPointACLBase):
...
@@ -268,7 +268,7 @@ class AutoCheckpointTest(AutoCheckPointACLBase):
def
test_checker
(
self
):
def
test_checker
(
self
):
os
.
environ
.
pop
(
"PADDLE_JOB_ID"
,
None
)
os
.
environ
.
pop
(
"PADDLE_JOB_ID"
,
None
)
try
:
try
:
checker
=
AutoCheckpointChecker
()
checker
=
acp
.
AutoCheckpointChecker
()
self
.
assertFalse
(
True
)
self
.
assertFalse
(
True
)
except
Exception
as
e
:
except
Exception
as
e
:
pass
pass
...
...
python/paddle/fluid/tests/unittests/test_dyn_rnn.py
浏览文件 @
443cf71a
...
@@ -333,7 +333,7 @@ class TestDynamicRNNErrors(unittest.TestCase):
...
@@ -333,7 +333,7 @@ class TestDynamicRNNErrors(unittest.TestCase):
hidden
=
fluid
.
layers
.
fc
(
input
=
[
word
,
memory
],
hidden
=
fluid
.
layers
.
fc
(
input
=
[
word
,
memory
],
size
=
10
,
size
=
10
,
act
=
'tanh'
)
act
=
'tanh'
)
out
=
n
p
.
ones
(
1
).
astype
(
'float32'
)
out
=
n
umpy
.
ones
(
1
).
astype
(
'float32'
)
drnn
.
update_memory
(
ex_mem
=
memory
,
new_mem
=
hidden
)
drnn
.
update_memory
(
ex_mem
=
memory
,
new_mem
=
hidden
)
drnn
.
output
(
hidden
,
out
)
drnn
.
output
(
hidden
,
out
)
...
...
python/paddle/fluid/tests/unittests/test_onnx_export.py
浏览文件 @
443cf71a
...
@@ -47,7 +47,7 @@ class TestExportWithTensor(unittest.TestCase):
...
@@ -47,7 +47,7 @@ class TestExportWithTensor(unittest.TestCase):
self
.
x_spec
=
paddle
.
static
.
InputSpec
(
self
.
x_spec
=
paddle
.
static
.
InputSpec
(
shape
=
[
None
,
128
],
dtype
=
'float32'
)
shape
=
[
None
,
128
],
dtype
=
'float32'
)
def
test_with_tensor
():
def
test_with_tensor
(
self
):
model
=
LinearNet
()
model
=
LinearNet
()
paddle
.
onnx
.
export
(
model
,
'linear_net'
,
input_spec
=
[
self
.
x_spec
])
paddle
.
onnx
.
export
(
model
,
'linear_net'
,
input_spec
=
[
self
.
x_spec
])
...
...
python/paddle/hapi/model.py
浏览文件 @
443cf71a
...
@@ -163,7 +163,7 @@ def init_communicator(program, rank, nranks, wait_port, current_endpoint,
...
@@ -163,7 +163,7 @@ def init_communicator(program, rank, nranks, wait_port, current_endpoint,
})
})
elif
core
.
is_compiled_with_npu
():
elif
core
.
is_compiled_with_npu
():
hccl_id_var
=
block
.
create_var
(
hccl_id_var
=
block
.
create_var
(
name
=
unique_name
.
generate
(
'hccl_id'
),
name
=
fluid
.
unique_name
.
generate
(
'hccl_id'
),
persistable
=
True
,
persistable
=
True
,
type
=
core
.
VarDesc
.
VarType
.
RAW
)
type
=
core
.
VarDesc
.
VarType
.
RAW
)
endpoint_to_index_map
=
{
e
:
idx
for
idx
,
e
in
enumerate
(
endpoints
)}
endpoint_to_index_map
=
{
e
:
idx
for
idx
,
e
in
enumerate
(
endpoints
)}
...
@@ -710,10 +710,10 @@ class DynamicGraphAdapter(object):
...
@@ -710,10 +710,10 @@ class DynamicGraphAdapter(object):
enable
=
self
.
_amp_level
!=
'O0'
,
**
self
.
_amp_custom_lists
):
enable
=
self
.
_amp_level
!=
'O0'
,
**
self
.
_amp_custom_lists
):
if
self
.
_nranks
>
1
:
if
self
.
_nranks
>
1
:
outputs
=
self
.
ddp_model
.
forward
(
outputs
=
self
.
ddp_model
.
forward
(
*
[
to_variable
(
x
)
for
x
in
inputs
])
*
[
to_variable
(
x
)
for
x
in
inputs
])
else
:
else
:
outputs
=
self
.
model
.
network
.
forward
(
outputs
=
self
.
model
.
network
.
forward
(
*
[
to_variable
(
x
)
for
x
in
inputs
])
*
[
to_variable
(
x
)
for
x
in
inputs
])
losses
=
self
.
model
.
_loss
(
*
(
to_list
(
outputs
)
+
labels
))
losses
=
self
.
model
.
_loss
(
*
(
to_list
(
outputs
)
+
labels
))
losses
=
to_list
(
losses
)
losses
=
to_list
(
losses
)
...
@@ -732,7 +732,7 @@ class DynamicGraphAdapter(object):
...
@@ -732,7 +732,7 @@ class DynamicGraphAdapter(object):
metrics
=
[]
metrics
=
[]
for
metric
in
self
.
model
.
_metrics
:
for
metric
in
self
.
model
.
_metrics
:
metric_outs
=
metric
.
compute
(
*
(
to_list
(
outputs
)
+
labels
))
metric_outs
=
metric
.
compute
(
*
(
to_list
(
outputs
)
+
labels
))
m
=
metric
.
update
(
*
[
to_numpy
(
m
)
for
m
in
to_list
(
metric_outs
)])
m
=
metric
.
update
(
*
[
to_numpy
(
m
)
for
m
in
to_list
(
metric_outs
)])
metrics
.
append
(
m
)
metrics
.
append
(
m
)
return
([
to_numpy
(
l
)
for
l
in
losses
],
metrics
)
\
return
([
to_numpy
(
l
)
for
l
in
losses
],
metrics
)
\
...
@@ -746,7 +746,7 @@ class DynamicGraphAdapter(object):
...
@@ -746,7 +746,7 @@ class DynamicGraphAdapter(object):
labels
=
labels
or
[]
labels
=
labels
or
[]
labels
=
[
to_variable
(
l
)
for
l
in
to_list
(
labels
)]
labels
=
[
to_variable
(
l
)
for
l
in
to_list
(
labels
)]
outputs
=
self
.
model
.
network
.
forward
(
*
[
to_variable
(
x
)
for
x
in
inputs
])
outputs
=
self
.
model
.
network
.
forward
(
*
[
to_variable
(
x
)
for
x
in
inputs
])
if
self
.
model
.
_loss
:
if
self
.
model
.
_loss
:
losses
=
self
.
model
.
_loss
(
*
(
to_list
(
outputs
)
+
labels
))
losses
=
self
.
model
.
_loss
(
*
(
to_list
(
outputs
)
+
labels
))
losses
=
to_list
(
losses
)
losses
=
to_list
(
losses
)
...
@@ -777,7 +777,7 @@ class DynamicGraphAdapter(object):
...
@@ -777,7 +777,7 @@ class DynamicGraphAdapter(object):
self
.
_merge_count
[
self
.
mode
+
'_batch'
]
=
samples
self
.
_merge_count
[
self
.
mode
+
'_batch'
]
=
samples
metric_outs
=
metric
.
compute
(
*
(
to_list
(
outputs
)
+
labels
))
metric_outs
=
metric
.
compute
(
*
(
to_list
(
outputs
)
+
labels
))
m
=
metric
.
update
(
*
[
to_numpy
(
m
)
for
m
in
to_list
(
metric_outs
)])
m
=
metric
.
update
(
*
[
to_numpy
(
m
)
for
m
in
to_list
(
metric_outs
)])
metrics
.
append
(
m
)
metrics
.
append
(
m
)
if
self
.
model
.
_loss
and
len
(
metrics
):
if
self
.
model
.
_loss
and
len
(
metrics
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录