From the course: Programming Generative AI: From Variational Autoencoders to Stable Diffusion with PyTorch and Hugging Face
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
Decoding strategies
From the course: Programming Generative AI: From Variational Autoencoders to Stable Diffusion with PyTorch and Hugging Face
Decoding strategies
- [Instructor] So now that we saw kind of the default, or what's baked into the Hugging Face pipelines for generating text, I wanted to talk about how both the default strategies work for turning probabilities into tokens, into text, as well as talk about some alternatives that Hugging Face makes pretty easy. So the first that I want to mention, which actually isn't the default probably because it's usually not what you want and usually not the best, is to essentially do greedy sampling. And with the generation pipeline, we're using the same one that we had in the last video, this is the DistilGPT2, we're using the same prompt of "Jonathan Dinu is." So the default is do_sample=True. So do_sample, you can think of it as what do you want to do with the actual return probabilities from the model itself. So if you specify do_sample=False, we're essentially just taking the maximum probability and using that to generate the text. Now, the important thing to know about this greedy sampling…
Contents
-
-
-
-
-
-
-
(Locked)
Topics50s
-
(Locked)
The natural language processing pipeline13m
-
(Locked)
Generative models of language9m 31s
-
(Locked)
Generating text with transformers pipelines15m 5s
-
(Locked)
Deconstructing transformers pipelines8m 15s
-
(Locked)
Decoding strategies13m 6s
-
(Locked)
Transformers are just latent variable models for sequences12m 16s
-
(Locked)
Visualizing and understanding attention24m 21s
-
(Locked)
Turning words into vectors10m 44s
-
(Locked)
The vector space model7m 14s
-
(Locked)
Embedding sequences with transformers10m 11s
-
(Locked)
Computing the similarity between embeddings7m 48s
-
(Locked)
Semantic search with embeddings6m 32s
-
(Locked)
Contrastive embeddings with sentence transformers6m 46s
-
(Locked)
-
-
-