Examples
There are three scenarios:
- Releasing a dataset version
- Releasing a labeling job version
- Releasing a version based on the output of the labeling phase
Releasing a Dataset Version
Scenario: When data in a dataset is updated, this phase can be used to release a dataset version for subsequent phases to use.
from modelarts import workflow as wf # Use ReleaseDatasetStep to release a version of the input dataset and output the dataset with version information. # Define the dataset. dataset = wf.data.DatasetPlaceholder(name="input_dataset") # Define the split ratio between the training set and validation set train_ration = wf.Placeholder(name="placeholder_name", placeholder_type=wf.PlaceholderType.STR, default="0.8") release_version = wf.steps.ReleaseDatasetStep( name="release_dataset", # Name of the dataset release phase. The name contains a maximum of 64 characters, including only letters, digits, underscores (_), and hyphens (-). It must start with a letter and must be unique in a workflow. title="Dataset version release", # Title, which defaults to the value of name inputs=wf.steps.ReleaseDatasetInput(name="input_name", data=dataset), # ReleaseDatasetStep inputs. The dataset object is configured when the workflow is running. You can also use wf.data.Dataset(dataset_name="dataset_name") for the data field. outputs=wf.steps.ReleaseDatasetOutput( name="output_name", dataset_version_config=wf.data.DatasetVersionConfig( label_task_type=wf.data.LabelTaskTypeEnum.IMAGE_CLASSIFICATION, # Labeling job type for dataset version release train_evaluate_sample_ratio=train_ration # Split ratio between the training set and validation set ) ) # ReleaseDatasetStep outputs ) workflow = wf.Workflow( name="dataset-release-demo", desc="this is a demo workflow", steps=[release_version] )
Releasing a Labeling Job Version
When data or labeling information of a labeling job is updated, this phase can be used to release a dataset version for subsequent phases to use.
from modelarts import workflow as wf # Use ReleaseDatasetStep to release a version of the input labeling job and output the dataset with version information. # Define the labeling job. label_task = wf.data.LabelTaskPlaceholder(name="label_task_placeholder_name") # Define the split ratio between the training set and validation set train_ration = wf.Placeholder(name="placeholder_name", placeholder_type=wf.PlaceholderType.STR, default="0.8") release_version = wf.steps.ReleaseDatasetStep( name="release_dataset", # Name of the dataset release phase. The name contains a maximum of 64 characters, including only letters, digits, underscores (_), and hyphens (-). It must start with a letter and must be unique in a workflow. title="Dataset version release", # Title, which defaults to the value of name inputs=wf.steps.ReleaseDatasetInput(name="input_name", data=label_task), # ReleaseDatasetStep inputs The labeling job object is configured when the workflow is running. You can also use wf.data.LabelTask(dataset_name="dataset_name", task_name="label_task_name") for the data field. outputs=wf.steps.ReleaseDatasetOutput(name="output_name", dataset_version_config=wf.data.DatasetVersionConfig(train_evaluate_sample_ratio=train_ration)), # Split ratio between the training set and validation set ) workflow = wf.Workflow( name="dataset-release-demo", desc="this is a demo workflow", steps=[release_version] )
Creating a Dataset Release Phase Based on the Labeling Phase
Scenario: The outputs of the labeling phase are used as the inputs of the dataset release phase.
from modelarts import workflow as wf # Use ReleaseDatasetStep to release a version of the input labeling job and output the dataset with version information. # Define the split ratio between the training set and validation set train_ration = wf.Placeholder(name="placeholder_name", placeholder_type=wf.PlaceholderType.STR, default="0.8") release_version = wf.steps.ReleaseDatasetStep( name="release_dataset", # Name of the dataset release phase. The name contains a maximum of 64 characters, including only letters, digits, underscores (_), and hyphens (-). It must start with a letter and must be unique in a workflow. title="Dataset version release", # Title, which defaults to the value of name inputs=wf.steps.ReleaseDatasetInput(name="input_name", data=labeling_step.outputs["output_name"].as_input()), # ReleaseDatasetStep inputs The labeling job object is configured when the workflow is running. You can also use wf.data.LabelTask(dataset_name="dataset_name", task_name="label_task_name") for the data field. outputs=wf.steps.ReleaseDatasetOutput(name="output_name", dataset_version_config=wf.data.DatasetVersionConfig(train_evaluate_sample_ratio=train_ration)), # Split ratio between the training set and validation set depend_steps = [labeling_step] # Preceding labeling phase ) # labeling_step is an instance object of wf.steps.LabelingStep and output_name is the value of the name field of wf.steps.LabelingOutput. workflow = wf.Workflow( name="dataset-release-demo", desc="this is a demo workflow", steps=[release_version] )
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