Create a model using the CLI
Provides steps to create a model using the CLI.
- Open a terminal window and log into cdswctl.
-
Obtain the engine image ID as described in the following steps:
-
Run the following command:
cdswctl projects list
The project ID, your username, and the project name are displayed. For example:1: john-smith/petal-length-predictor -
Note the project ID, which is a number in front of your project
name.
In this case, it is "1".
-
Run the following command:
-
Run the following command while specifying the project name and note the engine
image ID:
cdswctl engine-images list -p <project-name>
For example,cdswctl engine-images list -p john-smith/petal-length-predictor
-
Create a model by using the following command:
cdswctl models create --kernel="python3" --targetFilePath="predict.py" --targetFunctionName="predict" --name="Petal Length Predictor" --cpuMillicores=1000 --memoryMb=2000 --description="Model of the Iris dataset" --replicationType=fixed --numReplicas=1 --visibility="private" --autoBuildModel --autoDeployModel --projectId=<project ID> --examples='{"request":{"petal_length":1}}' --engineImageId=<engine image ID from before>
If the command runs successfully, the system displays the model details in a JSON format.For more information about themodels create
command parameters, run the following command:cdswctl models create --help