EmbeddingGemma 2: local setup and PDF retrieval tutorial
Learn to set up EmbeddingGemma 2 on Ubuntu and retrieve PDF passages with Python. The speaker demonstrates BFloat16 execution on an Nvidia 3090.
Player not loading? Watch on YouTube
This tutorial walks through a local setup of Google's EmbeddingGemma 2 on Ubuntu, then uses Python to retrieve passages from a PDF. The speaker describes an open-weights embedding model that maps text, images and audio into a shared vector space. Its role in the example is retrieval: it ranks relevant passages for a question rather than generating a written answer.
Setup covers a Python virtual environment, upgrading pip and installing Hugging Face Transformers, Sentence Transformers, torch and a PDF library. The speaker stresses using an up-to-date Transformers version. A first test downloads and loads the model; a longer example loads a saved Wikipedia article about Nikola Tesla, splits its text into chunks and generates embeddings. The script encodes a question about Tesla's alternating current inventions, computes similarities and prints the top three matches.
The speaker runs the model in BFloat16 precision and reports using an Nvidia 3090 GPU. During a repeat run, nvtop shows GPU usage reaching 30% and memory usage reaching 9.5 GB at one point. These are observations from the demonstration, not minimum hardware requirements or general benchmarks. The tutorial stops at ranked retrieval results; passing those passages to a local LLM for answer generation is a further RAG step.