Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
mindinsight
提交
d15c81c6
M
mindinsight
项目概览
MindSpore
/
mindinsight
通知
7
Star
3
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindinsight
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d15c81c6
编写于
5月 28, 2020
作者:
L
luopengting
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove invalid item in user_defined info, record valid items
上级
c4fc9bfb
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
52 addition
and
13 deletion
+52
-13
mindinsight/lineagemgr/collection/model/model_lineage.py
mindinsight/lineagemgr/collection/model/model_lineage.py
+2
-2
mindinsight/lineagemgr/common/validator/validate.py
mindinsight/lineagemgr/common/validator/validate.py
+7
-4
tests/st/func/lineagemgr/api/test_model_api.py
tests/st/func/lineagemgr/api/test_model_api.py
+5
-5
tests/st/func/lineagemgr/cache/test_lineage_cache.py
tests/st/func/lineagemgr/cache/test_lineage_cache.py
+1
-1
tests/st/func/lineagemgr/collection/model/test_model_lineage.py
...st/func/lineagemgr/collection/model/test_model_lineage.py
+31
-1
tests/ut/lineagemgr/querier/event_data.py
tests/ut/lineagemgr/querier/event_data.py
+6
-0
未找到文件。
mindinsight/lineagemgr/collection/model/model_lineage.py
浏览文件 @
d15c81c6
...
...
@@ -284,8 +284,8 @@ class EvalLineage(Callback):
self
.
lineage_summary
=
LineageSummary
(
self
.
lineage_log_dir
)
self
.
user_defined_info
=
user_defined_info
if
user_defined_info
:
validate_user_defined_info
(
user_defined_info
)
if
self
.
user_defined_info
:
validate_user_defined_info
(
self
.
user_defined_info
)
except
MindInsightException
as
err
:
log
.
error
(
err
)
...
...
mindinsight/lineagemgr/common/validator/validate.py
浏览文件 @
d15c81c6
...
...
@@ -410,7 +410,7 @@ def validate_path(summary_path):
def
validate_user_defined_info
(
user_defined_info
):
"""
Validate user defined info.
Validate user defined info
, delete the item if its key is in lineage
.
Args:
user_defined_info (dict): The user defined info.
...
...
@@ -437,10 +437,13 @@ def validate_user_defined_info(user_defined_info):
field_map
=
set
(
FIELD_MAPPING
.
keys
())
user_defined_keys
=
set
(
user_defined_info
.
keys
())
all_keys
=
field_map
|
user_defined_keys
insertion
=
list
(
field_map
&
user_defined_keys
)
if
len
(
field_map
)
+
len
(
user_defined_keys
)
!=
len
(
all_keys
):
raise
LineageParamValueError
(
"There are some keys have defined in lineage."
)
if
insertion
:
for
key
in
insertion
:
user_defined_info
.
pop
(
key
)
raise
LineageParamValueError
(
"There are some keys have defined in lineage. "
"Duplicated key(s): %s. "
%
insertion
)
def
validate_train_id
(
relative_path
):
...
...
tests/st/func/lineagemgr/api/test_model_api.py
浏览文件 @
d15c81c6
...
...
@@ -92,7 +92,7 @@ LINEAGE_FILTRATION_RUN1 = {
'train_dataset_count'
:
1024
,
'test_dataset_path'
:
None
,
'test_dataset_count'
:
1024
,
'user_defined'
:
{},
'user_defined'
:
{
'info'
:
'info1'
,
'version'
:
'v1'
},
'network'
:
'ResNet'
,
'optimizer'
:
'Momentum'
,
'learning_rate'
:
0.11999999731779099
,
...
...
@@ -329,7 +329,7 @@ class TestModelApi(TestCase):
def
test_filter_summary_lineage
(
self
):
"""Test the interface of filter_summary_lineage."""
expect_result
=
{
'customized'
:
event_data
.
CUSTOMIZED__
0
,
'customized'
:
event_data
.
CUSTOMIZED__
1
,
'object'
:
[
LINEAGE_FILTRATION_EXCEPT_RUN
,
LINEAGE_FILTRATION_RUN1
,
...
...
@@ -383,7 +383,7 @@ class TestModelApi(TestCase):
'offset'
:
0
}
expect_result
=
{
'customized'
:
event_data
.
CUSTOMIZED__
0
,
'customized'
:
event_data
.
CUSTOMIZED__
1
,
'object'
:
[
LINEAGE_FILTRATION_RUN2
,
LINEAGE_FILTRATION_RUN1
...
...
@@ -421,7 +421,7 @@ class TestModelApi(TestCase):
'offset'
:
0
}
expect_result
=
{
'customized'
:
event_data
.
CUSTOMIZED__
0
,
'customized'
:
event_data
.
CUSTOMIZED__
1
,
'object'
:
[
LINEAGE_FILTRATION_RUN2
,
LINEAGE_FILTRATION_RUN1
...
...
@@ -449,7 +449,7 @@ class TestModelApi(TestCase):
'sorted_name'
:
'metric/accuracy'
,
}
expect_result
=
{
'customized'
:
event_data
.
CUSTOMIZED__
0
,
'customized'
:
event_data
.
CUSTOMIZED__
1
,
'object'
:
[
LINEAGE_FILTRATION_EXCEPT_RUN
,
LINEAGE_FILTRATION_RUN1
,
...
...
tests/st/func/lineagemgr/cache/test_lineage_cache.py
浏览文件 @
d15c81c6
...
...
@@ -70,7 +70,7 @@ class TestModelApi(TestCase):
def
test_filter_summary_lineage
(
self
):
"""Test the interface of filter_summary_lineage."""
expect_result
=
{
'customized'
:
event_data
.
CUSTOMIZED__
0
,
'customized'
:
event_data
.
CUSTOMIZED__
1
,
'object'
:
[
LINEAGE_FILTRATION_EXCEPT_RUN
,
LINEAGE_FILTRATION_RUN1
,
...
...
tests/st/func/lineagemgr/collection/model/test_model_lineage.py
浏览文件 @
d15c81c6
...
...
@@ -28,7 +28,7 @@ from unittest import mock, TestCase
import
numpy
as
np
import
pytest
from
mindinsight.lineagemgr
import
get_summary_lineage
from
mindinsight.lineagemgr
import
get_summary_lineage
,
filter_summary_lineage
from
mindinsight.lineagemgr.collection.model.model_lineage
import
TrainLineage
,
EvalLineage
,
\
AnalyzeObject
from
mindinsight.lineagemgr.common.utils
import
make_directory
...
...
@@ -109,6 +109,36 @@ class TestModelLineage(TestCase):
lineage_log_path
=
train_callback
.
lineage_summary
.
lineage_log_path
assert
os
.
path
.
isfile
(
lineage_log_path
)
is
True
@
pytest
.
mark
.
scene_train
(
2
)
@
pytest
.
mark
.
level0
@
pytest
.
mark
.
platform_arm_ascend_training
@
pytest
.
mark
.
platform_x86_gpu_training
@
pytest
.
mark
.
platform_x86_ascend_training
@
pytest
.
mark
.
platform_x86_cpu
@
pytest
.
mark
.
env_single
def
test_train_begin_with_user_defined_key_in_lineage
(
self
):
"""Test TrainLineage with nested user defined info."""
expected_res
=
{
"info"
:
"info1"
,
"version"
:
"v1"
}
user_defined_info
=
{
"info"
:
"info1"
,
"version"
:
"v1"
,
"network"
:
"LeNet"
}
train_callback
=
TrainLineage
(
self
.
summary_record
,
False
,
user_defined_info
)
train_callback
.
begin
(
RunContext
(
self
.
run_context
))
assert
train_callback
.
initial_learning_rate
==
0.12
lineage_log_path
=
train_callback
.
lineage_summary
.
lineage_log_path
assert
os
.
path
.
isfile
(
lineage_log_path
)
is
True
res
=
filter_summary_lineage
(
os
.
path
.
dirname
(
lineage_log_path
))
assert
expected_res
==
res
[
'object'
][
0
][
'model_lineage'
][
'user_defined'
]
@
pytest
.
mark
.
scene_train
(
2
)
@
pytest
.
mark
.
level0
@
pytest
.
mark
.
platform_arm_ascend_training
...
...
tests/ut/lineagemgr/querier/event_data.py
浏览文件 @
d15c81c6
...
...
@@ -192,6 +192,12 @@ CUSTOMIZED__0 = {
'metric/accuracy'
:
{
'label'
:
'metric/accuracy'
,
'required'
:
True
,
'type'
:
'float'
},
}
CUSTOMIZED__1
=
{
**
CUSTOMIZED__0
,
'user_defined/info'
:
{
'label'
:
'user_defined/info'
,
'required'
:
False
,
'type'
:
'str'
},
'user_defined/version'
:
{
'label'
:
'user_defined/version'
,
'required'
:
False
,
'type'
:
'str'
}
}
CUSTOMIZED_0
=
{
**
CUSTOMIZED__0
,
'metric/mae'
:
{
'label'
:
'metric/mae'
,
'required'
:
True
,
'type'
:
'float'
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录