Learn to Deploy Custom Models on Vertex AI - Build What's Next
How-to

Learn to Deploy Custom Models on Vertex AI

3030

Of your peers have already read this article.

2:00 Minutes

The most insightful time you'll spend today!

After its launch in May, Vertex AI along with its pre-trained models for building models on variety of infrastructure demonstrated many use-cases. Refresh your learning to start using Vertex AI and deploy custom models on the unified AI platform.

In May we announced Vertex AI, our new unified AI platform which provides options for everything from using pre-trained models to building your models with a variety of frameworks. In this post we’ll do a deep dive on training and deploying a custom model on Vertex AI. There are many different tools provided in Vertex AI, as you can see in the diagram below. In this scenario we’ll be using the products highlighted in green:

in green

AutoML is a great choice if you don’t want to write your model code yourself, but many organizations have scenarios that require building custom models with open-source ML frameworks like TensorFlow, XGBoost, or PyTorch. In this example, we’ll build a custom TensorFlow model (built upon this tutorial) that predicts the fuel efficiency of a vehicle, using the Auto MPG dataset from Kaggle.

If you’d prefer to dive right in, check out the codelab or watch the two minute video below for a quick overview of our demo scenario: https://www.youtube.com/embed/bHoAXR26hWo?enablejsapi=1&

Environment setup 

There are many options for setting up an environment to run these training and prediction steps. In the lab linked above, we use the IDE in Cloud Shell to build our model training application, and we pass our training code to Vertex AI as a Docker container. You can use whichever IDE you’re most comfortable working with, and if you’d prefer not to containerize your training code, you can create a Python package that runs on one of Vertex AI’s supported pre-built containers.

If you would like to use Pandas or another data science library to do exploratory data analysis, you can use the hosted Jupyter notebooks in Vertex AI as your IDE. For example, here we wanted to inspect the correlation between fuel efficiency and one of our data attributes, cylinders. We used Pandas to plot this relationship directly in our notebook.

Table chart

To get started, you’ll want to make sure you have a Google Cloud project with the relevant services enabled. You can enable all the products we’ll be using in one command using the gcloud SDK:

  gcloud services enable compute.googleapis.com         \
                       containerregistry.googleapis.com  \
                       aiplatform.googleapis.com

Then create a Cloud Storage bucket to store our saved model assets. With that, you’re ready to start developing your model training code.

Containerizing training code

Here we’ll develop our training code as a Docker container, and deploy that container to Google Container Registry (GCR). To do that, create a directory with a Dockerfile at the root, along with a trainer subdirectory containing a train.py file. This is where you’ll write the bulk of your training code:

training code

To train this model, we’ll build a deep neural network using the Keras Sequential Model API:

  model = keras.Sequential([
  layers.Dense(64, activation='relu', input_shape=[len(train_dataset.keys())]),
  layers.Dense(64, activation='relu'),
  layers.Dense(1)
])

We won’t include the full model training code here, but you can find it in this step of the codelab. Once your training code is complete, you can build and test your container locally. The IMAGE_URI in the snippet below corresponds to the location where you’ll deploy your container image in GCR. Replace $GOOGLE_CLOUD_PROJECT below with the name of your Cloud project:

  IMAGE_URI="gcr.io/$GOOGLE_CLOUD_PROJECT/mpg:v1"
docker build ./ -t $IMAGE_URI
docker run $IMAGE_URI

All that’s left to do is push your container to GCR by running docker push $IMAGE_URI. In the GCR section of your console, you should see your newly deployed container:

deployed container

Running the training job 

Now you’re ready to train your model. You can select the container you created above in the models section of the platform. You can also specify key details like the training method, compute preferences (GPUs, RAM, etc.) and hyperparameter tuning if required.

if required

Now you can hand over training your model and let Vertex do the heavy lifting for you.

Deploy to endpoint

Next, let’s get your new model incorporated into your app or service. Once your model is done training you will see an option to create a new endpoint. You can test out your endpoint in the console during your development process. Using the client libraries, you can easily create a reference to your endpoint and get a prediction with a single line of code:

  from google.cloud import aiplatform

endpoint = aiplatform.Endpoint(
         endpoint_name="projects/YOUR-PROJECT-NUMBER/locations/us-central1/endpoints/YOUR-ENDPOINT-ID"
)

. . .  

endpoint.predict(test_instances)

Start building today

Ready to start using Vertex AI? We have you covered for all your use cases spanning from simply using pre-trained models to every step of the lifecycle of a custom model. 

  • Use Jupyter notebooks for a development experience that combines text, code and data
  • Fewer lines of code required for custom modeling
  • Use MLOps to manage your data with confidence and scale

Get started today by trying out this codelab yourself or watching this one hour workshop

Case Study

Tyson Foods’ Story of Unlocking Opportunities by Integrating Real-time Analytics with AI and BI

6498

Of your peers have already read this article.

3:00 Minutes

The most insightful time you'll spend today!

Forward-thinking companies look beyond the here and now to solve and unlock opportunities to drive future business growth. Google Cloud-hosted, Ingestion platform based on analytics integrated with AI & BI helps Tyson Foods turn data into insights!

As data environments become more complex, companies are turning to streaming analytics solutions that analyze data as it’s ingested and deliver immediate, high-value insights into what is happening now. These insights enable decision makers to act in real time to take advantage of opportunities or respond to issues as they occur.

While understanding what is happening now has great business value, forward-thinking companies are taking things a step further, using real-time analytics integrated with artificial intelligence (AI) and business intelligence (BI) to answer the question, “what might happen in the future?” Arkansas-based Tyson Foods has embraced AI/BI analytics to enable predictive insights that unlock new opportunities and drive future growth.

Creating a digital twin for connected intelligence company wide

Before using AI/BI, Tyson’s analytics capabilities consisted of traditional BI solutions focused on KPIs and simplifying data so that humans could understand it. Tyson wanted to leverage its data to uncover ways to improve current processes and grow its business. But with BI alone, Tyson struggled to use data to run the simulations and scenarios essential to make educated decisions. To keep growing, it had to embrace the complexity of its data, building ways to analyze it and use it to inform decision making. 

Tyson’s on-premises analytics solutions limited its ability to be aggressive and make intelligent, timely, prescriptive decisions. The solution was to create a digital twin to scale optimizations within business processes, moving from local optimizations to system-wide connected optimizations. Doing so meant shifting entirely to cloud computing, with an initial focus on building the ingestion component of the digital twin platform.

Investing in a digital twin enabled Tyson to accelerate new capabilities like supply chain simulation “what-if” scenarios, prescriptive price elasticity recommendations, and improvement of customer intimacy. 

Solving the ingestion problem for faster time to insights

Before its migration to Google Cloud, analytics projects that Tyson suffered from uncertainty over how to obtain the data. This problem was prolific and caused project times to be extended for weeks or even months due to the need to write and support one-off data ingestion processes at the front end. This problem also prevented the IT team from delivering analytics solutions fast enough for the business to take full advantage of them. 

To solve this analytics problem, the team created Data Ingestion Compute Engine (DICE). DICE is a Google Cloud-hosted, open-source, cloud-native ingestion platform developed to provide configuration-based, no-ops, code-free ingestion from disparate enterprise data systems, both internal and external. It is centered on three high-level goals:

  1. Accelerate the speed of delivery of IT analytics solutions
  2. Enable growth of IT capabilities to produce meaningful insight
  3. Reduce long-term total cost of ownership for ingestion solutions

Creating DICE ingestion platform with Google Cloud services

Teams use DICE to set up secure data ingestion jobs in minutes without having to manage complex connections or write, deploy, and support their own code. DICE enables unbound scale, highly parallel processing, DevSecOps, open source, and the implementation of Lambda Data Architecture.

A DICE job is the logical unit of work in the DICE platform, consisting of immutable and mutable configurations persisted as JSON documents stored in Firestore. The job exists as an instruction set for the DICE data engine, which is Apache Beam running Dataflow to instruct which data to pull, how to pull it, how often to pull it, how to process it, when it changes, and where to direct it.

Two of DICE’s primary layers include the metadata engine and the data engine. The metadata engine is responsible for the creation and management of DICE job configuration and orchestration. It is made up of many microservices that interact with multiple Google Cloud services, including the job configuration creation API, job build configuration helper API, and job execution scheduler API.

The data engine is responsible for the physical ingestion of data, the change detection processing of that data, and the delivery of that data to specified targets. The data engine is Java code that uses the Apache Beam unified programming model and runs in Dataflow. It is comprised of streaming, jobs, and Dataflow flex template batch jobs. Logically, the data engine is segmented across three layers: the inbound processing layer, the DICE file system layer, and the target processing layer, which takes the data from the DICE file system and moves it to targets.

DICE @ Tyson Platform in Numbers

Rolling DICE for thousands of ingestion jobs each day

DICE was first deployed to a production environment in November 2019, and just two years later, it has more than 3,000 data ingestion jobs from more than a hundred disparate data systems, both internal and external to Tyson Foods. Most of these jobs run multiple times a day. On a daily basis the DICE environment sees more than 25,000 Dataflow jobs running and an average of 3.25 terabytes of new data being ingested.

DICE @ Tyson Platform in Numbers

DICE supports ingestion from many different types of technologies, including BigQuery, SQL Server, SAP HANA, Postgres, Oracle, MySQL, Db2, various types of file systems, and FTP servers. Additionally, DICE supports target platform technologies for ingestion jobs that include multiple JDBC targets, multiple file system targets, and BigQuery and queue-based store and forward technologies. 

The platform continues to see linear growth of DICE jobs, all while keeping platform costs relatively flat. With increasing demand for the platform, Tyson’s IT team is constantly enhancing DICE to support new sources and targets.

This intelligent platform keeps adding new value and makes it simple for Tyson to take advantage of its data. This innovation is a necessity in this fast-changing world of digital business in which companies must transform a high volume of complex data into actionable insight.

3160

Of your peers have already watched this video.

2:00 Minutes

The most insightful time you'll spend today!

Webinar

How Marketers Can Turn Information into Action with Machine Learning

The biggest challenge marketers face with machine learning is, “how to get starter”? Instead of getting overwhelmed, they should focus on the applied machine learning by using the algorithms that are already built.

Cassie Kozyrkov, the chief decision scientist with Google Cloud, says that marketers who are overwhelmed by everything they’re hearing about machine learning should focus on key ingredients, not building an entire kitchen.

4911

Of your peers have already watched this video.

5:00 Minutes

The most insightful time you'll spend today!

Case Study

Video: How AI is Helping Biologists Protect Wildlife

According to the World Wildlife Fund, vertebrate populations have shrunk an average of 60 percent since the 1970s. And a recent UN global assessment found that we’re at risk of losing one million species to extinction, many of which may become extinct within the next decade. 

To better protect wildlife, seven organizations, led by Conservation International, and Google have mapped more than 4.5 million animals in the wild using photos taken from motion-activated cameras known as camera traps. The photos are all part of Wildlife Insights, an AI-enabled, Google Cloud-based platform that streamlines conservation monitoring by speeding up camera trap photo analysis.

With photos and aggregated data available for the world to see, people can change the way protected areas are managed, empower local communities in conservation, and bring the best data closer to conservationists and decision-makers.

Camera traps help researchers assess the health of wildlife species, especially those that are reclusive and rare. Worldwide, biologists and land managers place motion-triggered cameras in forests and wilderness areas to monitor species, snapping millions of photos a year. 

But what do you do when you have millions of wildlife selfies to sort through? On top of that, how do you quickly process photos where animals are difficult to find, like when an animal is in the dark or hiding behind a bush? And how do you quickly sort through up to 80 percent of photos that have no wildlife at all because the camera trap was triggered by the elements, like grass blowing in the wind?

Watch this video to find out.

Blog

Unified, Flexible and Accessible: How Companies’ Data Help Them Achieve More on Google Cloud

4882

Of your peers have already read this article.

1:30 Minutes

The most insightful time you'll spend today!

Many tech companies have their journey of unlocking insights and analysis from unstructured data to make it accessible across organizational value-chain using relevant tech stack. This whitepaper breaks down exactly why clients prefer Google Cloud!

As the volume of data that people and businesses produce continues to grow exponentially, it goes without saying that data-driven approaches are critical for tech companies and startups across all industries. But our conversations with customers, as well as numerous industry commentaries, reiterate that managing data and extracting value from it remains difficult, especially with scale.

Numerous factors underpin the challenges, including access to and storage of data, inconsistent tools, new and evolving data sources and formats, compliance concerns, and security considerations. To help you identify and solve these challenges, we’ve created a new whitepaper, “The future of data will be unified, flexible, and accessible,” which explores many of the most common reasons our customers tell us they’re choosing Google Cloud to get the most out of their data.

For example, you might need to combine data in legacy systems with new technologies. Does this mean moving all your data to the cloud? Should it be in one cloud or distributed across several? How do you extract real value from all of this data without creating more silos?

You might also be limited to analyzing your data in batch instead of processing it in real-time, adding complexity to your architecture and necessitating expensive maintenance to combat latency. Or you might be struggling with unstructured data, with no scalable way to analyze and manage it. Again, the factors are numerous—but many of them accrue to inadequate access to data, often exacerbated by silos, and insufficient ability to process and understand it.

The modern tech stack should be a streaming stack that scales with your data, provides real-time analytics, incorporates and understands different types of data, and lets you use AI/ML to predictively derive insights and operationalize processes. These requirements mean that to effectively leverage your data assets:

  • Data should be unified across your entire company, even across suppliers, partners, and platforms., eliminating organizational and technology silos.
  • Unstructured data should be unlocked and leveraged in your analytics strategy.
  • The technology stack should be unified and flexible enough to support use cases ranging from analysis of offline data to real-time streaming and application of ML without maintaining multiple bespoke tech stacks.
  • The technology stack should be accessible on-demand, with support for different platforms, programming languages, tools, and open standards compatible with your employees’ existing skill sets.

With these requirements met, you’ll be equipped to maximize your data, whether that means discerning and adapting to changing customer expectations or understanding and optimizing how your data engineers and data scientists spend their time. In coming weeks, we’ll explore aspects of the whitepaper in additional blog posts—but if you’re ready to dive in now, and to steer your tech company or startup towards success by making your data better work for you, click here to download your copy, free of charge.

Case Study

Siemens: What Smarter New Age Recruiting Looks Like

3172

Of your peers have already read this article.

4:30 Minutes

The most insightful time you'll spend today!

With Cloud Talent Solution, Siemens has achieved a 30% increase in the conversion of searches to job applications on its career site; offers a more relevant experience to job seekers, reducing the load on its talent acquisition team; and supports the talent acquisition team and broader HR function's journey to becoming a provider of amazing technology-based solutions to employees and candidates.

Siemens aims to shape the future—and has the scale, culture, and know-how to realize its ambitions. The Germany-headquartered industrial manufacturing business operates in more than 120 countries and focuses on electrification, automation, and digitalization. Siemens’ extensive portfolio includes industrial production digitalization and automation technologies, diagnostic and therapeutic imaging for healthcare, and building automation and management technologies.

“All our solutions are united by the fact they impact the way people live their lives,” says Stephanie Morton, Siemens’ Global Talent Acquisition Manager: Strategy, Technology & Talent Relationship Management.

“‘Engineered for life’ is one of our brand claims.”

Hiring “future makers”

Hiring thinkers, dreamers, and doers hungry to transform businesses, industries, and lives is key to Siemens’ success. The business calls its people “future makers” and employs more than 370,000 of them worldwide.

Recruiting for a workforce this size is no easy task. Siemens’ global jobs and careers website has about 5,000 open positions at any one time, and the organization receives 2 million applications to fill 35,000 positions per year.

However, by 2017, the website was experiencing problems that hampered the talent acquisition team’s efforts to fill roles promptly with the right candidates. Its standard keyword matching technology could not optimize the results provided to job seekers, frustrating potential candidates and increasing the workload for recruiters.

“With Cloud Talent Solution, we saw a 30 percent uplift in candidate conversions from search to application.”

Stephanie Morton, Global Talent Acquisition Manager: Strategy, Technology & Talent Relationship Management, Siemens

“We found the language we used about our jobs internally was often not the same language job seekers used,” explains Morton. “For example, we may have an engineering position open for our MindSphere cloud-based IoT operating system. We would post this on our jobs and careers website as ‘MindSphere engineer.’ Unfortunately, a job seeker using more general terms such as ‘IoT engineer’ may miss this advertisement.”

In addition, without intelligence and context, the keyword matching technology could not determine job seeker search intentions from misspelled terms. This became more of a problem as job seekers increasingly used mobile devices to conduct searches.

With keyword searches also generating pages and pages of results, job seekers often succumbed to the temptation to apply for every position returned. This left the talent acquisition team drowning in messages and applications.

“We experienced issues around seniority as well—for example, people looking for senior legal roles were receiving irrelevant results for internships or junior roles,” says Morton.

Change needed

These problems could not persist for a team charged with continuously improving candidate experiences. The team opened discussions with Jibe, a recruitment platform provider that operated Siemens’ external career websites. Jibe had collaborated with Google to integrate Cloud Talent Solution—a solution that uses machine learning to better understand job content and job seeker intent—into its platform.” Jibe offered the integrated solution to Siemens as one of its most forward-thinking customers,” says Morton.

Morton’s team reviewed Cloud Talent Solution and was immediately excited by its potential to quickly make a profound difference in its recruitment activities—without requiring recruiters and other team members to invest considerable time and effort. Cloud Talent Solution could enable the website to understand the broad intent of a job seeker—including synonymous positions—and deliver considerably more relevant results.

“We can authoritatively say Cloud Talent Solution is improving the experience for job seekers; they are conducting more searches, those searches are more effective, and more of them are converting to job applications.”

Stephanie Morton, Global Talent Acquisition Manager: Strategy, Technology & Talent Relationship Management, Siemens

After Cloud Talent Solution expanded to encompass more than 100 languages—enabling Siemens to offer a consistent experience to candidates from a range of countries and backgrounds—Morton’s team gave Jibe and Google the green light to proceed.

“We had two key issues to address during the implementation,” says Morton. “The first was to make sure Google Cloud was aware of any Siemens-specific recruitment terms. For example, we have German-language posts that include terms commonly used internally regarding internships and junior positions. We worked closely with our partners to make sure these terms were represented in the algorithm to complement the vast constellation of already-mapped job titles in Cloud Talent Solution.”

Siemens also needed to quantify Cloud Talent Solution benefits to sell the service internally within the business and win support to proceed beyond a pilot. “Because Cloud Talent Solution was effectively an invisible layer behind our website, we had to test its impact,” says Morton.

A 30 percent uplift

Working with Jibe, Siemens conducted A/B testing. Five percent of candidates in the test group used the keyword-based search experience and 95 percent of candidates the search experience powered by Cloud Talent Solution. The testing accommodated changes in candidate queries over time and context.

“With Cloud Talent Solution, we saw a 30 percent uplift in conversions from search to application,” says Morton.

“We can authoritatively say Cloud Talent Solution is improving the experience for job seekers; they are conducting more searches, those searches are more effective, and more of them are converting to job applications,” she adds. “Anecdotally, recruiters are seeing fewer applications from job seekers who have applied to long lists of positions returned from search queries.”

“Partnering with market-leading providers like Google Cloud can help us stay one step ahead of the competition over the journey.”

Stephanie Morton, Global Talent Acquisition Manager: Strategy, Technology & Talent Relationship Management, Siemens

In the longer term, Siemens plans to monitor the impact of Cloud Talent Solution on metrics such as candidate retention rates and manager satisfaction.

With Cloud Talent Solution well established within the business, Siemens is now working with Google Cloud to add new features—including voice assistants—to enhance the candidate experience. “Helping candidates laser in on the right positions and make successful connections is something we’re doing everything we can to make happen,” says Morton.

More broadly, Cloud Talent Solution and Jibe are helping Siemens’ talent acquisition and the rest of its human resources function build its reputation and execute its strategy. “We are becoming a function driven by delivering amazing technology-based solutions to our employees and our candidates,” says Morton. “People within Siemens are very impressed to see human resources leading the way in working with Google Cloud to deliver a solution like this at a global scale.”

“The more light-touch exercises like this we can do, the fewer big, expensive, time-consuming initiatives we need to take,” she says. “Furthermore, partnering with market-leading providers like Google Cloud can help us stay one step ahead of the competition over the journey.”

More Relevant Stories for Your Company

Blog

Unlocking the Power of Computer Vision: Vision AI Made Easy with Spring Boot and Java

In today's era of data-driven applications, leveraging advanced machine learning and artificial intelligence services like computer vision has become increasingly important. One such service is the Vision API, which provides powerful image analysis capabilities. In this blog, we will explore how to create a Computer Vision application using Spring Boot and

Whitepaper

Everything You Need to Know About Google Cloud ML Engine 101

Machine learning is all around us today. But data scientists and IT teams tasked with creating models have a hard time bringing together the right mix of ingredients—from data, infrastructure, tools, and APIs—to do their jobs effectively. Google’s Cloud ML Engine eases many of the challenges data scientists and IT

Explainer

Driving Business Transformation in Manufacturing, Industrial, and Transportation Using Google Cloud and AI/ML

Google Cloud partners closely with manufacturing, industrial, and transportation organizations to drive business transformation. In this video, Mandeep Waraich, Head of Product - Industrial AI, Google Cloud, shares customer stories as well as Google Cloud’s differentiated AI products and solutions. Waraich covers the current state of automation and industrial efficiency

Blog

Satellites Can Help Map Carbon Emissions By Looking at Images of Power Plants!

Did you know that Satellites can now help track power plants and determine if they are on or off? And did also know that compute processing that classifies over 59 trillion bytes of data from over 11,000 sensors from 300 satellites is done on on Google Cloud? Google Cloud's sustainability

SHOW MORE STORIES