提交 009fc84d 编写于 作者: L luopengting

add annotation and validation for device_num

上级 b476d7d4
...@@ -142,6 +142,8 @@ def filter_summary_lineage(summary_base_dir, search_condition=None): ...@@ -142,6 +142,8 @@ def filter_summary_lineage(summary_base_dir, search_condition=None):
- batch_size (dict): The filter condition of batch size. - batch_size (dict): The filter condition of batch size.
- device_num (dict): The filter condition of device num.
- loss (dict): The filter condition of loss. - loss (dict): The filter condition of loss.
- model_size (dict): The filter condition of model size. - model_size (dict): The filter condition of model size.
......
...@@ -81,7 +81,9 @@ class LineageErrors(LineageErrorCodes): ...@@ -81,7 +81,9 @@ class LineageErrors(LineageErrorCodes):
LINEAGE_FILE_NOT_FOUND_ERROR = 22 | _MODEL_LINEAGE_API_ERROR_MASK LINEAGE_FILE_NOT_FOUND_ERROR = 22 | _MODEL_LINEAGE_API_ERROR_MASK
LINEAGE_PARAM_SUMMARY_PATH_ERROR = 23 | _MODEL_LINEAGE_API_ERROR_MASK LINEAGE_PARAM_SUMMARY_PATH_ERROR = 23 | _MODEL_LINEAGE_API_ERROR_MASK
LINEAGE_SEARCH_CONDITION_PARAM_ERROR = 24 | _MODEL_LINEAGE_API_ERROR_MASK LINEAGE_SEARCH_CONDITION_PARAM_ERROR = 24 | _MODEL_LINEAGE_API_ERROR_MASK
LINEAGE_PARAM_LINEAGE_TYPE_ERROR = 25 | _MODEL_LINEAGE_API_ERROR_MASK LINEAGE_PARAM_LINEAGE_TYPE_ERROR = 25 | _MODEL_LINEAGE_API_ERROR_MASK
LINEAGE_PARAM_DEVICE_NUM_ERROR = 26 | _MODEL_LINEAGE_API_ERROR_MASK
# Dataset lineage error codes. # Dataset lineage error codes.
LINEAGE_PARAM_DATASET_MARK_ERROR = 0 | _DATASET_LINEAGE_ERROR_MASK LINEAGE_PARAM_DATASET_MARK_ERROR = 0 | _DATASET_LINEAGE_ERROR_MASK
...@@ -146,6 +148,8 @@ class LineageErrorMsg(Enum): ...@@ -146,6 +148,8 @@ class LineageErrorMsg(Enum):
PARAM_BATCH_SIZE_ERROR = "The parameter batch_size is invalid. It should be a non-negative integer." PARAM_BATCH_SIZE_ERROR = "The parameter batch_size is invalid. It should be a non-negative integer."
PARAM_DEVICE_NUM_ERROR = "The parameter device_num is invalid. It should be a non-negative integer."
PARAM_CALLBACK_LIST_ERROR = "The parameter list_callback is invalid. It should be an instance of " \ PARAM_CALLBACK_LIST_ERROR = "The parameter list_callback is invalid. It should be an instance of " \
"mindspore.train.callback._ListCallback." "mindspore.train.callback._ListCallback."
......
...@@ -123,6 +123,7 @@ class SearchModelConditionParameter(Schema): ...@@ -123,6 +123,7 @@ class SearchModelConditionParameter(Schema):
learning_rate = fields.Dict() learning_rate = fields.Dict()
epoch = fields.Dict() epoch = fields.Dict()
batch_size = fields.Dict() batch_size = fields.Dict()
device_num = fields.Dict()
loss = fields.Dict() loss = fields.Dict()
model_size = fields.Dict() model_size = fields.Dict()
limit = fields.Int(validate=lambda n: 0 < n <= 100) limit = fields.Int(validate=lambda n: 0 < n <= 100)
...@@ -228,6 +229,11 @@ class SearchModelConditionParameter(Schema): ...@@ -228,6 +229,11 @@ class SearchModelConditionParameter(Schema):
"""Check batch size.""" """Check batch size."""
SearchModelConditionParameter.check_dict_value_type(data, int) SearchModelConditionParameter.check_dict_value_type(data, int)
@validates("device_num")
def check_device_num(self, data):
"""Check device num."""
SearchModelConditionParameter.check_dict_value_type(data, int)
@validates("model_size") @validates("model_size")
def check_model_size(self, data): def check_model_size(self, data):
"""Check model size.""" """Check model size."""
......
...@@ -57,6 +57,7 @@ SEARCH_MODEL_ERROR_MAPPING = { ...@@ -57,6 +57,7 @@ SEARCH_MODEL_ERROR_MAPPING = {
'learning_rate': LineageErrors.LINEAGE_PARAM_LEARNING_RATE_ERROR, 'learning_rate': LineageErrors.LINEAGE_PARAM_LEARNING_RATE_ERROR,
'epoch': LineageErrors.LINEAGE_PARAM_EPOCH_ERROR, 'epoch': LineageErrors.LINEAGE_PARAM_EPOCH_ERROR,
'batch_size': LineageErrors.LINEAGE_PARAM_BATCH_SIZE_ERROR, 'batch_size': LineageErrors.LINEAGE_PARAM_BATCH_SIZE_ERROR,
'device_num': LineageErrors.LINEAGE_PARAM_DEVICE_NUM_ERROR,
'limit': LineageErrors.PARAM_VALUE_ERROR, 'limit': LineageErrors.PARAM_VALUE_ERROR,
'offset': LineageErrors.PARAM_VALUE_ERROR, 'offset': LineageErrors.PARAM_VALUE_ERROR,
'loss': LineageErrors.LINEAGE_PARAM_LOSS_ERROR, 'loss': LineageErrors.LINEAGE_PARAM_LOSS_ERROR,
...@@ -92,6 +93,7 @@ SEARCH_MODEL_ERROR_MSG_MAPPING = { ...@@ -92,6 +93,7 @@ SEARCH_MODEL_ERROR_MSG_MAPPING = {
'learning_rate': LineageErrorMsg.LINEAGE_LEARNING_RATE_ERROR.value, 'learning_rate': LineageErrorMsg.LINEAGE_LEARNING_RATE_ERROR.value,
'epoch': LineageErrorMsg.PARAM_EPOCH_NUM_ERROR.value, 'epoch': LineageErrorMsg.PARAM_EPOCH_NUM_ERROR.value,
'batch_size': LineageErrorMsg.PARAM_BATCH_SIZE_ERROR.value, 'batch_size': LineageErrorMsg.PARAM_BATCH_SIZE_ERROR.value,
'device_num': LineageErrorMsg.PARAM_DEVICE_NUM_ERROR.value,
'limit': LineageErrorMsg.PARAM_LIMIT_ERROR.value, 'limit': LineageErrorMsg.PARAM_LIMIT_ERROR.value,
'offset': LineageErrorMsg.PARAM_OFFSET_ERROR.value, 'offset': LineageErrorMsg.PARAM_OFFSET_ERROR.value,
'loss': LineageErrorMsg.LINEAGE_LOSS_ERROR.value, 'loss': LineageErrorMsg.LINEAGE_LOSS_ERROR.value,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册