Configuring Workflow Parameters
Description
A workflow parameter is a placeholder object that can be configured when the workflow runs. The following data types are supported: int, str, bool, float, Enum, dict, and list. You can display fields (such as algorithm hyperparameters) in a phase as placeholders in a transparent way. You can modify and use the default values that are set for them.
Parameter Overview (Placeholder)
Parameter |
Description |
Mandatory |
Data Type |
---|---|---|---|
name |
Parameter name, which must be globally unique. |
Yes |
str |
placeholder_type |
Parameter type. The mapping between placeholder types and actual data types: PlaceholderType.INT -> int PlaceholderType.STR -> str PlaceholderType.BOOL -> bool PlaceholderType.FLOAT -> float PlaceholderType.ENUM -> Enum PlaceholderType.JSON -> dict PlaceholderType.LIST -> list
|
Yes |
PlaceholderType |
default |
Default parameter value. The data type must be the same as that of placeholder_type. |
No |
Any |
placeholder_format |
Supported data formats. Currently, obs, flavor, train_flavor, swr, and pacific are supported. |
No |
str |
delay |
Whether parameters are set when the workflow is running. The default value is False, indicating that parameters are set before the workflow runs. If the value is True, parameters are set in an action of the phase where they are needed. |
No |
bool |
description |
Parameter description. |
No |
str |
enum_list |
List of enumerated values of a parameter. This parameter is mandatory only for parameters of PlaceholderType.ENUM type. |
No |
list |
constraint |
Constraints on parameters. This parameter only supports the constraints of training specifications and is not visible to you. |
No |
dict |
required |
Whether the parameter is mandatory.
This parameter is optional at the frontend during execution. |
No |
bool |
Examples
- Integer parameter
from modelarts import workflow as wf wf.Placeholder(name="placeholder_int", placeholder_type=wf.PlaceholderType.INT, default=1, description="This is an integer parameter.")
- String parameter
from modelarts import workflow as wf wf.Placeholder(name="placeholder_str", placeholder_type=wf.PlaceholderType.STR, default="default_value", description="This is a string parameter.")
- Bool parameter
from modelarts import workflow as wf wf.Placeholder(name="placeholder_bool", placeholder_type=wf.PlaceholderType.BOOL, default=True, description="This is a bool parameter.")
- Float parameter
from modelarts import workflow as wf wf.Placeholder(name="placeholder_float", placeholder_type=wf.PlaceholderType.FLOAT, default=0.1, description="This is a float parameter.")
- Enumeration parameter
from modelarts import workflow as wf wf.Placeholder(name="placeholder_enum", placeholder_type=wf.PlaceholderType.ENUM, default="a", enum_list=["a", "b"], description="This is an enumeration parameter.")
- Dictionary parameter
from modelarts import workflow as wf wf.Placeholder(name="placeholder_dict", placeholder_type=wf.PlaceholderType.JSON, default={"key": "value"}, description="This is a dictionary parameter.")
- List parameter
from modelarts import workflow as wf wf.Placeholder(name="placeholder_list", placeholder_type=wf.PlaceholderType.LIST, default=[1, 2], placeholder_format="int", description="This is a list parameter and its value is an integer.")
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot