Topic Modeling with Llama 2

Maarten Grootendorst · Beginner ·🧠 Large Language Models ·2y ago
In this video, you'll learn how to use Llama 2 for Topic Modeling in Python. Llama 2 is an incredible open-source Large Language Model that can perform on par with GPT-3.5. We will use BERTopic to create base topics and leverage Llama 2 to create natural labels. Timeline 0:00 Introduction 0:36 How does BERTopic work? 2:44 Installing Dependencies 3:14 Data 4:38 Llama 2 6:19 Optimization & Quantization 10:23 Prompt Engineering 16:17 BERTopic - Preparing the sub-models 20:08 BERTopic - Training + Output 25:27 Visualization 💬 BERTopic: https://github.com/MaartenGr/bertopic 📒 Google Colab notebook https://colab.research.google.com/drive/1QCERSMUjqGetGGujdrvv_6_EeoIcd_9M?usp=sharing 🛠️ Tutorial blog on using Llama 2 for Topic Modeling https://maartengrootendorst.substack.com/p/topic-modeling-with-llama-2 🦙 Llama 2 model (7B) on HuggingFace https://huggingface.co/meta-llama/Llama-2-7b-chat-hf Support my work: 👪 Join as Channel Member: / @maartengrootendorst ✉️ Newsletter https://maartengrootendorst.substack.com/ 📖 Join Medium to Read my Blogs https://medium.com/@maartengrootendorst I'm writing a book! 📚 Hands-On Large Language Models https://www.oreilly.com/library/view/hands-on-large-language/9781098150952/ #datascience #machinelearning #ai
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Related AI Lessons

The Hidden 43% — How Teams Waste Half Their LLM API Budget
Teams waste 43% of their LLM API budget due to inefficiencies, with retry storms being a major contributor, and optimizing API usage can help reduce costs
Dev.to · John Medina
What Economists, Traders, and Engineers Know About AI That You Don’t
Learn how physicists, traders, and engineers leverage AI by incorporating domain knowledge, causal relationships, and constraints to move beyond black-box learning
Medium · LLM
[Promptfoo] LLM Evaluation Techniques
Learn how to evaluate LLMs for business purposes using systematic techniques, including assessing accuracy, cost-effectiveness, and reliability
Medium · Data Science
[Promptfoo] LLM Evaluation Techniques
Learn how to evaluate LLMs for business purposes using systematic techniques to choose the best model for specific use cases
Medium · LLM

Chapters (10)

Introduction
0:36 How does BERTopic work?
2:44 Installing Dependencies
3:14 Data
4:38 Llama 2
6:19 Optimization & Quantization
10:23 Prompt Engineering
16:17 BERTopic - Preparing the sub-models
20:08 BERTopic - Training + Output
25:27 Visualization
Up next
5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
Dave Ebbelaar (LLM Eng)
Watch →