Skip to main content

Enabling Google Cloud Translation

Hands-On Lab

 

Photo of Joseph Lowery

Joseph Lowery

Google Cloud Training Architect II in Content

Length

03:00:00

Difficulty

Beginner

Generic translation services often provide a close but not ideal output when working with more targeted phrases, like those found in technological industries. Google Cloud AutoML Translation makes it possible to train a machine learning model with custom phrases and sentences that better suit a given situation. In this hands-on lab, you'll import a tab-separated value file with 1,500 English and French sentence pairs into an AutoML Translation dataset and then train the machine learning model on that dataset. Once the training is completed, you'll test the model for accuracy.

Please note: this lab does take longer than average to run, given the nature of machine learning.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Enabling Google Cloud Translation

Introduction

Generic translation services often provide a close but not ideal output when working with more targeted phrases, like those found in technological industries. Google Cloud AutoML Translation makes it possible to train a machine learning model with custom phrases and sentences that better suit a given situation. In this hands-on lab, you'll import a tab-separated value file with 1,500 English and French sentence pairs into an AutoML Translation dataset and then train the machine learning model on that dataset. Once the training is completed, you'll test the model for accuracy.

Note: Training the ML model in this lab can take two hours or more.

How to Log in to Google Lab Accounts

On the lab page, right-click Open GCP Console and select the option to open it in a new private browser window (this option will read differently depending on your browser — e.g., in Chrome, it says "Open Link in Incognito Window"). Then, sign in to Google Cloud Platform using the credentials provided on the lab page.

On the Welcome to your new account screen, review the text, and click Accept. In the "Welcome L.A.!" pop-up once you're signed in, check to agree to the terms of service, choose your country of residence, and click Agree and Continue.

Enable the Necessary APIs

  1. From the Google Cloud console's main navigation, choose APIs & Services > Library.
  2. Search for "translation", and select Cloud Translation API.
  3. Click Enable.
  4. Return to the API Library.
  5. Search for "automl", and select Cloud AutoML API.
  6. Click Enable.

Retrieve Data Files

  1. Activate the Cloud Shell.

  2. Click Continue in the initial message that pops up.

  3. Retrieve the working files:

    git clone https://github.com/linuxacademy/content-gc-ai-services-deepdive
  4. Change to the working directory:

    cd content-gc-ai-services-deepdive/ai-translations
  5. Download the testing files:

    cloudshell download en-fr.tsv
  6. Click Download when requested.

  7. If given the option, select the folder on your system where you want to save the file.

Create AutoML Translation Dataset

  1. From the main Google Cloud navigation, choose Translations > Datasets.
  2. On the Datasets page, choose New Dataset.
  3. Leave the default name for your dataset.
  4. Set Translate From to English (EN)
  5. Set Translate To to French (FR).
  6. Click Create.

Import Data

  1. In the Import section, choose the Upload files from your computer option.
  2. Click Select Files, and select the previously downloaded en-fr.tsv file.
  3. From the Destination on Cloud Storage field, click Browse.
  4. In the Select File panel, click the +/Create New Bucket icon.
  5. In the Create a bucket panel, set the following values:
    • Name your bucket: ai-services-dd- with a series of random numbers at the end
      • Click Continue.
    • Choose where to store your data:
      • Location type: Region
      • Location: us-central1 (Iowa)
      • Click Continue.
    • Choose a default storage class for your data: Standard
      • Click Continue.
    • Choose how to control access to objects Fine-grained
      • Click Continue.
    • Advanced Settings: Leave as-is.
  6. Click Create.
  7. After the bucket is created, click Select.
  8. Click Continue.
  9. Review the imported data. This should just take about a minute.

Train and Deploy the Model

  1. After all text has been imported, switch to the Train tab.
  2. Click Start Training.
  3. In the Train new model panel, make sure the Base model option is set to Google NMT.
  4. Click Start Training.

Note: This training will take approximately 2 hours.

Conclusion

Congratulations on successfully completing this hands-on lab!