This is the code repository for Generative AI with Python and PyTorch, Second Edition, published by Packt.
Joseph Babcock, Raghav Bali
Become an expert in generative AI through practical projects to leverage cutting-edge models for Natural Language Processing (NLP) and computer vision. Generative AI with Python and PyTorch, Second Edition, is your comprehensive guide to creating advanced AI applications. Leveraging Python, this book provides a detailed exploration of the latest generative AI technologies.
From NLP to image generation, this edition dives into practical applications and the underlying theories that enable these technologies. By integrating the latest advancements and applications of large language models, this book prepares you to design and implement powerful AI systems that transform data into actionable insights.
You’ll build your LLM toolbox by learning about various models, tools, and techniques, including GPT-4, LangChain, RLHF, LoRA, and retrieval augmented generation. This deep learning book shows you how to generate images and apply styler transfer using GANs, before implementing CLIP and diffusion models.
Whether you’re creating dynamic content or developing complex AI-driven solutions, Generative AI with Python and PyTorch, Second Edition, equips you with the knowledge to use Python and AI to their full potential.
- Understand the core concepts behind large language models and their capabilities
- Craft effective prompts using chain-of-thought, ReAct, and prompt query language to guide LLMs toward your desired outputs
- Learn how attention and transformers have changed NLP
- Optimize your diffusion models by combining them with VAEs
- Build several text generation pipelines based on LSTMs and LLMs
- Leverage the power of open-source LLMs, such as Llama and Mistral, for various tasks
Basic understanding of Python syntax and programming experience will help you understand the majority of the code base. Additionally, an intermediate-level understanding of concepts related to machine learning and deep learning would enable you to appreciate and understand complex generative models and techniques discussed throughout the book. A quick setup guide is as follows:
- 512 GB HDD
- 32 GB RAM
- Intel Core i5 processor or better / Apple Silicon M1 or better
- Access to a 32 GB graphics card or better (T4 or better)
- Python 3.11 and above
- PyTorch 2.5.x and above
- Chrome, Safari, or Firefox for executing code directly via Google Colab or other cloud services
Joseph Babcock Joseph Babcock has spent over a decade working with big data and AI in the e-commerce, digital streaming, and quantitative finance domains. Throughout his career, he has worked on recommender systems, petabyte-scale cloud data pipelines, A/B testing, causal inference, and time series analysis. He completed his PhD studies at Johns Hopkins University, applying machine learning to drug discovery and genomics.
Raghav Bali Raghav Bali is a Staff Data Scientist at Delivery Hero, a leading food delivery service headquartered in Berlin, Germany. With 12+ years of expertise, he specializes in research and development of enterprise-level solutions leveraging Machine Learning, Deep Learning, Natural Language Processing, and Recommendation Engines for practical business applications. Besides his professional endeavors, Raghav is an esteemed mentor and an accomplished public speaker. He has contributed to multiple peer-reviewed papers and authored multiple well received books. Additionally, he holds co-inventor credits on multiple patents in healthcare, machine learning, deep learning, and natural language processing.