Skip to content

Latest commit

 

History

History
659 lines (520 loc) · 27.5 KB

File metadata and controls

659 lines (520 loc) · 27.5 KB

TrainingApi

All URIs are relative to http://localhost

Method HTTP request Description
cancelTraining POST /cancel_training Cancel Training
getEvaluationWithTrainerExport POST /evaluate Get Evaluation With Trainer Export
trainEvalInfo GET /train_eval_info Train Eval Info
trainEvalMetrics GET /train_eval_metrics Train Eval Metrics
trainMetacat POST /train_metacat Train Metacat
trainSupervised POST /train_supervised Train Supervised
trainUnsupervised POST /train_unsupervised Train Unsupervised
trainUnsupervisedWithHfDataset POST /train_unsupervised_with_hf_hub_dataset Train Unsupervised With Hf Dataset

cancelTraining

Object cancelTraining()

Cancel Training

Cancel the in-progress training job (this is experimental and may not work as expected)

Example

// Import classes:
import org.cms.client.ApiClient;
import org.cms.client.ApiException;
import org.cms.client.Configuration;
import org.cms.client.auth.*;
import org.cms.client.models.*;
import org.cms.client.api.TrainingApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure OAuth2 access token for authorization: OAuth2PasswordBearer
    OAuth OAuth2PasswordBearer = (OAuth) defaultClient.getAuthentication("OAuth2PasswordBearer");
    OAuth2PasswordBearer.setAccessToken("YOUR ACCESS TOKEN");

    // Configure API key authorization: APIKeyCookie
    ApiKeyAuth APIKeyCookie = (ApiKeyAuth) defaultClient.getAuthentication("APIKeyCookie");
    APIKeyCookie.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //APIKeyCookie.setApiKeyPrefix("Token");

    TrainingApi apiInstance = new TrainingApi(defaultClient);
    try {
      Object result = apiInstance.cancelTraining();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling TrainingApi#cancelTraining");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

This endpoint does not need any parameter.

Return type

Object

Authorization

OAuth2PasswordBearer, APIKeyCookie

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -

getEvaluationWithTrainerExport

Object getEvaluationWithTrainerExport(trainerExport, trackingId)

Get Evaluation With Trainer Export

Evaluate the model being served with a trainer export

Example

// Import classes:
import org.cms.client.ApiClient;
import org.cms.client.ApiException;
import org.cms.client.Configuration;
import org.cms.client.auth.*;
import org.cms.client.models.*;
import org.cms.client.api.TrainingApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure OAuth2 access token for authorization: OAuth2PasswordBearer
    OAuth OAuth2PasswordBearer = (OAuth) defaultClient.getAuthentication("OAuth2PasswordBearer");
    OAuth2PasswordBearer.setAccessToken("YOUR ACCESS TOKEN");

    // Configure API key authorization: APIKeyCookie
    ApiKeyAuth APIKeyCookie = (ApiKeyAuth) defaultClient.getAuthentication("APIKeyCookie");
    APIKeyCookie.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //APIKeyCookie.setApiKeyPrefix("Token");

    TrainingApi apiInstance = new TrainingApi(defaultClient);
    List<File> trainerExport = Arrays.asList(); // List<File> | One or more trainer export files to be uploaded
    String trackingId = "trackingId_example"; // String | The tracking ID of the requested task
    try {
      Object result = apiInstance.getEvaluationWithTrainerExport(trainerExport, trackingId);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling TrainingApi#getEvaluationWithTrainerExport");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
trainerExport List<File> One or more trainer export files to be uploaded
trackingId String The tracking ID of the requested task [optional]

Return type

Object

Authorization

OAuth2PasswordBearer, APIKeyCookie

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
422 Validation Error -

trainEvalInfo

Object trainEvalInfo(trainEvalId)

Train Eval Info

Get the training or evaluation job information by its ID

Example

// Import classes:
import org.cms.client.ApiClient;
import org.cms.client.ApiException;
import org.cms.client.Configuration;
import org.cms.client.auth.*;
import org.cms.client.models.*;
import org.cms.client.api.TrainingApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure OAuth2 access token for authorization: OAuth2PasswordBearer
    OAuth OAuth2PasswordBearer = (OAuth) defaultClient.getAuthentication("OAuth2PasswordBearer");
    OAuth2PasswordBearer.setAccessToken("YOUR ACCESS TOKEN");

    // Configure API key authorization: APIKeyCookie
    ApiKeyAuth APIKeyCookie = (ApiKeyAuth) defaultClient.getAuthentication("APIKeyCookie");
    APIKeyCookie.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //APIKeyCookie.setApiKeyPrefix("Token");

    TrainingApi apiInstance = new TrainingApi(defaultClient);
    String trainEvalId = "trainEvalId_example"; // String | The training or evaluation ID
    try {
      Object result = apiInstance.trainEvalInfo(trainEvalId);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling TrainingApi#trainEvalInfo");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
trainEvalId String The training or evaluation ID

Return type

Object

Authorization

OAuth2PasswordBearer, APIKeyCookie

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
422 Validation Error -

trainEvalMetrics

Object trainEvalMetrics(trainEvalId)

Train Eval Metrics

Get the training or evaluation metrics by its ID (Each metric may contain multiple values for multiple epochs)

Example

// Import classes:
import org.cms.client.ApiClient;
import org.cms.client.ApiException;
import org.cms.client.Configuration;
import org.cms.client.auth.*;
import org.cms.client.models.*;
import org.cms.client.api.TrainingApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure OAuth2 access token for authorization: OAuth2PasswordBearer
    OAuth OAuth2PasswordBearer = (OAuth) defaultClient.getAuthentication("OAuth2PasswordBearer");
    OAuth2PasswordBearer.setAccessToken("YOUR ACCESS TOKEN");

    // Configure API key authorization: APIKeyCookie
    ApiKeyAuth APIKeyCookie = (ApiKeyAuth) defaultClient.getAuthentication("APIKeyCookie");
    APIKeyCookie.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //APIKeyCookie.setApiKeyPrefix("Token");

    TrainingApi apiInstance = new TrainingApi(defaultClient);
    String trainEvalId = "trainEvalId_example"; // String | The training or evaluation ID
    try {
      Object result = apiInstance.trainEvalMetrics(trainEvalId);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling TrainingApi#trainEvalMetrics");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
trainEvalId String The training or evaluation ID

Return type

Object

Authorization

OAuth2PasswordBearer, APIKeyCookie

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
422 Validation Error -

trainMetacat

Object trainMetacat(trainerExport, epochs, logFrequency, trackingId, description)

Train Metacat

Upload one or more trainer export files and trigger the metacat training

Example

// Import classes:
import org.cms.client.ApiClient;
import org.cms.client.ApiException;
import org.cms.client.Configuration;
import org.cms.client.auth.*;
import org.cms.client.models.*;
import org.cms.client.api.TrainingApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure OAuth2 access token for authorization: OAuth2PasswordBearer
    OAuth OAuth2PasswordBearer = (OAuth) defaultClient.getAuthentication("OAuth2PasswordBearer");
    OAuth2PasswordBearer.setAccessToken("YOUR ACCESS TOKEN");

    // Configure API key authorization: APIKeyCookie
    ApiKeyAuth APIKeyCookie = (ApiKeyAuth) defaultClient.getAuthentication("APIKeyCookie");
    APIKeyCookie.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //APIKeyCookie.setApiKeyPrefix("Token");

    TrainingApi apiInstance = new TrainingApi(defaultClient);
    List<File> trainerExport = Arrays.asList(); // List<File> | One or more trainer export files to be uploaded
    Integer epochs = 1; // Integer | The number of training epochs
    Integer logFrequency = 1; // Integer | The number of processed documents or epochs after which training metrics will be logged
    String trackingId = "trackingId_example"; // String | The tracking ID of the requested task
    String description = "description_example"; // String | 
    try {
      Object result = apiInstance.trainMetacat(trainerExport, epochs, logFrequency, trackingId, description);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling TrainingApi#trainMetacat");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
trainerExport List<File> One or more trainer export files to be uploaded
epochs Integer The number of training epochs [optional] [default to 1]
logFrequency Integer The number of processed documents or epochs after which training metrics will be logged [optional] [default to 1]
trackingId String The tracking ID of the requested task [optional]
description String [optional]

Return type

Object

Authorization

OAuth2PasswordBearer, APIKeyCookie

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json

HTTP response details

Status code Description Response headers
202 Successful Response -
422 Validation Error -

trainSupervised

Object trainSupervised(trainerExport, epochs, lrOverride, testSize, earlyStoppingPatience, logFrequency, trackingId, description)

Train Supervised

Upload one or more trainer export files and trigger the supervised training

Example

// Import classes:
import org.cms.client.ApiClient;
import org.cms.client.ApiException;
import org.cms.client.Configuration;
import org.cms.client.auth.*;
import org.cms.client.models.*;
import org.cms.client.api.TrainingApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure OAuth2 access token for authorization: OAuth2PasswordBearer
    OAuth OAuth2PasswordBearer = (OAuth) defaultClient.getAuthentication("OAuth2PasswordBearer");
    OAuth2PasswordBearer.setAccessToken("YOUR ACCESS TOKEN");

    // Configure API key authorization: APIKeyCookie
    ApiKeyAuth APIKeyCookie = (ApiKeyAuth) defaultClient.getAuthentication("APIKeyCookie");
    APIKeyCookie.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //APIKeyCookie.setApiKeyPrefix("Token");

    TrainingApi apiInstance = new TrainingApi(defaultClient);
    List<File> trainerExport = Arrays.asList(); // List<File> | One or more trainer export files to be uploaded
    Integer epochs = 1; // Integer | The number of training epochs
    BigDecimal lrOverride = new BigDecimal(78); // BigDecimal | The override of the initial learning rate
    BigDecimal testSize = new BigDecimal(78); // BigDecimal | The override of the test size in percentage. (For a 'huggingface-ner' model, a negative value can be used to apply the train-validation-test split if implicitly defined in trainer export: 'projects[0]' is used for training, 'projects[1]' for validation, and 'projects[2]' for testing)
    Integer earlyStoppingPatience = 56; // Integer | The number of evaluations to wait for improvement before stopping the training. (Non-positive values disable early stopping)
    Integer logFrequency = 1; // Integer | The number of processed documents or epochs after which training metrics will be logged
    String trackingId = "trackingId_example"; // String | The tracking ID of the requested task
    String description = "description_example"; // String | 
    try {
      Object result = apiInstance.trainSupervised(trainerExport, epochs, lrOverride, testSize, earlyStoppingPatience, logFrequency, trackingId, description);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling TrainingApi#trainSupervised");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
trainerExport List<File> One or more trainer export files to be uploaded
epochs Integer The number of training epochs [optional] [default to 1]
lrOverride BigDecimal The override of the initial learning rate [optional]
testSize BigDecimal The override of the test size in percentage. (For a 'huggingface-ner' model, a negative value can be used to apply the train-validation-test split if implicitly defined in trainer export: 'projects[0]' is used for training, 'projects[1]' for validation, and 'projects[2]' for testing) [optional]
earlyStoppingPatience Integer The number of evaluations to wait for improvement before stopping the training. (Non-positive values disable early stopping) [optional]
logFrequency Integer The number of processed documents or epochs after which training metrics will be logged [optional] [default to 1]
trackingId String The tracking ID of the requested task [optional]
description String [optional]

Return type

Object

Authorization

OAuth2PasswordBearer, APIKeyCookie

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json

HTTP response details

Status code Description Response headers
202 Successful Response -
422 Validation Error -

trainUnsupervised

Object trainUnsupervised(trainingData, epochs, lrOverride, testSize, logFrequency, trackingId, description)

Train Unsupervised

Upload one or more files each containing a list of plain texts and trigger the unsupervised training

Example

// Import classes:
import org.cms.client.ApiClient;
import org.cms.client.ApiException;
import org.cms.client.Configuration;
import org.cms.client.auth.*;
import org.cms.client.models.*;
import org.cms.client.api.TrainingApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure OAuth2 access token for authorization: OAuth2PasswordBearer
    OAuth OAuth2PasswordBearer = (OAuth) defaultClient.getAuthentication("OAuth2PasswordBearer");
    OAuth2PasswordBearer.setAccessToken("YOUR ACCESS TOKEN");

    // Configure API key authorization: APIKeyCookie
    ApiKeyAuth APIKeyCookie = (ApiKeyAuth) defaultClient.getAuthentication("APIKeyCookie");
    APIKeyCookie.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //APIKeyCookie.setApiKeyPrefix("Token");

    TrainingApi apiInstance = new TrainingApi(defaultClient);
    List<File> trainingData = Arrays.asList(); // List<File> | One or more files to be uploaded and each contains a list of plain texts, in the format of [\\\"text_1\\\", \\\"text_2\\\", ..., \\\"text_n\\\"]
    Integer epochs = 1; // Integer | The number of training epochs
    BigDecimal lrOverride = new BigDecimal(78); // BigDecimal | The override of the initial learning rate
    BigDecimal testSize = new BigDecimal(78); // BigDecimal | The override of the test size in percentage
    Integer logFrequency = 1000; // Integer | The number of processed documents or epochs after which training metrics will be logged
    String trackingId = "trackingId_example"; // String | The tracking ID of the requested task
    String description = "description_example"; // String | 
    try {
      Object result = apiInstance.trainUnsupervised(trainingData, epochs, lrOverride, testSize, logFrequency, trackingId, description);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling TrainingApi#trainUnsupervised");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
trainingData List<File> One or more files to be uploaded and each contains a list of plain texts, in the format of [\&quot;text_1\&quot;, \&quot;text_2\&quot;, ..., \&quot;text_n\&quot;]
epochs Integer The number of training epochs [optional] [default to 1]
lrOverride BigDecimal The override of the initial learning rate [optional]
testSize BigDecimal The override of the test size in percentage [optional]
logFrequency Integer The number of processed documents or epochs after which training metrics will be logged [optional] [default to 1000]
trackingId String The tracking ID of the requested task [optional]
description String [optional]

Return type

Object

Authorization

OAuth2PasswordBearer, APIKeyCookie

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json

HTTP response details

Status code Description Response headers
202 Successful Response -
422 Validation Error -

trainUnsupervisedWithHfDataset

Object trainUnsupervisedWithHfDataset(hfDatasetRepoId, hfDatasetConfig, trustRemoteCode, textColumnName, epochs, lrOverride, testSize, logFrequency, description, trackingId, hfDatasetPackage)

Train Unsupervised With Hf Dataset

Upload or specify an existing Hugging Face dataset and trigger the unsupervised training

Example

// Import classes:
import org.cms.client.ApiClient;
import org.cms.client.ApiException;
import org.cms.client.Configuration;
import org.cms.client.auth.*;
import org.cms.client.models.*;
import org.cms.client.api.TrainingApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure OAuth2 access token for authorization: OAuth2PasswordBearer
    OAuth OAuth2PasswordBearer = (OAuth) defaultClient.getAuthentication("OAuth2PasswordBearer");
    OAuth2PasswordBearer.setAccessToken("YOUR ACCESS TOKEN");

    // Configure API key authorization: APIKeyCookie
    ApiKeyAuth APIKeyCookie = (ApiKeyAuth) defaultClient.getAuthentication("APIKeyCookie");
    APIKeyCookie.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //APIKeyCookie.setApiKeyPrefix("Token");

    TrainingApi apiInstance = new TrainingApi(defaultClient);
    String hfDatasetRepoId = "hfDatasetRepoId_example"; // String | The repository ID of the dataset to download from Hugging Face Hub, will be ignored when 'hf_dataset_package' is provided
    String hfDatasetConfig = "hfDatasetConfig_example"; // String | The name of the dataset configuration, will be ignored when 'hf_dataset_package' is provided
    Boolean trustRemoteCode = false; // Boolean | Whether to trust the remote code of the dataset
    String textColumnName = "text"; // String | The name of the text column in the dataset
    Integer epochs = 1; // Integer | The number of training epochs
    BigDecimal lrOverride = new BigDecimal(78); // BigDecimal | The override of the initial learning rate
    BigDecimal testSize = new BigDecimal(78); // BigDecimal | The override of the test size in percentage will only take effect if the dataset does not have predefined validation or test splits
    Integer logFrequency = 1000; // Integer | The number of processed documents or epochs after which training metrics will be logged
    String description = "description_example"; // String | The description of the training or change logs
    String trackingId = "trackingId_example"; // String | The tracking ID of the requested task
    File hfDatasetPackage = new File("/path/to/file"); // File | 
    try {
      Object result = apiInstance.trainUnsupervisedWithHfDataset(hfDatasetRepoId, hfDatasetConfig, trustRemoteCode, textColumnName, epochs, lrOverride, testSize, logFrequency, description, trackingId, hfDatasetPackage);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling TrainingApi#trainUnsupervisedWithHfDataset");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
hfDatasetRepoId String The repository ID of the dataset to download from Hugging Face Hub, will be ignored when 'hf_dataset_package' is provided [optional]
hfDatasetConfig String The name of the dataset configuration, will be ignored when 'hf_dataset_package' is provided [optional]
trustRemoteCode Boolean Whether to trust the remote code of the dataset [optional] [default to false]
textColumnName String The name of the text column in the dataset [optional] [default to text]
epochs Integer The number of training epochs [optional] [default to 1]
lrOverride BigDecimal The override of the initial learning rate [optional]
testSize BigDecimal The override of the test size in percentage will only take effect if the dataset does not have predefined validation or test splits [optional]
logFrequency Integer The number of processed documents or epochs after which training metrics will be logged [optional] [default to 1000]
description String The description of the training or change logs [optional]
trackingId String The tracking ID of the requested task [optional]
hfDatasetPackage File [optional]

Return type

Object

Authorization

OAuth2PasswordBearer, APIKeyCookie

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json

HTTP response details

Status code Description Response headers
202 Successful Response -
422 Validation Error -