要使用 AutoML Translation,您必须先为自己的项目启用该服务。打开 AutoML Translation 界面,然后从标题栏右上角的下拉列表中选择您的项目。该应用将引导您完成必要的步骤(具体步骤也将在下文中为您介绍)。
设置项目
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
- Install the Google Cloud CLI.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
Create or select a Google Cloud project.
-
Create a Google Cloud project:
gcloud projects create PROJECT_ID
Replace
PROJECT_ID
with a name for the Google Cloud project you are creating. -
Select the Google Cloud project that you created:
gcloud config set project PROJECT_ID
Replace
PROJECT_ID
with your Google Cloud project name.
-
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the AutoML and Cloud Storage APIs:
gcloud services enable storage-component.googleapis.com
automl.googleapis.com storage-api.googleapis.com - Install the Google Cloud CLI.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
Create or select a Google Cloud project.
-
Create a Google Cloud project:
gcloud projects create PROJECT_ID
Replace
PROJECT_ID
with a name for the Google Cloud project you are creating. -
Select the Google Cloud project that you created:
gcloud config set project PROJECT_ID
Replace
PROJECT_ID
with your Google Cloud project name.
-
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the AutoML and Cloud Storage APIs:
gcloud services enable storage-component.googleapis.com
automl.googleapis.com storage-api.googleapis.com - 将
PROJECT_ID
环境变量设置为项目 ID。 AutoML API 调用和资源名称中包含您的项目 ID。export PROJECT_ID=PROJECT_ID
PROJECT_ID
环境变量提供了一种指定此 ID 的便捷方式。
创建 Cloud Storage 存储桶
创建一个 Google Cloud Storage 存储桶,以存储您将用于训练自定义模型的句对。存储桶名称必须采用以下格式:project-id-vcm
。以下命令将在 us-central1
地区中创建一个名为 project-id-vcm
的存储桶。
gcloud storage buckets create gs://project-id-vcm/ --project=project-id --location=us-central1我们建议您对 Cloud Storage 文件使用以下文件结构:
gs://project-id-vcm/dataset-name/documents/document-name.txt