Skip to main content
Version: 10.2.9

Pull remote CT trained model into local machine

Introduction

As the local machine's resources sometimes are not enough to perform the AutoML Model training, we recommend using resources of the remote environment cluster. As a result, the Trained Model will appear in the remote environment.

The article describes:

  • How you can download the Trained Model to the local environment.
  • What you need to do that.

Prerequisites

From this point, let's assume that the custom Model was created using ODF, and it is sourced from the [ARTIFACT]-ml-sdk module of your project. If this isn't the case, you will have to create a new project to pull the Trained Model locally, or work within the existing project to extend the package with the Model and the Trained Model. Let's also assume that each modification of the AutoML hyper-Model leads to increasing its version.

Specify Control Tower user credentials in Maven settings

You need to know the URL and credentials of the remote Control Tower and have them provided in the Maven settings. Open [~USER_HOME]/.m2/settings.xml and verify that the following code block is present.

<!-- Credentials for Bundle Import API -->  
<server>
<id>control-tower</id>
<username>username</username>
<password>password</password>
</server>

The Control Tower user should have the Export/Import permission.

Provide Control Tower URL in project build configuration

Your project root pom.xml must contain the URL of the remote Control Tower.

<workfusion.environment.url>https://ct.example.com</workfusion.environment.url>

Add the needed configuration if it is missing, or correct the URL if it is not the URL of your remote Control Tower.

Configure project to work on bundle-maven-plugin v10.1.0.1 and higher

Make sure pom.xml of the package module of your project refers to a newer version of bundle-maven-plugin. The projects created from the quickstart archetypes starting from v10.1.0.9 already point to a newer plugin. For older projects, you may need to update the <plugin> ..</plugin> block of the package module's pom.xml.

<plugin>
<groupId>com.workfusion.odf</groupId>
<artifactId>bundle-maven-plugin</artifactId>
<version>10.1.0.1</version>
<configuration>
<server>
<id>control-tower</id>
<url>${workfusion.environment.url}</url>
</server>

<!-- Optional parameters -->
<downloadPath>target</downloadPath>
<extractionPath>src/main/resources</extractionPath>
<maxWaitingTime>10</maxWaitingTime>
</configuration>
</plugin>

Your configuration should match the one provided above. Mind several optional parameters which could be omitted or added depending on the situation:

  • downloadPath: the path where the package with the model and the artifact should be downloaded (by default, target)
  • extractionPath: the path where the downloaded model and the artifact should be extracted (by default, src/main/resources)
  • maxWaitingTime: the maximum time of Control Tower export process waiting (in minutes)

Pull Trained Model to project structure with Maven

Given the prerequisites above, you can run Maven goal to pull the Trained Model to the [ARTIFACT]-package module of your project:

mvn bundle:pull-model -Dmodel=trained_model_name

After that, the automl/model/[trained_model_name] and automl/artifact/[hyper_model_name]/[hyper_model_version] sub-folders are created in the src/main/resources folder of the [ARTIFACT]-package module of your project.

  • automl/model/[trained_model_name] contains data corresponding to the Trained Model.
  • automl/artifact/[model_name]/[hyper_model_version] contains the hyper-Model that was trained. If the hyper-Model sourced in the [ARTIFACT]-ml-sdk project hasn't been modified since training on the remote environment, it will be a copy of your current model; in that case, it will be overwritten later when you build the Asset Bundle.

Now, your project includes the Trained Model. Run Maven goal:

mvn clean install

On executing the command, the Asset Bundle in the target folder of the [ARTIFACT]-package module of your project will contain that Trained model as well.