You create a custom model by training it using a prepared dataset. AutoML Translation uses the items from the dataset to train the model, test it, and evaluate its performance. You review the results, adjust the training dataset as needed and train a new model using the improved dataset.
Training a model can take several hours to complete. The AutoML API enables you to check the status of training.
Since AutoML Translation creates a new model each time you start training, your project may include numerous models. You can get a list of the models in your project and can delete models that you no longer need.
Training models
When you have a dataset with a solid set of training sentence pairs, you are ready to create and train the custom model.
Web UI
Open the AutoML Translation UI.
The Datasets page shows the available datasets for the current project.
Select the dataset you want to use to train the custom model.
The display name of the selected dataset appears in the title bar, and the page lists the individual items in the dataset along with their respective "Training," "Validation," or "Testing" labels.
When you are done reviewing the dataset, click the Train tab just below the title bar.
Click Start Training.
A Train new model dialog box appears.
Specify a name for the model.
Click Start Training to begin training your custom model.
Training a model can take several hours to complete. After the model is successfully trained, you will receive a message at the email address you used to sign up for the program.
REST
Before using any of the request data, make the following replacements:
- project-id: your Google Cloud Platform project ID
- model-name: the name of your new model
- dataset-id: the ID of your dataset. The ID is the
last element of the name of your dataset. For example, if the name
of your dataset is
projects/434039606874/locations/us-central1/datasets/3104518874390609379
, then the ID of your dataset is3104518874390609379
.
HTTP method and URL:
POST https://automl.googleapis.com/v1/projects/project-id/locations/us-central1/models
Request JSON body:
{ "displayName": "model-name", "dataset_id": "dataset-id", "translationModelMetadata": { "base_model" : "" } }
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/operations/operation-id", "metadata": { "@type": "type.googleapis.com/google.cloud.automl.v1.OperationMetadata", "createTime": "2019-10-02T18:40:04.010343Z", "updateTime": "2019-10-02T18:40:04.010343Z", "createModelDetails": {} } }
Go
To learn how to install and use the client library for AutoML Translation, see AutoML Translation client libraries. For more information, see the AutoML Translation Go API reference documentation.
To authenticate to AutoML Translation, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java
To learn how to install and use the client library for AutoML Translation, see AutoML Translation client libraries. For more information, see the AutoML Translation Java API reference documentation.
To authenticate to AutoML Translation, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Node.js
To learn how to install and use the client library for AutoML Translation, see AutoML Translation client libraries. For more information, see the AutoML Translation Node.js API reference documentation.
To authenticate to AutoML Translation, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python
To learn how to install and use the client library for AutoML Translation, see AutoML Translation client libraries. For more information, see the AutoML Translation Python API reference documentation.
To authenticate to AutoML Translation, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Additional languages
C#: Please follow the C# setup instructions on the client libraries page and then visit the AutoML Translation reference documentation for .NET.
PHP: Please follow the PHP setup instructions on the client libraries page and then visit the AutoML Translation reference documentation for PHP.
Ruby: Please follow the Ruby setup instructions on the client libraries page and then visit the AutoML Translation reference documentation for Ruby.
Getting the status of an operation
You can check the status of a long-running task (importing items into a dataset or training a model) using the operation ID from the response when you started the task.
You can only check the status of operations using the AutoML API.
To get the status of your training operation, you must send a GET
request to
the operations
resource. The following shows how to send such a
request.
Before using any of the request data, make the following replacements:
- operation-name: the name of the operation as returned in the response to the original call to the API
- project-id: your Google Cloud Platform project ID
HTTP method and URL:
GET https://automl.googleapis.com/v1/operation-name
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{ "metadata": { "@type": "type.googleapis.com/google.cloud.automl.v1.OperationMetadata", "createTime": "2019-10-01T22:13:48.155710Z", "updateTime": "2019-10-01T22:13:52.321072Z", ... }, "done": true, "response": { "@type": "resource-type", "name": "resource-name" } }
Canceling an Operation
You can cancel an import or training task using the operation ID.
Before using any of the request data, make the following replacements:
- operation-name: the full
name of your operation. The full name has the format
projects/project-id/locations/us-central1/operations/operation-id
. - project-id: your Google Cloud Platform project ID
HTTP method and URL:
POST https://automl.googleapis.com/v1/operation-name:cancel
To send your request, expand one of these options:
You should receive a successful status code (2xx) and an empty response.
Managing models
Getting information about a model
When training is complete, you can get information about the newly created model.
The examples in this section return the basic metadata about a model. To get details about a model's accuracy and readiness, see Evaluating models.
REST
Before using any of the request data, make the following replacements:
- model-name: the full name of your model. The full
name of your model includes your project name and location. A
model name looks similar to the following example:
projects/project-id/locations/us-central1/models/model-id
. - project-id: your Google Cloud Platform project ID
HTTP method and URL:
GET https://automl.googleapis.com/v1/model-name
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", "datasetId": "dataset-id", "createTime": "2019-10-01T21:51:44.115634Z", "deploymentState": "DEPLOYED", "updateTime": "2019-10-02T00:22:36.330849Z", "translationModelMetadata": { "sourceLanguageCode": "source-language", "targetLanguageCode": "target-language" } }
Go
To learn how to install and use the client library for AutoML Translation, see AutoML Translation client libraries. For more information, see the AutoML Translation Go API reference documentation.
To authenticate to AutoML Translation, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java
To learn how to install and use the client library for AutoML Translation, see AutoML Translation client libraries. For more information, see the AutoML Translation Java API reference documentation.
To authenticate to AutoML Translation, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Node.js
To learn how to install and use the client library for AutoML Translation, see AutoML Translation client libraries. For more information, see the AutoML Translation Node.js API reference documentation.
To authenticate to AutoML Translation, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python
To learn how to install and use the client library for AutoML Translation, see AutoML Translation client libraries. For more information, see the AutoML Translation Python API reference documentation.
To authenticate to AutoML Translation, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Additional languages
C#: Please follow the C# setup instructions on the client libraries page and then visit the AutoML Translation reference documentation for .NET.
PHP: Please follow the PHP setup instructions on the client libraries page and then visit the AutoML Translation reference documentation for PHP.
Ruby: Please follow the Ruby setup instructions on the client libraries page and then visit the AutoML Translation reference documentation for Ruby.
Listing models
A project can include numerous models. This section describes how to retrieve a list of the available models for a project.
Web UI
To see a list of the available models using the AutoML Translation UI click the lightbulb icon in the left navigation bar.
To see the models for a different project, select the project from the drop-down list in the upper right of the title bar.
REST
Before using any of the request data, make the following replacements:
- project-id: your Google Cloud Platform project ID
HTTP method and URL:
GET https://automl.googleapis.com/v1/projects/project-id/locations/us-central1/models
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{ "model": [ { "name": "projects/project-number/locations/us-central1/models/model-id", "displayName": "model-display-name", "datasetId": "dataset-id", "createTime": "2019-10-01T21:51:44.115634Z", "deploymentState": "DEPLOYED", "updateTime": "2019-10-02T00:22:36.330849Z", "translationModelMetadata": { "sourceLanguageCode": "source-language", "targetLanguageCode": "target-language" } } ] }
Go
To learn how to install and use the client library for AutoML Translation, see AutoML Translation client libraries. For more information, see the AutoML Translation Go API reference documentation.
To authenticate to AutoML Translation, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java
To learn how to install and use the client library for AutoML Translation, see AutoML Translation client libraries. For more information, see the AutoML Translation Java API reference documentation.
To authenticate to AutoML Translation, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Node.js
To learn how to install and use the client library for AutoML Translation, see AutoML Translation client libraries. For more information, see the AutoML Translation Node.js API reference documentation.
To authenticate to AutoML Translation, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python
To learn how to install and use the client library for AutoML Translation, see AutoML Translation client libraries. For more information, see the AutoML Translation Python API reference documentation.
To authenticate to AutoML Translation, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Additional languages
C#: Please follow the C# setup instructions on the client libraries page and then visit the AutoML Translation reference documentation for .NET.
PHP: Please follow the PHP setup instructions on the client libraries page and then visit the AutoML Translation reference documentation for PHP.
Ruby: Please follow the Ruby setup instructions on the client libraries page and then visit the AutoML Translation reference documentation for Ruby.
Deleting a model
The following example deletes a model.
Web UI
In the AutoML Translation UI, click the light bulb icon in the left navigation menu to display the list of available models.
Click the three-dot menu at the far right of the row you want to delete and select Delete model.
Click Delete in the confirmation dialog box.
REST
Before using any of the request data, make the following replacements:
- model-name: the full name of your model. The full
name of your model includes your project name and location. A
model name looks similar to the following example:
projects/project-id/locations/us-central1/models/model-id
. - project-id: your Google Cloud Platform project ID
HTTP method and URL:
DELETE https://automl.googleapis.com/v1/model-name
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/operations/operation-id", "metadata": { "@type": "type.googleapis.com/google.cloud.automl.v1beta1.OperationMetadata", "progressPercentage": 100, "createTime": "2018-04-27T02:33:02.479200Z", "updateTime": "2018-04-27T02:35:17.309060Z" }, "done": true, "response": { "@type": "type.googleapis.com/google.protobuf.Empty" } }
Go
To learn how to install and use the client library for AutoML Translation, see AutoML Translation client libraries. For more information, see the AutoML Translation Go API reference documentation.
To authenticate to AutoML Translation, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java
To learn how to install and use the client library for AutoML Translation, see AutoML Translation client libraries. For more information, see the AutoML Translation Java API reference documentation.
To authenticate to AutoML Translation, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Node.js
To learn how to install and use the client library for AutoML Translation, see AutoML Translation client libraries. For more information, see the AutoML Translation Node.js API reference documentation.
To authenticate to AutoML Translation, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python
To learn how to install and use the client library for AutoML Translation, see AutoML Translation client libraries. For more information, see the AutoML Translation Python API reference documentation.
To authenticate to AutoML Translation, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Additional languages
C#: Please follow the C# setup instructions on the client libraries page and then visit the AutoML Translation reference documentation for .NET.
PHP: Please follow the PHP setup instructions on the client libraries page and then visit the AutoML Translation reference documentation for PHP.
Ruby: Please follow the Ruby setup instructions on the client libraries page and then visit the AutoML Translation reference documentation for Ruby.