惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Vercel News
Vercel News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Apple Machine Learning Research
Apple Machine Learning Research
T
Tailwind CSS Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
人人都是产品经理
人人都是产品经理
V
V2EX
量子位
Last Week in AI
Last Week in AI
Jina AI
Jina AI
博客园 - 【当耐特】
爱范儿
爱范儿
宝玉的分享
宝玉的分享
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Hugging Face - Blog
Hugging Face - Blog
博客园 - 三生石上(FineUI控件)
有赞技术团队
有赞技术团队
小众软件
小众软件
IT之家
IT之家
博客园_首页
博客园 - 聂微东
S
SegmentFault 最新的问题
阮一峰的网络日志
阮一峰的网络日志
博客园 - 叶小钗

Runpod Blog.

New Runpod datacenter now live: AP-IN-1 Track GPU spend across your team with Cost Centers The GPU supply supercycle is here. Here’s what AI builders need to know. Community Spotlight: One-click AI image and video generation on Runpod with SwarmUI | Runpod Blog Community Spotlight: LoRA Pilot Data Prep to Inference Introducing the Runpod Assistant: Manage Your Cloud GPU Resources with Natural Language OpenAI's Parameter Golf: Train the Best Language Model That Fits in 16MB on Runpod LLM inference optimization: techniques that actually reduce latency and cost Pruna P-Video and Vidu Q3 public endpoints now available on Runpod Runpod brand spelling guide Quickstart - Runpod Documentation The AI market looks nothing like the narrative Training StyleGAN3 with Vision-Aided GAN on Runpod KoboldAI – The Other Roleplay Front End, And Why You May Want to Use It How to Connect Cursor to LLM Pods on Runpod for Seamless AI Dev Community Spotlight: How AnonAI Scaled Its Private Chatbot Platform with Runpod Prompt Scheduling with Disco Diffusion on Runpod Runpod's Latest Innovation: Dockerless CLI for Streamlined AI Development Run Your Own AI from Your iPhone Using Runpod Introducing Flash: Run GPU workloads on Runpod Serverless: No Docker required Use Claude Code with your own model on Runpod: No Anthropic account required Avoid Errors by Selecting the Proper Resources for Your Pod What hackers built on Runpod at TreeHacks 2026 Easily Back Up and Restore Your Pod with Cloud Sync + Backblaze B2 The Complete Guide to GPU Requirements for LLM Fine-Tuning AI Guides, Tutorials & GPU Infrastructure Insights | Runpod Your first Claude Code project within Runpod: a complete setup guide 10 billion Serverless requests and counting Building for resilience: Runpod’s response to the AWS us-east-1 outage How to Connect Google Colab to Runpod
Deploy Google Gemma 7B with vLLM on Runpod Serverless
Shaamil Karim · 2024-08-22 · via Runpod Blog.

In this blog, you'll learn:

  • About Runpod's latest vLLM worker for the newest models
  • Why vLLM is an excellent choice for running Google’s Gemma 7B
  • A step-by-step guide to get Google Gemma 7B up and running on Runpod Serverless with the quick deploy vLLM worker.

Introduction to Google Gemma 7B and vLLM

Google’s Gemma 7B is the latest iteration of Google’s powerful open-source language models. It offers a robust balance between performance and efficiency, making it ideal for various use cases. While smaller than some of its larger counterparts, the Gemma 7B model provides strong capabilities without overburdening computational resources. This model performs well in benchmark tests, making it a solid choice for many applications.

Gemma 7B benchmarks

Gemma 7b benchmarks

Why Use vLLM for Gemma 7B?

To run our Google Gemma 7B model, we'll utilize vLLM, an advanced inference engine designed to enhance the performance of large language models. Here’s why vLLM is an excellent choice:

  • Unmatched Speed: vLLM significantly outperforms other frameworks, offering 24 times the throughput of Hugging Face Transformers and 3.5 times that of Hugging Face’s Text Generation Inference (TGI).
  • Extensive Model Support: vLLM supports a broad range of language models and continues to expand. It is GPU-agnostic, allowing it to run on both NVIDIA and AMD hardware seamlessly, making it adaptable to diverse computational environments.
  • Strong Community Support: With over 350 active contributors, vLLM benefits from a dynamic ecosystem. This community ensures rapid improvements in performance, compatibility, and overall user experience. New breakthrough models are typically integrated shortly after their release.
  • User-Friendly Setup: With Runpod's quick deploy option, vLLM setup is incredibly easy.

The key to vLLM’s impressive performance lies in its memory management algorithm called PagedAttention. This technique optimizes how the model’s attention mechanism interacts with system memory, leading to significant speed improvements. For more details on PagedAttention, you can check out our dedicated blog on vLLM.

How to Deploy Gemma 7B with vLLM on Runpod Serverless

Follow this step-by-step guide with screenshots to run inference on Google Gemma 7B with vLLM in just a few minutes. This guide can also be applied to any large open-source language model—just swap in the model name and Hugging Face link in the code.

Pre-requisites:

  1. Create a Runpod account. You'll need to load funds into your account to get started.

Create Runpod account

  1. Choose your Hugging Face model and have your Hugging Face API access token ready.

Quick Deploy Gemma 7B with vLLM and Test with Runpod Web UI

  1. Navigate to the Serverless tab in your Runpod console and click Start on the Serverless vLLM card under Quick Deploy. This automatically installs vLLM and sets it up as an endpoint.

Runpod console Serverless page with Quick Deploy cards and the Serverless vLLM Start button circled

  1. Input your Hugging Face model and access token. You can obtain the access token from your Hugging Face account.

HF model input in Deploy Google Gemma 7B with vLLM on Runpod Serverless

  1. Customize your vLLM model settings if necessary (not typically required unless you're using specific versions like GPTQ with quantization). For most users, the default settings will work fine.

vLLM endpoint setup step 2 with collapsed LLM, tokenizer, GPU, streaming, OpenAI, and serverless settings

  1. Select the GPU type you want to use. We recommend the 48GB GPU for the 7B model to account for model storage and system needs. You likely won’t need multiple GPUs unless you're running much larger models.

48 GB GPU select in Deploy Google Gemma 7B with vLLM on Runpod Serverless

  1. Hit Deploy.

Once your model is deployed, navigate to the "Requests" tab to test that it's working. Input a prompt and click Run to see your outputs below.

Runpod vLLM endpoint detail page with worker status, API endpoint URLs, and the Requests tab circled

Endpoint Requests tab with a sample JSON prompt asking the capital of Bahrain and the Run button circled

Connect to Your Serverless Endpoint and Test Externally

We'll use Google Colab to test our Gemma 7B model by connecting to the serverless endpoint. Colab offers a free, cloud-based Jupyter notebook environment, making it easy to send requests and manage deployments without setting up local resources.

vLLM is compatible with OpenAI’s API, so we'll interact with it similarly to OpenAI’s models. You can also use other development environments like Visual Studio Code (VSCode) or any IDE that can make HTTP requests.

  1. Go to Colab and create a new notebook.

Empty Google Colab notebook with a blank code cell prompting to start coding

  1. Grab your API key from your Runpod console by navigating to Settings > API Keys. Generate and copy the key, then paste it into the code.

API KEYS IN CONSOLE in Deploy Google Gemma 7B with vLLM on Runpod Serverless

API key Runpod in Deploy Google Gemma 7B with vLLM on Runpod Serverless

  1. Get your base URL from the logs below your serverless endpoint page and paste it into the code.

OpenAI base URL in Deploy Google Gemma 7B with vLLM on Runpod Serverless

Paste the following code into the notebook and insert your API key and base URL:

Install the necessary OpenAI libraries to interact with your model using the following pip command:

Now, you can run the notebook and interact with the model. The first response might take a few minutes while the model is loaded, but subsequent requests will be faster.

Python chat script using the OpenAI client with a Runpod vLLM endpoint running Llama 3.1 8B, with sample output

Troubleshooting

  • If you see a 500 error, try increasing the VRAM size of your GPU.
  • For gated models (e.g., Gemma), ensure you have access and enter the appropriate access token when creating your endpoint.
  • If the status remains "in queue" for over 10 minutes, verify that the model is properly downloaded and loaded.

Conclusion

In this blog, we’ve explored the capabilities of Google’s Gemma 7B model and how to deploy it using vLLM on Runpod’s serverless infrastructure. The combination of the powerful Gemma 7B model and vLLM’s efficient performance makes this setup ideal for a wide range of applications, offering both speed and cost-effectiveness.

Get started with your Gemma 7B deployment on Runpod today using the quick deploy option!

Deploy Gemma 7b on Runpod

Author profile: Shaamil Karim