Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Transformers for Natural Language Processing and Computer Vision - Third Edition
Transformers for Natural Language Processing and Computer Vision - Third Edition

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, Third Edition

By Denis Rothman
Free Trial
Book Feb 2024 728 pages 3rd Edition
eBook
NZ$‎64.99 NZ$‎44.99
Print
NZ$‎80.99
Subscription
Free Trial
eBook
NZ$‎64.99 NZ$‎44.99
Print
NZ$‎80.99
Subscription
Free Trial

What do you get with a Packt Subscription?

Free for first 7 days. $15.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details


Publication date : Feb 29, 2024
Length 728 pages
Edition : 3rd Edition
Language : English
ISBN-13 : 9781805128724
Vendor :
OpenAI
Category :
Languages :
Concepts :

Estimated delivery fee Deliver to New Zealand

Standard 10 - 13 business days

NZ$20.95

Premium 5 - 8 business days

NZ$74.95
(Includes tracking information)
Table of content icon View table of contents Preview book icon Preview Book

Transformers for Natural Language Processing and Computer Vision - Third Edition

Transformers for Natural Language Processing and Computer Vision, Third Edition: Take Generative AI and LLMs to the next level with Hugging Face, Google Vertex AI, ChatGPT, GPT-4V, and DALL-E 3

Welcome to Packt Early Access. We’re giving you an exclusive preview of this book before it goes on sale. It can take many months to write a book, but our authors have cutting-edge information to share with you today. Early Access gives you an insight into the latest developments by making chapter drafts available. The chapters may be a little rough around the edges right now, but our authors will update them over time.You can dip in and out of this book or follow along from start to finish; Early Access is designed to be flexible. We hope you enjoy getting to know more about the process of writing a Packt book.

  1. Chapter 1: What are Transformers?
  2. Chapter 2: Getting Started with the Architecture of the Transformer Model
  3. Chapter 3: Emergent vs Downstream Tasks:...

How constant time complexity O(1) changed our lives forever

How could this deceivingly simple O(1) time complexity class forever change AI and our everyday lives? How could O(1) explain the profound architectural changes that made ChatGPT so powerful and stunned the world? How can something as simple as O(1) allow systems like ChatGPT to spread to every domain and hundreds of tasks?

The answer to these questions is the only way to find your way in the growing maze of transformer datasets, models, and applications is to focus on the underlying concepts of thousands of assets. Those concepts will take you to the core of the functionality you need for your projects.

This section will provide a significant answer to those questions before we move on to see how one token (a minimal piece of a word) started an AI revolution that is raging around the world, triggering automation never seen before.

We need to get to the bottom of the chaos and disruption generated by transformers...

From one token to an AI revolution

Yes, the title is correct, as you will see in this section. One token produced an AI revolution and has opened the door to AI in every domain and application.

ChatGPT with GPT-4, PaLM 2, and other LLMs have a unique way of producing text.

In LLMs, a token is a minimal word part. The token is where a Large Language Model starts and ends.

For example, the word including could become: includ + ing, representing two tokens. GPT models predict tokens based on the hundreds of billions of tokens in its training dataset. Examine the graph in Figure 1.9 of an OpenAI GPT model that is making an inference to produce a token:

A diagram of a diagram  Description automatically generated

Figure 1.9: GPT inference graph built in Python with NetworkX

It may come as a surprise, but the only parts of this figure controlled by the model are Model and Output Generation!, which produce raw logits. All the rest is in the pipeline.

To understand the pipeline, we will first go through the description...

Foundation Models

Advanced large multipurpose transformer models represent such a paradigm change that they require a new name to describe them: Foundation Models. Accordingly, Stanford University created the Center for Research on Foundation Models (CRFM). In August 2021, the CRFM published a two-hundred-page paper (see the References section) written by over one hundred scientists and professionals: On the Opportunities and Risks of Foundation Models.

Foundation Models were not created by academia but by the big tech industry. Google invented the transformer model, leading to Google BERT, LaMBDA, PaLM 2, and more. Microsoft partnered with OpenAI to produce ChatGPT with GPT-4, and soon more.

Big tech had to find a better model to face the exponential increase of petabytes of data flowing into their data centers. Transformers were thus born out of necessity.

Let’s consider the evolution of LLMs to understand the need for industrialized AI models.

Transformers...

The role of AI professionals

Transformer-driven AI is connecting everything to everything, everywhere. Machines communicate directly with other machines. AI-driven IoT signals trigger automated decisions without human intervention. NLP algorithms send automated reports, summaries, emails, advertisements, and more.

AI specialists must adapt to this new era of increasingly automated tasks, including transformer model implementations. AI professionals will have new functions. If we list transformer NLP tasks that an AI specialist will have to do, from top to bottom, it appears that some high-level tasks require little to no development from an AI specialist. An AI specialist can be an AI guru, providing design ideas, explanations, and implementations.

The pragmatic definition of what a transformer represents for an AI specialist will vary with the ecosystem.

Let’s go through a few examples:

  • API: The OpenAI API does not require an AI developer. A web designer...

The rise of transformer seamless APIs and assistants

We are now well into the industrialization era of AI. Microsoft Azure, Google Cloud, Amazon Web Services (AWS), and IBM, among others, provide AI services that no developer or team of developers could hope to outperform. Tech giants have million-dollar supercomputers with massive datasets to train transformer models and AI models in general.

Big tech giants have many corporate customers that already use their cloud services. As a result, adding a transformer API to an existing cloud architecture requires less effort than any other solution.

A small company or even an individual can access the most powerful transformer models through an API with practically no investment in development. An intern can implement the API in a few days. There is no need to be an engineer or have a Ph.D. for such a simple implementation.

For example, the OpenAI platform now has a Software as a Service (SaaS) API for some of the most effective...

Summary

Transformers forced AI to make profound evolutions. Foundation Models, including their Generative AI abilities, are built on top of the digital revolution connecting everything to everything with underlying processes everywhere. Automated processes are replacing human decisions in critical areas, including NLP.

RNNs slowed the progression of automated NLP tasks required in a fast-moving world. Transformers filled the gap. A corporation needs summarization, translation, and a wide range of NLP tools to meet the challenges of the growing volume of incoming information.

Transformers have thus spurred an age of AI industrialization. We first saw how the O(1) time complexity of the attention layers and their computational time complexity, O(n2*d), shook the world of AI.

We saw how the one-token flexibility of transformer models pervaded every domain of our everyday lives!

Platforms such as Hugging Face, Google Cloud, OpenAI, and Microsoft Azure provide NLP tasks...

Questions

  1. ChatGPT is a game-changer. (True/False)
  2. ChatGPT can replace all AI algorithms. (True/False)
  3. AI developers will sometimes have no AI development to do. (True/False)
  4. AI developers might have to implement transformers from scratch. (True/False)
  5. It’s not necessary to learn more than one transformer ecosystem, such as Hugging Face. (True/False)
  6. A ready-to-use transformer API can satisfy all needs. (True/False)
  7. A company will accept the transformer ecosystem a developer knows best. (True/False)
  8. Cloud transformers have become mainstream. (True/False)
  9. A transformer project can be run on a laptop. (True/False)
  10. AI specialists will have to be more flexible. (True/False)

References

Further reading

Join our community on Discord

Join our community’s Discord space for discussions with the authors and other readers:

https://www.packt.link/Transformers

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Compare and contrast 20+ models (including GPT-4, BERT, and Llama 2) and multiple platforms and libraries to find the right solution for your project
  • Apply RAG with LLMs using customized texts and embeddings
  • Mitigate LLM risks, such as hallucinations, using moderation models and knowledge bases
  • Purchase of the print or Kindle book includes a free eBook in PDF format

Description

Transformers for Natural Language Processing and Computer Vision, Third Edition, explores Large Language Model (LLM) architectures, applications, and various platforms (Hugging Face, OpenAI, and Google Vertex AI) used for Natural Language Processing (NLP) and Computer Vision (CV). The book guides you through different transformer architectures to the latest Foundation Models and Generative AI. You’ll pretrain and fine-tune LLMs and work through different use cases, from summarization to implementing question-answering systems with embedding-based search techniques. You will also learn the risks of LLMs, from hallucinations and memorization to privacy, and how to mitigate such risks using moderation models with rule and knowledge bases. You’ll implement Retrieval Augmented Generation (RAG) with LLMs to improve the accuracy of your models and gain greater control over LLM outputs. Dive into generative vision transformers and multimodal model architectures and build applications, such as image and video-to-text classifiers. Go further by combining different models and platforms and learning about AI agent replication. This book provides you with an understanding of transformer architectures, pretraining, fine-tuning, LLM use cases, and best practices.

What you will learn

Breakdown and understand the architectures of the Original Transformer, BERT, GPT models, T5, PaLM, ViT, CLIP, and DALL-E Fine-tune BERT, GPT, and PaLM 2 models Learn about different tokenizers and the best practices for preprocessing language data Pretrain a RoBERTa model from scratch Implement retrieval augmented generation and rules bases to mitigate hallucinations Visualize transformer model activity for deeper insights using BertViz, LIME, and SHAP Go in-depth into vision transformers with CLIP, DALL-E 2, DALL-E 3, and GPT-4V

What do you get with a Packt Subscription?

Free for first 7 days. $15.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details


Publication date : Feb 29, 2024
Length 728 pages
Edition : 3rd Edition
Language : English
ISBN-13 : 9781805128724
Vendor :
OpenAI
Category :
Languages :
Concepts :

Estimated delivery fee Deliver to New Zealand

Standard 10 - 13 business days

NZ$20.95

Premium 5 - 8 business days

NZ$74.95
(Includes tracking information)

Table of Contents

24 Chapters
Preface Chevron down icon Chevron up icon
1. What Are Transformers? Chevron down icon Chevron up icon
2. Getting Started with the Architecture of the Transformer Model Chevron down icon Chevron up icon
3. Emergent vs Downstream Tasks: The Unseen Depths of Transformers Chevron down icon Chevron up icon
4. Advancements in Translations with Google Trax, Google Translate, and Gemini Chevron down icon Chevron up icon
5. Diving into Fine-Tuning through BERT Chevron down icon Chevron up icon
6. Pretraining a Transformer from Scratch through RoBERTa Chevron down icon Chevron up icon
7. The Generative AI Revolution with ChatGPT Chevron down icon Chevron up icon
8. Fine-Tuning OpenAI GPT Models Chevron down icon Chevron up icon
9. Shattering the Black Box with Interpretable Tools Chevron down icon Chevron up icon
10. Investigating the Role of Tokenizers in Shaping Transformer Models Chevron down icon Chevron up icon
11. Leveraging LLM Embeddings as an Alternative to Fine-Tuning Chevron down icon Chevron up icon
12. Toward Syntax-Free Semantic Role Labeling with ChatGPT and GPT-4 Chevron down icon Chevron up icon
13. Summarization with T5 and ChatGPT Chevron down icon Chevron up icon
14. Exploring Cutting-Edge LLMs with Vertex AI and PaLM 2 Chevron down icon Chevron up icon
15. Guarding the Giants: Mitigating Risks in Large Language Models Chevron down icon Chevron up icon
16. Beyond Text: Vision Transformers in the Dawn of Revolutionary AI Chevron down icon Chevron up icon
17. Transcending the Image-Text Boundary with Stable Diffusion Chevron down icon Chevron up icon
18. Hugging Face AutoTrain: Training Vision Models without Coding Chevron down icon Chevron up icon
19. On the Road to Functional AGI with HuggingGPT and its Peers Chevron down icon Chevron up icon
20. Beyond Human-Designed Prompts with Generative Ideation Chevron down icon Chevron up icon
21. Other Books You May Enjoy Chevron down icon Chevron up icon
22. Index Chevron down icon Chevron up icon
Appendix: Answers to the Questions Chevron down icon Chevron up icon

Customer reviews

Filter icon Filter
Top Reviews
Rating distribution
Empty star icon Empty star icon Empty star icon Empty star icon Empty star icon 0
(0 Ratings)
5 star 0%
4 star 0%
3 star 0%
2 star 0%
1 star 0%

Filter reviews by


No reviews found
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.