All Products
Search
Document Center

Platform For AI:Use custom components

Last Updated:Apr 01, 2026

Machine Learning Designer lets you build visual ML pipelines by dragging components onto a canvas. If your training code is stored in an Object Storage Service (OSS) bucket, you can wrap it as a custom algorithm component and reuse it across pipelines — without rewriting the execution logic each time. This topic walks through creating a PyTorch-based custom component and using it in a pipeline.

Limits

Custom components run only on the public resource group of general computing resources in Machine Learning Designer.

Prerequisites

Before you begin, ensure that you have:

Create and use a custom PyTorch component

Step 1: Create the component

On the Create Component page, configure a PyTorch-based component. For the full creation flow, see Create a custom component.

Execution configuration

Configure the execution environment on the Execution Configuration tab. image..png

ParameterDescription
Job TypeSelect PyTorch.
ImageSelect Community Image, then select pytorch-training:1.12-cpu-py39-ubuntu20.04 from the drop-down list.
CodeSelect Mount OSS Path and enter the path to the OSS bucket that contains main.py and requirements.txt.
CommandSet the command to python main.py $PAI_USER_ARGS --train $PAI_INPUT_TRAIN --test $PAI_INPUT_TEST --model $PAI_OUTPUT_MODEL --checkpoints $PAI_OUTPUT_CHECKPOINTS && echo "job finished".

Pipeline and parameter configuration

Define the input/output interfaces and parameters on the Pipeline and Parameter tab. These settings determine the component's ports and configuration pane in the Designer. image..png

Click the image..png icon to add each item.

Input pipelines

NameSourceRequiredDescription
trainOSSYesTraining data
testOSSNoTest data

Output pipelines

NameStorageRequiredDescription
modelOSSYesModel data
checkpointsOSSYesAlgorithm checkpoints

Parameters

Parameter nameTypeDefault valueRequired
param1Int6Yes
param2Float0.3Yes
param3Stringtest1Yes
param4BooltrueNo
param5Int2No

To set constraints on a parameter, click Constraint to the right of its Default Value field and follow the on-screen instructions.

Constraints

Configure instance type restrictions on the Constraints tab. image..png

ParameterSetting
Enable ConstraintsTurn on Enable Constraints.
Instance TypeSelect CPU and GPU.
Multiple InstancesSelect Supported.
Multiple GPUsSelect Not Supported.

Step 2: Create a blank pipeline

Create a blank pipeline to use as your canvas. See Create a blank pipeline for instructions.

Step 3: Add the component to the pipeline

After the component is created, it appears in the algorithm tree in Machine Learning Designer for the current workspace.

Drag the component from the left-side component list onto the canvas and connect it the same way as built-in components. 7706a160936ede732315086bf3745c83..png

The input and output pipelines you configured become the component's input and output ports. 40ea48eb12349496759fb55cb857a050..png

The parameters appear in the right-side configuration pane. image..png

For each output port, select an OSS path as the output destination. image..png

The constraints appear as parameters on the Tuning tab of the configuration pane. image..png

Next steps

If the component no longer meets your requirements, update its configuration or add a new component version on the Custom Components page. See Manage custom components.