Run Hugging Face transformers on GPU enabled Cloud Run functions
Key Takeaways
Deploys Hugging Face transformers on GPU enabled Cloud Run functions
Full Transcript
we create a GPU enabled Cloud run function that will directly host a Jamma 2 2B model downloaded from the huging face website I'll also show you how easy it is to leverage huging face Transformers python library to rapidly build AI powered applications with Cloud run let's get started first first I'll create a cloud run function via the UI let's go ahead give the service a name and we're going to choose python as our runtime let's go ahead make the public uh endpoint public for the demo purpose and choose the CPU always allocated under the containers tab I'm going to go ahead configure the memory and CPU required for this container instance and we attach an Nvidia L4 to this to this let's go ahead and set concurrency to be one all right next let's go to take a look at the Vari variables tab here I'm setting up two environment variables the first one uh it will be a LD Li Library pass that's going to point to the pass to for me to access to the Cuda drivers next environment variable I'm using the secret manager to store my huging phas token which is needed later on for me to download the models from the huggingface website let's go ahead and create this Cloud run function now it's going to take a few second all right so the cloud run function service is created let's Jump Jump Right In to edit our code first let's put in some of the requirements needed for this app and then for the main logic of this application instead of writing any new codes let's go ahead go to the huging face website here we're going to copy the code over into our functions event handler all right so let's copy the code here let's go ahead fix the indentation and then we'll move the inputs to the top of the file let's update the device wise map to Cuda so here I uh we are leveraging the Transformers python library to interact with the Jamma model and then I'm asking JMA to help me write a poem about machine learning and also know the maximum output token here is set to 32 so expect the poem from the Jamma model be truncated all right so so far most of the code is based on the existing samples except we made a few tricks here and there and we didn't even need to write any new code everything looks good let's go ahead and save and deploy This Cloud run function in the interest of time uh let's go ahead and switch to this pre-deployed pre-build Cloud run function here you can see the source code is identical to the one we just deployed now let's go ahead actually invoke this Endo since this is a warm instance the Jamma model responds quite quickly as expected poem is truncated because of the token setting in the sample code all right so we've done it we have successfully demonstrated the Jamma model running on a GPU enabled Cloud run function
Original Description
See how to create a GPU enabled Cloud Run function that directly hosts a Gemma 2 2B model. Learn how easy it is to leverage the Hugging Face Transformer Improvement library to rapidly build AI powered applications with Cloud Run.
Watch more Cloud Run Demo Series → https://goo.gle/CloudRunDemos
Subscribe to Google Cloud Tech → https://goo.gle/GoogleCloudTech
#CloudRun #GoogleCloud #GPU #AI #HuggingFace
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Google Cloud Tech · Google Cloud Tech · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
I’m going for it #GoogleCloudCertified
Google Cloud Tech
I had to get #GoogleCloudCertified
Google Cloud Tech
Be better overall at what you do #GoogleCloudCertified
Google Cloud Tech
Cloud Monitoring on our radar #Analysis #Uptime
Google Cloud Tech
Introduction to Generative AI Studio
Google Cloud Tech
How to use Github Actions with Google's Workload Identity Federation
Google Cloud Tech
Introduction to Responsible AI
Google Cloud Tech
Networking updates and CDMC-certified architecture
Google Cloud Tech
Create and use a Cloud Storage bucket
Google Cloud Tech
How to digitize text from documents
Google Cloud Tech
Faster analytical queries with AlloyDB
Google Cloud Tech
Next ‘23 sessions and FaaS Wave
Google Cloud Tech
Introduction to Assured Open Source Software
Google Cloud Tech
BigQuery Cost Optimization: Storage
Google Cloud Tech
BigQuery Cost Optimization: Compute
Google Cloud Tech
BigQuery Cost Optimization: Select Queries
Google Cloud Tech
Remote Field Equipment Management with Manufacturing Data Engine
Google Cloud Tech
Supercharging your applications with Cloud SQL Enterprise Plus
Google Cloud Tech
Vector Support on our radar #GenAI
Google Cloud Tech
Architecting a blockchain startup with Google Cloud
Google Cloud Tech
Kubernetes and multitasking updates!
Google Cloud Tech
GKE: Using Kubernetes Events
Google Cloud Tech
How to configure firewall rules for Cloud Composer
Google Cloud Tech
Vertex AI Embeddings API + Matching Engine: Grounding LLMs made easy
Google Cloud Tech
Geospatial analytics on our radar #EarthEngine #BigQuery
Google Cloud Tech
Ensuring requests are set in Kubernetes
Google Cloud Tech
Cloud Next 2023, Google research program, and more!
Google Cloud Tech
How to migrate projects between organizations with Resource Manager
Google Cloud Tech
How to run #MySQL in Google Cloud
Google Cloud Tech
#GenerativeAI for enterprises and #Next2023
Google Cloud Tech
How Google Photos scales to store 4 trillion photos and videos
Google Cloud Tech
Google Cross-Cloud Interconnect (Demo 2)
Google Cloud Tech
GKE Cost Optimization Golden Signals: Introduction
Google Cloud Tech
GKE Cost Optimization Golden Signals: Workload Rightsizing
Google Cloud Tech
GKE Load Balancing: Overview
Google Cloud Tech
GKE Load Balancing: Best Practices
Google Cloud Tech
Disaster Recovery in GKE
Google Cloud Tech
How to configure IP masquerade agent in GKE Standard clusters
Google Cloud Tech
Enable and use GKE Control plane logs
Google Cloud Tech
Compliance in Australia with Assured Workloads
Google Cloud Tech
Creating budgets and budget alerts in Google Cloud #FinOps
Google Cloud Tech
Cloud SQL Enterprise Plus on our radar #mySQL
Google Cloud Tech
What's Next for Google Cloud?
Google Cloud Tech
How Loveholidays scaled with Contact Center AI
Google Cloud Tech
What is fleet team management in GKE?
Google Cloud Tech
Troubleshoot VPC Network Peering
Google Cloud Tech
Introduction to DocAI and Contact Center AI
Google Cloud Tech
Cloud Run Direct VPC egress explained
Google Cloud Tech
Database deployment options in GKE
Google Cloud Tech
Analyze cloud billing data with #BigQuery
Google Cloud Tech
Tips to becoming a world-class Prompt Engineer
Google Cloud Tech
Serverless is simple. Do I need CI/CD?
Google Cloud Tech
Accelerating model deployment with MLOps
Google Cloud Tech
How Hawaii's Department of Human Services scaled with CCAI
Google Cloud Tech
Pricing API on our #Radar
Google Cloud Tech
How Recommendations AI for Media can boost customer retention
Google Cloud Tech
Troubleshooting: Node Not Ready Status
Google Cloud Tech
One weekend until Cloud Next 2023!
Google Cloud Tech
#GoogleCloudNext starts tomorrow!
Google Cloud Tech
#GoogleCloudNext will be demand!
Google Cloud Tech
More on: LLM Engineering
View skill →Related Reads
📰
📰
📰
📰
Open-Weight LLM API Integration: A Developer Guide to Building with Transparent AI
Dev.to AI
Stop Writing Boilerplate: How I Automated My Entire Workflow with LLM APIs
Dev.to AI
The real AI race may no longer be at the frontier
TechCrunch AI
Building a Document-RAG Agent on GCP's Agent Development Kit (ADK)
Dev.to · Dale Nguyen
🎓
Tutor Explanation
DeepCamp AI