Skip to main content
Version: 10.2.4

Import model customized with AutoML SDK

info

The section describes how to manually create an Asset Bundle to deploy an old AutoML project. In a new AutoML project, an Asset Bundle is already created as a part of the project immediately after its generation from the Archetype. For more details, refer to Start from Archetype.

The importing flow includes the following steps:

  1. Add the artifact and the model you customized with AutoML SDK to an Asset Bundle.
  2. Deploy the Asset Bundle containing the artifact and the model to Control Tower.
  3. Check that the artifact and the model are imported successfully.

Add artifact and trained model to Asset Bundle​

Within an Asset Bundle structure, both the artifact and the trained model reside in the automl directory, as shown below. For the complete structure, refer to the guide.

...
├── automl
│ ├── model
│ └── artifact
...

Prepare artifact for import​

If you build a model in Maven with mvn clean install, the artifacts for the model are created under the ./deploy directory as ./deploy/%model_code%/%model_version%.

Example of the ./deploy directory structure​

Assume, we build the following hypermodel:

@ModelDescription(
code = "se20ie",
title = "se20 ie",
description = "se20 ie model",
version = "1.0-SNAPSHOT",
type = ModelType.IE
)
@HypermodelConfiguration(Se20ieModelConfiguration.class)
public class Se20ieModel extends IeGenericSe20Hypermodel {}

After you run the mvn clean install command, the ./deploy directory for the hypermodel above has the following structure :

To import the built models, copy the entire content of the ./deploy directory into automl/artifact within the structure of the Asset Bundle to be deployed.

Prepare trained model for import​

When you run model training locally, set id for your training configuration. This id is used as the trained model ID.

Once model training is finished, the output directory will contain the following structure:

...
├── id
│ ├── output
│ └── model
...

Example of the output directory structure​

Assume, we train the following model:

LocalTrainingConfiguration configuration = LocalTrainingConfiguration.builder()
.inputDir(inputDirPath)
.outputDir(outputDirPath)
.fields(fields)
.id("training-se20-ie")
.parameters(parameters)
.build();

ModelRunner.run(Se20ieModel.class, configuration);

The resulting output directory for the model above has the following structure:

Copy the ./id/output/ directory with its content into the modeldirectory of the Asset Bundle to be imported.

note

During import, trained models are validated against corresponding artifacts. When such artifacts are missing on the target instance or in the bundle, the import fails.

Check the resulting Asset Bundle structure​

Below, you can find an example of an Asset Bundle structure for importing two artifacts and two trained models:

%bundle_root%
├── automl
│ ├── model
│ │ ├── pss-classification-model-1-0-15
│ │ │ └── output
│ │ │ └── model-info.json
│ │ │ └── model
│ │ ├── nss_name_matcher_python_model
│ │ │ └── output
│ │ │ └── model-info.json
│ │ │ └── model
│ │ │ └──....
│ ├── artifact
│ │ ├── pss-classification-model
│ │ │ └── 1.0.15
│ │ │ │ └──lib
│ │ │ │ └──model.description
│ │ │ │ └──worker-training.yml
│ │ │ │ └── ...
│ │ ├── nss-name-model
│ │ │ └──1.0.0
│ │ │ │ └──lib
│ │ │ │ └──model.description
│ │ │ │ └──worker-training.yml
│ │ │ │ └──...
└── meta-info.json

Import Asset Bundle​

See the instructions on importing an Asset Bundle:

Instead of importing the entire Asset Bundle structure as illustrated above, you can import only artifacts or trained models using the AutoML user interface in Control Tower:

Check availability of imported assets​

After the import is completed successfully, you can see the Asset Bundle appear on the Use Case list in CT.

To check the availability of the imported artifact in Control Tower, go to the AutoML menu, select Hyper models, and find it on the list.

The artifact's title and version correspond to the ones contained in the Hypermodel class (from the examples above, se20 ie and 1.0-SNAPSHOT).

To check the availability of the imported trained model in Control Tower, go to the AutoML menu, select Trained models, and find it on the list.

The model's title corresponds to the output directory ID (from the examples above, training-se20-ie).

Alternatively, to check whether the artifact and trained model are imported successfully, use the GET /bundle-import/{uuid} endpoint of the Asset Bundle migration API.