Buy New
-37%
$41.60$41.60
FREE delivery Thursday, June 11
Ships from: Amazon.com Sold by: Amazon.com
Used - Very Good
$35.00$35.00
FREE delivery June 12 - 18
Ships from: JJ resales Sold by: JJ resales
Sorry, there was a problem.
There was an error retrieving your Wish Lists. Please try again.Sorry, there was a problem.
List unavailable.
Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet, or computer - no Kindle device required.
Read instantly on your browser with Kindle for Web.
Using your mobile phone camera - scan the code below and download the Kindle app.
Follow the authors
OK
Natural Language Processing with Transformers, Revised Edition
Purchase options and add-ons
Since their introduction in 2017, transformers have quickly become the dominant architecture for achieving state-of-the-art results on a variety of natural language processing tasks. If you're a data scientist or coder, this practical book -now revised in full color- shows you how to train and scale these large models using Hugging Face Transformers, a Python-based deep learning library.
Transformers have been used to write realistic news stories, improve Google Search queries, and even create chatbots that tell corny jokes. In this guide, authors Lewis Tunstall, Leandro von Werra, and Thomas Wolf, among the creators of Hugging Face Transformers, use a hands-on approach to teach you how transformers work and how to integrate them in your applications. You'll quickly learn a variety of tasks they can help you solve.
- Build, debug, and optimize transformer models for core NLP tasks, such as text classification, named entity recognition, and question answering
- Learn how transformers can be used for cross-lingual transfer learning
- Apply transformers in real-world scenarios where labeled data is scarce
- Make transformer models efficient for deployment using techniques such as distillation, pruning, and quantization
- Train transformers from scratch and learn how to scale to multiple GPUs and distributed environments
- ISBN-101098136799
- ISBN-13978-1098136796
- Edition1st
- PublisherO'Reilly Media
- Publication dateJuly 5, 2022
- LanguageEnglish
- Dimensions7 x 1 x 9.25 inches
- Print length406 pages
Frequently bought together

Customers who viewed this item also viewed
Hands-On Large Language Models: Language Understanding and GenerationPaperbackFREE Shipping by AmazonGet it as soon as Thursday, Jun 11
Build a Large Language Model (From Scratch)PaperbackFREE Shipping by AmazonGet it as soon as Thursday, Jun 11
AI Engineering: Building Applications with Foundation ModelsPaperbackFREE Shipping by AmazonGet it as soon as Thursday, Jun 11
Designing Machine Learning Systems: An Iterative Process for Production-Ready ApplicationsPaperbackFREE Shipping by AmazonGet it as soon as Thursday, Jun 11
Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Build Intelligent SystemsPaperbackFREE Shipping by AmazonGet it as soon as Thursday, Jun 11
LLM Engineer's Handbook: Master the art of engineering large language models from concept to productionPaperbackFREE Shipping by AmazonGet it as soon as Thursday, Jun 11
Customers also bought or read
- Hands-On Large Language Models: Language Understanding and Generation
Paperback$47.69$47.69FREE delivery Thu, Jun 11 - Generative Deep Learning: Teaching Machines To Paint, Write, Compose, and Play
Paperback$47.37$47.37FREE delivery Thu, Jun 11 - Designing Machine Learning Systems: An Iterative Process for Production-Ready Applications
Paperback$40.00$40.00FREE delivery Thu, Jun 11 - Build a Large Language Model (From Scratch)#1 Best SellerComputer Neural Networks
Paperback$49.24$49.24FREE delivery Thu, Jun 11 - Transformers for Natural Language Processing and Computer Vision: Explore Generative AI and Large Language Models with Hugging Face, ChatGPT, GPT-4V, and DALL-E 3
Paperback$35.08$35.08FREE delivery Thu, Jun 11 - Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Build Intelligent Systems
Paperback$49.50$49.50FREE delivery Thu, Jun 11 - LLM Engineer's Handbook: Master the art of engineering large language models from concept to production
Paperback$44.99$44.99FREE delivery Thu, Jun 11 - Deep Learning (Adaptive Computation and Machine Learning series)
Hardcover$61.00$61.00FREE delivery Thu, Jun 11 - AI Engineering: Building Applications with Foundation Models#1 Best SellerEnterprise Applications
Paperback$57.00$57.00FREE delivery Thu, Jun 11 - Deep Learning for Coders with Fastai and PyTorch: AI Applications Without a PhD
Paperback$41.57$41.57FREE delivery Thu, Jun 11 - Machine Learning Design Patterns: Solutions to Common Challenges in Data Preparation, Model Building, and MLOps
Paperback$36.99$36.99FREE delivery Thu, Jun 11 - Python Natural Language Processing Cookbook: Over 60 recipes for building powerful NLP solutions using Python and LLM libraries
Paperback$34.99$34.99Delivery Thu, Jun 11 - Building LLMs for Production: Enhancing LLM Abilities and Reliability with Prompting, Fine-Tuning, and RAG
Paperback$58.58$58.58FREE delivery Thu, Jun 11 - Hands-On Machine Learning with Scikit-Learn and PyTorch: Concepts, Tools, and Techniques to Build Intelligent Systems
Paperback$80.41$80.41FREE delivery Thu, Jun 11 - Generative AI with LangChain: Build production-ready LLM applications and advanced agents using Python, LangChain, and LangGraph
Paperback$44.99$44.99FREE delivery Thu, Jun 11 - LLMs in Production: From language models to successful products
Paperback$50.66$50.66FREE delivery Thu, Jun 11 - Natural Language Processing with Python: Analyzing Text with the Natural Language Toolkit
Paperback$24.43$24.43Delivery Thu, Jun 11 - Essential Math for AI: Next-Level Mathematics for Efficient and Successful AI Systems
Paperback$44.14$44.14FREE delivery Thu, Jun 11 - Natural Language Processing with PyTorch: Build Intelligent Language Applications Using Deep Learning
Paperback$34.15$34.15$3.99 delivery Jun 23 - 30 - Machine Learning with PyTorch and Scikit-Learn: Develop machine learning and deep learning models with Python
Paperback$37.95$37.95FREE delivery Thu, Jun 11 - Practical Natural Language Processing: A Comprehensive Guide to Building Real-World NLP Systems
Paperback$55.07$55.07FREE delivery Thu, Jun 11 - Reinforcement Learning, second edition: An Introduction (Adaptive Computation and Machine Learning series)
Hardcover$70.00$70.00FREE delivery Jun 21 - 24 - The Hundred-Page Language Models Book: hands-on with PyTorch (The Hundred-Page Books)
Paperback$46.95$46.95FREE delivery Thu, Jun 11 - Building AI Agents with LLMs, RAG, and Knowledge Graphs: A practical guide to autonomous and modern AI agents
Paperback$44.99$44.99FREE delivery Thu, Jun 11
From the brand
-
Browse more NLP & LLM books
-
Machine Learning, AI & more
-
More from O'Reilly
-
Sharing the knowledge of experts
O'Reilly's mission is to change the world by sharing the knowledge of innovators. For over 40 years, we've inspired companies and individuals to do new things (and do them better) by providing the skills and understanding that are necessary for success.
Our customers are hungry to build the innovations that propel the world forward. And we help them do just that.
From the Publisher
From the Preface
Who Is This Book For?
This book is written for data scientists and machine learning engineers who may have heard about the recent breakthroughs involving transformers, but are lacking an in-depth guide to help them adapt these models to their own use cases. The book is not meant to be an introduction to machine learning, and we assume you are comfortable programming in Python and has a basic understanding of deep learning frameworks like PyTorch and TensorFlow. We also assume you have some practical experience with training models on GPUs. Although the book focuses on the PyTorch API of Transformers, Chapter 2 shows you how to translate all the examples to TensorFlow.
What You Will Learn
The goal of this book is to enable you to build your own language applications. To that end, it focuses on practical use cases, and delves into theory only where necessary. The style of the book is hands-on, and we highly recommend you experiment by running the code examples yourself.
The book covers all the major applications of transformers in NLP by having each chapter (with a few exceptions) dedicated to one task, combined with a realistic use case and dataset. Each chapter also introduces some additional concepts. Here’s a high-level overview of the tasks and topics we’ll cover:
- Chapter 1, Hello Transformers, introduces transformers and puts them into context. It also provides an introduction to the Hugging Face ecosystem.
- Chapter 2, Text Classification, focuses on the task of sentiment analysis (a common text classification problem) and introduces the Trainer API.
- Chapter 3, Transformer Anatomy, dives into the Transformer architecture in more depth, to prepare you for the chapters that follow.
- Chapter 4, Multilingual Named Entity Recognition, focuses on the task of identifying entities in texts in multiple languages (a token classification problem).
- Chapter 5, Text Generation, explores the ability of transformer models to generate text, and introduces decoding strategies and metrics.
- Chapter 6, Summarization, digs into the complex sequence-to-sequence task of text summarization and explores the metrics used for this task.
- Chapter 7, Question Answering, focuses on building a review-based question answering system and introduces retrieval with Haystack.
- Chapter 8, Making Transformers Efficient in Production, focuses on model performance. We’ll look at the task of intent detection (a type of sequence classification problem) and explore techniques such a knowledge distillation, quantization, and pruning.
- Chapter 9, Dealing with Few to No Labels, looks at ways to improve model performance in the absence of large amounts of labeled data. We’ll build a GitHub issues tagger and explore techniques such as zero-shot classification and data augmentation.
- Chapter 10, Training Transformers from Scratch, shows you how to build and train a model for autocompleting Python source code from scratch. We’ll look at dataset streaming and large-scale training, and build our own tokenizer.
- Chapter 11, Future Directions, explores the challenges transformers face and some of the exciting new directions that research in this area is going into.
Editorial Reviews
About the Author
Leandro von Werra is a data scientist at Swiss Mobiliar where he leads the company's natural language processing efforts to streamline and simplify processes for customers and employees. He has experience working across the whole machine learning stack, and is the creator of a popular Python library that combines Transformers with reinforcement learning. He also teaches data science and visualisation at the Bern University of Applied Sciences.
Thomas Wolf is Chief Science Officer and co-founder of HuggingFace. His team is on a mission to catalyze and democratize NLP research. Prior to HuggingFace, Thomas gained a Ph.D. in physics, and later a law degree. He worked as a physics researcher and a European Patent Attorney.
Product details
- Publisher : O'Reilly Media
- Publication date : July 5, 2022
- Edition : 1st
- Language : English
- Print length : 406 pages
- ISBN-10 : 1098136799
- ISBN-13 : 978-1098136796
- Item Weight : 7.4 ounces
- Dimensions : 7 x 1 x 9.25 inches
- Best Sellers Rank: #73,670 in Books (See Top 100 in Books)
- #15 in Data Processing
- #31 in Natural Language Processing (Books)
- #150 in Artificial Intelligence & Semantics
- Customer Reviews:
About the authors

Lewis Tunstall is a machine learning engineer at Hugging Face. He has built machine learning applications for startups and enterprises in the domains of NLP, topological data analysis, and time series. Lewis has a PhD in theoretical physics and has held research positions in Australia, the USA, and Switzerland. His current work focuses on developing tools for the NLP community and teaching people to use them effectively.

Discover more of the author’s books, see similar authors, read book recommendations and more.

Leandro von Werra is a machine learning engineer in the open source team at Hugging Face. He has several years of industry experience bringing NLP projects to production by working across the whole machine learning stack, and is the creator of a popular Python library called TRL that combines transformers with reinforcement learning.

Thomas Wolf is Chief Science Officer and co-founder of Hugging Face Inc. He and his teams are on a mission to catalyse and democratise responsible ML and AI research by creating large scale open-source and open-science projects. Prior to founding HuggingFace, he gained a Ph.D. in statistical and quantum physics, and later a law degree from Sorbonne University. He previously worked as a physics researcher and a European Patent Attorney in the USA, France, and the Netherlands where he currently reside with his family.
Customer reviews
Customer Reviews, including Product Star Ratings help customers to learn more about the product and decide whether it is the right product for them.
To calculate the overall star rating and percentage breakdown by star, we don’t use a simple average. Instead, our system considers things like how recent a review is and if the reviewer bought the item on Amazon. It also analyzed reviews to verify trustworthiness.
Learn more how customers reviews work on AmazonReviews with images
Top reviews from the United States
- 5 out of 5 stars
Thorough
Reviewed in the United States on August 3, 2024A very thorough book that introduces the key components of transformer based neural networks along with fully formed examples for common tasks.
One person found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 5 out of 5 stars
Irreplaceable in my work
Reviewed in the United States on November 10, 2022This book is awesome. The explanations are not only clear and concise, it is accompanied by code that is also very readable and playing with it makes all the difference. There are many explanations & code for Transformers around, but rarely do they come together so perfectly. And it's also a lot of fun to read/play with the concepts.
6 people found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 5 out of 5 stars
First chapter already paid off
Reviewed in the United States on July 3, 2023Need not look further, must have, absolutely the best, etc. Just buy this when you are a data scientist and into NLP. Sure, by all means buy more learning material. This one you won’t regret.
5 people found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 5 out of 5 stars
Good explanations
Reviewed in the United States on June 15, 2023The authors are good at explaining things I’ve been reading about in several different places yet hadnt been able to understand.
4 people found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 5 out of 5 stars
Magnífico
Reviewed in the United States on October 17, 2023Muy buen libro para aprender acerca de transformers, muy bien escrito
Sending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 4 out of 5 stars
Ink stains in the cover
Reviewed in the United States on September 7, 2022Cover of the book is not in the best shape. There are ink stains.

Cover of the book is not in the best shape. There are ink stains.
2 people found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 5 out of 5 stars
Great book with details
Reviewed in the United States on October 15, 2022
One person found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 5 out of 5 stars
Excellent book for NLP and transformers
Reviewed in the United States on January 12, 2024"Natural Language Processing with Transformers" is a highly informative and well-structured book. It offers a clear and concise overview of transformers in NLP, making complex concepts accessible to a broad range of readers. The authors effectively balance theory with practical examples (all run seamlessly and are easy to follow), which is helpful for both beginners and experienced practitioners. The real-world NLP applications provided are particularly useful. Overall, it's a solid resource for anyone interested in understanding and applying transformers in the field of NLP.
One person found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again
Top reviews from other countries
Hatim A. Aboalsamh4 out of 5 starsRecommended
Reviewed in Saudi Arabia on March 9, 2025nice book
Sending feedback...Thanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again
Bennekrouf3 out of 5 starsGoing to fast on concepts, too much code
Reviewed in Germany on June 22, 2025Too hand-on. I am developer, I needed less code but more explanation on fundamentals repeated over the book without dedicated explanations like hidden. While reading the book I was always wondering « why is he doing this ». May be interesting for ML engineers which lacks only the code part of transformers.
Sending feedback...Thanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again
Júlia5 out of 5 starsEra para presente
Reviewed in Brazil on July 27, 2024Chegou bem embalado, direitinho e dentro do prazo. Em ótimo estado e a pessoa que recebeu o presente, amou
Sending feedback...Thanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again
Roberto Guzmán5 out of 5 starsAmazing!
Reviewed in Mexico on October 7, 2022Content is all I needed to start coding my first transformers 😁
Sending feedback...Thanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again
Mad S.5 out of 5 starsAmazing book by equally amazing author
Reviewed in France on February 28, 2023I'm glad I purchasers this book as it is one of the best ones on the topic. I highly recommend it.
Sending feedback...Thanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again










![Seed Saving Secrets [All-in-1]: 31 Essential Techniques & Tips for Preppers and Gardeners. Master Harvesting, Storing, and Growing Seeds - Keep Your Vegetables & Flowers Thriving for Years!](https://m.media-amazon.com/images/I/51kP1NmZdCL._AC_SR100,100_QL65_.jpg)


