Create and manage models

Create a custom model by using a prepared dataset. AutoML Translation uses the segment pairs from the dataset to train, test, and evaluate a new model.

Train models

After you have a dataset with enough segment pairs, you can create a custom model from that dataset.

Web UI

  1. Go to the AutoML Translation console.

    Go to the Translation page

  2. From the navigation pane, click Datasets to view a list of your datasets.

  3. Click the dataset to use to train a custom model.

    The console shows the segment pairs in the dataset along with their respective labels: Training, Validation, or Testing.

  4. When you are done reviewing the dataset, click the Train tab.

  5. Click Start Training to open the Train new model dialog.

  6. Specify a name for the model.

  7. Click Start Training to begin training your custom model.

    Training a model can take several hours to complete. You can check the training status by viewing recent activity.

REST

Before using any of the request data, make the following replacements:

  • PROJECT_ID: Your Google Cloud project ID.
  • LOCATION: The region where the model will be located, such as us-central1. The source dataset must also be in the same location.
  • MODEL_NAME: A name for the model.
  • DATASET_ID: The ID of the source dataset that Cloud Translation uses to create the model.

HTTP method and URL:

POST https://translation.googleapis.com/v3/projects/PROJECT_ID/locations/LOCATION/models

Request JSON body:

{
  "display_name": "MODEL_NAME",
  "dataset": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID",
}

To send your request, expand one of these options:

You should receive a JSON response similar to the following:

{
  "name": "projects/PROJECT_NUMBER/locations/LOCATION/operations/OPERATION_ID"
}

Additional languages

C#: Please follow the C# setup instructions on the client libraries page and then visit the Cloud Translation reference documentation for .NET.

PHP: Please follow the PHP setup instructions on the client libraries page and then visit the Cloud Translation reference documentation for PHP.

Ruby: Please follow the Ruby setup instructions on the client libraries page and then visit the Cloud Translation reference documentation for Ruby.

Get the status of a training job

You can check the status of a long-running task, like training a model, by using the Google Cloud console or Cloud Translation API.

Web UI

You can monitor the training job status in the Recent activities pane.
  1. Go to the AutoML Translation console.

    Go to the Translation page

  2. From the navigation pane, click Datasets.

  3. From the action bar, click View recent activities.

    Find the related CreateModel operation. The icon next to operation ID indicates the current status of the operations.

REST

To get the status of your training operation, send a GET request to the operations resource along with the operation ID that was included in the response after you submitted the training request.

Before using any of the request data, make the following replacements:

  • PROJECT_NUMBER_OR_ID: the numeric or alphanumeric ID of your Google Cloud project
  • location-id: the location you chose for your Cloud Storage bucket
  • operation-id: operation ID you received above

HTTP method and URL:

GET https://translation.googleapis.com/v3/projects/PROJECT_NUMBER_OR_ID/locations/location-id/operations/operation-id

To send your request, expand one of these options:

You should receive a JSON response similar to the following:

{
  "name": "projects/project-number/locations/location-id/operations/operation-id",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.translation.v3.SomeOperationMetadata",
    "state": "SUCCEEDED",
    "submitTime": "2019-11-27T22:59:40Z"
  }
}

Additional languages

C#: Please follow the C# setup instructions on the client libraries page and then visit the Cloud Translation reference documentation for .NET.

PHP: Please follow the PHP setup instructions on the client libraries page and then visit the Cloud Translation reference documentation for PHP.

Ruby: Please follow the Ruby setup instructions on the client libraries page and then visit the Cloud Translation reference documentation for Ruby.

Getting information about a model

After training is complete, you can get information about the model such as the model ID. To get details about a model's accuracy and readiness, see Evaluate models.

Web UI

You can monitor the training job status in the Recent activities pane.
  1. To see a list of the available models, go to the AutoML Translation console.

    Go to the Translation page

  2. From the navigation pane, click Models to view a table that lists of your models.

    The table includes information like the source and target language, BLEU score, and total segment pairs.

REST

Before using any of the request data, make the following replacements:

  • PROJECT_ID: Your Google Cloud project ID.
  • LOCATION: The region where the model to describe is located, such as us-central1.
  • MODEL_ID: The ID of the model to describe.

HTTP method and URL:

GET https://translation.googleapis.com/v3/projects/PROJECT_ID/locations/LOCATION/models/MODEL_ID

To send your request, expand one of these options:

You should receive a JSON response similar to the following:

{
  "name": "projects/PROJECT_NUMBER/locations/us-central1/models/MODEL_ID",
  "displayName": "MODEL_DISPLAY_NAME",
  "dataset": "projects/PROJECT_NUMBER/locations/us-central1/datasets/DATASET_ID"
  "sourceLanguageCode": "SOURCE_LANG_CODE",
  "targetLanguageCode": "TARGET_LANG_CODE",
  "trainExampleCount": NUM_TRAINING_SEGMENTS,
  "validateExampleCount": NUM_VALIDATION_SEGMENTS,
  "createTime": "2022-12-02T21:53:26.788521838Z",
  "updateTime": "2022-12-03T00:42:27.946594016Z"
}

Additional languages

C#: Please follow the C# setup instructions on the client libraries page and then visit the Cloud Translation reference documentation for .NET.

PHP: Please follow the PHP setup instructions on the client libraries page and then visit the Cloud Translation reference documentation for PHP.

Ruby: Please follow the Ruby setup instructions on the client libraries page and then visit the Cloud Translation reference documentation for Ruby.

Listing models

List the available models in your project.

Web UI

  1. To see a list of the available models, go to the AutoML Translation console.

    Go to the Translation page

  2. From the navigation pane, click Models to view a list of your models.

REST

Before using any of the request data, make the following replacements:

  • PROJECT_ID: Your Google Cloud project ID.
  • LOCATION: The region where the models to list are located, such as us-central1.

HTTP method and URL:

GET https://translation.googleapis.com/v3/projects/PROJECT_ID/locations/LOCATION/models

To send your request, expand one of these options:

You should receive a JSON response similar to the following:

{
  "models": [
    {
      "name": "projects/PROJECT_NUMBER/locations/us-central1/models/MODEL_ID",
      "displayName": "MODEL_DISPLAY_NAME",
      "dataset": "projects/PROJECT_NUMBER/locations/us-central1/datasets/DATASET_ID"
      "sourceLanguageCode": "SOURCE_LANG_CODE",
      "targetLanguageCode": "TARGET_LANG_CODE",
      "trainExampleCount": NUM_TRAINING_SEGMENTS,
      "validateExampleCount": NUM_VALIDATION_SEGMENTS,
      "createTime": "2022-12-02T21:53:26.788521838Z",
      "updateTime": "2022-12-03T00:42:27.946594016Z"
    },
    ...
  ]
}

Additional languages

C#: Please follow the C# setup instructions on the client libraries page and then visit the Cloud Translation reference documentation for .NET.

PHP: Please follow the PHP setup instructions on the client libraries page and then visit the Cloud Translation reference documentation for PHP.

Ruby: Please follow the Ruby setup instructions on the client libraries page and then visit the Cloud Translation reference documentation for Ruby.

Delete a model

Delete a model to remove it from your project.

Web UI

  1. To see a list of the available models, go to the AutoML Translation console.

    Go to the Translation page

  2. From the navigation pane, click Models to view a list of your models.

  3. For the model to delete, select More > Delete.

  4. Click Confirm to start the deletion.

REST

Before using any of the request data, make the following replacements:

  • PROJECT_ID: Your Google Cloud project ID.
  • LOCATION: The region where the model to delete is located, such as us-central1.
  • MODEL_ID: The ID of the model to delete.

HTTP method and URL:

DELETE https://translation.googleapis.com/v3/projects/PROJECT_ID/locations/LOCATION/models/MODEL_ID

To send your request, expand one of these options:

You should receive a JSON response similar to the following:

{
  "name": "projects/PROJECT_NUMBER/locations/LOCATION/operations/OPERATION_ID",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.translation.v3.DeleteModelMetadata"
  },
  "done": true
}

Additional languages

C#: Please follow the C# setup instructions on the client libraries page and then visit the Cloud Translation reference documentation for .NET.

PHP: Please follow the PHP setup instructions on the client libraries page and then visit the Cloud Translation reference documentation for PHP.

Ruby: Please follow the Ruby setup instructions on the client libraries page and then visit the Cloud Translation reference documentation for Ruby.