What is Hugging Face?
45sClear intro to a popular AI platform, perfect for beginners.
▶ Play ClipThis course provides a comprehensive overview of Hugging Face, a company and open-source community focused on NLP and AI. It covers key libraries like Transformers, Datasets, and Tokenizers, along with practical implementations of various NLP tasks including sentiment analysis, text classification, summarization, translation, question answering, and text-to-image/video generation.
Hugging Face is a company and open-source community focusing on NLP and AI, best known for its Transformers library providing pre-trained models for tasks like text classification, sentiment analysis, and machine translation.
Main libraries include Transformers (pre-trained models like BERT), Datasets (for accessing datasets), and Tokenizers (for tokenization). Features include Model Hub, Spaces for demos, and a strong community.
Popular models include BERT (bidirectional context understanding), GPT (generative pre-trained transformer), and RoBERTa (robustly optimized BERT approach with dynamic masking).
Use cases include conversational AI (chatbots), sentiment analysis, text generation, text summarization, named entity recognition, machine translation, question answering, speech recognition, recommendation systems, fraud detection, and multimodal applications.
Install using pip: `pip install transformers`. On Google Colab, use `!pip install transformers`. Also installable from GitHub.
Provides easy access to over 350K datasets for NLP and ML. Install via `pip install datasets`. Features lazy loading, unified API, and integration with Transformers.
Fast and efficient tokenization library. Install via `pip install tokenizers`. Supports custom tokenizers and multiple algorithms.
Access token (API key) is needed for private/gated models, inference API, and uploading to Hub. Not needed for public models. Create via huggingface.co/settings/tokens.
Use `load_dataset` from Datasets library. Example: `load_dataset('imdb')` downloads the IMDB dataset for sentiment analysis.
Use `from_pretrained` from Transformers. Example: `AutoModel.from_pretrained('bert-base-uncased')` downloads BERT model.
Use pipeline('sentiment-analysis') to analyze text. Example: `sentiment_pipeline(['I love cricket', 'I hate missing a century'])` returns labels and confidence scores.
Use pipeline('text-classification', model='model_name') for spam detection. Example classifies texts as spam or not spam with confidence scores.
Use AutoModelForSeq2SeqLM and AutoTokenizer with a summarization model like 'facebook/bart-large-cnn'. Generate summary with parameters like max_length, min_length, length_penalty, num_beams.
Use T5 model with task prefix 'translate English to Spanish'. Example: `model.generate(input_ids)` translates text.
Use pipeline('question-answering') or AutoModelForQuestionAnswering with a context and question. Example extracts answer from given context.
Use Stable Diffusion pipeline from Diffusers library. Example: `pipe('Flying cars over futuristic cityscape')` generates and saves an image.
Use Stable Diffusion to generate frames from text prompts, then stitch frames into video using OpenCV. Example generates 10 frames of a futuristic cityscape.
Hugging Face provides a comprehensive ecosystem for NLP and AI, with easy-to-use libraries and pre-trained models for a wide range of tasks. This course covers installation, key concepts, and practical implementations of sentiment analysis, text classification, summarization, translation, question answering, and generative tasks.
"The title accurately promises a crash course on Hugging Face, and the video delivers a thorough overview with practical examples."
Hugging Face Transformers
tool
Hugging Face Datasets
tool
Hugging Face Tokenizers
tool
Hugging Face Diffusers
tool
Google Colab
tool
PyTorch
tool
OpenCV
tool
NumPy
tool
BERT
model
GPT-2
model
RoBERTa
model
T5-small
model
Stable Diffusion
model
facebook/bart-large-cnn
model
distilbert-base-uncased-finetuned-sst-2-english
model
What is Hugging Face best known for?
Its Transformers library, which provides tools and pre-trained models for NLP tasks.
0:08
Name three key libraries provided by Hugging Face.
Transformers, Datasets, and Tokenizers.
1:36
What is the Model Hub?
A platform where users can share and download pre-trained models, datasets, and other resources.
1:50
What is BERT's full form and its main capability?
Bidirectional Encoder Representations from Transformers; it excels at understanding the context of words in a sentence by analyzing relationships bidirectionally.
2:49
How does RoBERTa differ from BERT?
RoBERTa applies dynamic masking (changing the masking pattern) to improve performance over BERT.
3:29
List five use cases of Hugging Face.
Conversational AI, sentiment analysis, text summarization, machine translation, and question answering.
4:27
What command installs the Transformers library on Google Colab?
!pip install transformers
13:40
What is the purpose of the Datasets library?
To provide easy access to a wide variety of datasets for NLP and ML tasks, with features like lazy loading and streaming.
15:42
When is a Hugging Face access token required?
When using private/gated models, the inference API, or uploading models/datasets/spaces to the Hub.
26:29
How do you download the IMDB dataset using the Datasets library?
Use `load_dataset('imdb')`.
32:05
What does the score in sentiment analysis output represent?
The confidence level (probability) that the model assigns to the predicted sentiment label, ranging from 0 to 1.
41:47
What is the difference between sentiment analysis and text classification?
Sentiment analysis is narrow (positive/negative/neutral), while text classification labels depend on the task (e.g., spam/not spam, topic categories).
44:08
What parameters control summary length in text summarization?
max_length (maximum tokens), min_length (minimum tokens), length_penalty (encourages longer/shorter summaries).
51:14
What is the task prefix for English to Spanish translation using T5?
'translate English to Spanish'
55:32
What library is used for text-to-image generation in Hugging Face?
The Diffusers library, specifically the Stable Diffusion pipeline.
59:08
Hugging Face Core Offering
Defines Hugging Face as a company and open-source community focused on NLP and AI, with the Transformers library as its flagship.
0:08BERT's Bidirectional Context Understanding
Explains how BERT analyzes word relationships bidirectionally to understand ambiguous language, a key innovation in NLP.
2:49Diverse Use Cases
Lists a wide range of applications from chatbots to fraud detection, demonstrating Hugging Face's versatility.
4:27Transformers Library as Core
Highlights the Transformers library as the central tool for pre-trained models and pipelines, essential for NLP tasks.
11:15Access Token Necessity
Clarifies when authentication is needed (private models, API) vs. when it's not (public models), a practical security insight.
25:23Sentiment Analysis Pipeline
Demonstrates a simple yet powerful use of the pipeline API for sentiment analysis, showing high confidence scores for clear sentiments.
36:38Text-to-Image with Diffusers
Introduces the Diffusers library and Stable Diffusion for generating images from text, showcasing generative AI capabilities.
59:08[00:00] In this video course learn Hugging Face and
[00:08] open-source community that focuses on Natural
[00:17] It is best known for its transformers library
[00:26] wide range of NLP task such as text classification
[00:36] this course we have covered the following lessons
[00:43] first lesson In this lesson we will learn what is
[00:51] features Let us start Hugging face is a widely
[00:59] focuses on NLP that is natural language processing
[01:07] Hugging face is best known for its transformers
[01:16] so that wide range of NLP tasks such as sentiment
[01:26] can be performed The most widely used hugging face
[01:36] Let us see the features It includes lots
[01:43] transformers that includes pre-trained
[01:50] includes model hub that is a platform
[01:55] pre-trained models With that users can
[02:01] Hugging face also includes a library for a variety
[02:09] library and is used for NLP task Hugging face is
[02:18] machine learning demos and applications which is
[02:25] can easily deploy and use models in production
[02:31] community and collaboration that is a community
[02:39] ecosystem Let us see some of the popular models
[02:49] for understanding the context of words in a
[02:56] representations from transformers It is a powerful
[03:01] by Google for NLP It excels at understanding
[03:08] relationships between them in a birectional manner
[03:13] meaning of ambiguous language It also includes GPT
[03:20] textto text transformer with that robata that
[03:29] is a transformerbased language model that employs
[03:37] applies dynamic masking where the masking pattern
[03:44] various NLP task So you can also relate BERT with
[03:52] model is to improve the performance of the B model
[03:58] popular models of hugging face In this lesson we
[04:04] and some popular models Thank you for watching
[04:10] use cases of hugging face Hugging face supports
[04:17] vision and even multimodel applications Let us see
[04:27] discussed some key use cases here Beginning with
[04:32] chat bots Okay They build intelligent chat bots
[04:42] chat bots can be used for customer support like
[04:49] interactive dialogue systems These can be used
[04:57] bots Next comes sentiment analysis As the name
[05:06] analyze their social media post or the responses
[05:14] that is it is positive negative or neutral With
[05:22] even poems using models like GPT codes can also
[05:31] programming language With that content can
[05:40] review marketing plans and others Next comes text
[05:49] let's say you want to summarize news you can
[05:53] PDF documents and you only want to summarize it
[06:01] into important points With that you can also
[06:10] entity recognition Easily extract name skills
[06:16] in healthcare to identify diagnosis the name of
[06:25] you can also extract name of companies how they
[06:31] Therefore it is also used in the finance domain
[06:38] translate your website app and even documents from
[06:46] Spanish It can also be used in languages which
[06:54] Question Answering use case is mostly useful
[07:02] questions asked by students based on a specific
[07:11] when I said customer support that itself means
[07:17] that users can easily ask questions with that you
[07:24] or databases Also use it for speech recognition
[07:31] text Build voice controlled applications
[07:38] You can also provide real-time captioning generate
[07:46] document or images and you want text from it
[07:52] to read or scan images that can also be achieved
[08:00] your recommendation systems You must have seen it
[08:06] movies or web series using what people are
[08:16] the search results by understanding the intent
[08:23] easily with that regarding emails Easily detect
[08:31] be monitored using a model Easily analyze text
[08:38] such as stress anxiety or even depression With
[08:45] support calls or even chat Text to speech and
[08:52] translations can be easily worked upon Multimodel
[09:01] multimodel applications you can easily analyze
[09:09] reality applications can also be built Easily
[09:16] learning models You can also paraphrase text Also
[09:25] Grade the essays or assignments of students easily
[09:32] rephrasing content and others Use in healthcare
[09:41] patient You can easily extract the insights from
[09:49] obligation or any possible risk With that you can
[09:59] social media easily so that you can identify the
[10:08] impact of post done by influencers Multilingual
[10:16] enable search across multiple languages Hate
[10:24] needs to work on With this you can easily detect
[10:32] trends by analyzing news articles social media
[10:41] like a product launch Personalize email content
[10:49] content based on user preferences and behavior
[10:56] task Also you can compare the performance of
[11:02] saw some of the great use cases of hugging face
[11:08] of them In this lesson we will understand
[11:15] We will also learn how to install it Let's see
[11:23] pre-trained models and pipelines It is an open
[11:30] face developed the transformers library and it
[11:38] of pre-trained models for a wide range of NLP
[11:44] classification and others So in this lesson we
[11:50] why use the transformers library its use cases as
[11:58] saw what is the transformers library here Now
[12:04] Transformers library is widely used because it
[12:12] It provides you access to cutting edge models With
[12:19] It supports customization and fine-tuning With
[12:28] with other tools Here are some use cases of
[12:34] categories like text classification in the case
[12:42] like names dates and locations in text which is
[12:49] between different languages like from English to
[12:56] GPT also implement question answering that is
[13:07] us see how to install the transformers library
[13:13] the transformers library PIP is a package manager
[13:20] libraries With that you can also use Google Colab
[13:27] There is a exclamation sign if you are installing
[13:35] the transformers library directly from the
[13:40] how to install it We will use Google Colab for it
[13:49] is a browser I'll type Google Colab and press
[14:00] collab.resarch.google.com Here you can see
[14:06] it will directly open I clicked on it So it is
[14:14] are my already created notebooks I'll click
[14:22] So now we will use the same command here to
[14:27] command Okay let us type the same command Okay
[14:40] what we need to do we need to just click
[14:44] cell okay Okay So in this way we can install
[14:54] You can add the name of your Python notebook
[15:00] know Anaconda you can easily guess what is a
[15:07] later So here I've just implemented this
[15:18] In this lesson we saw what is the transformers
[15:26] that we also saw some use cases and how to install
[15:33] library on hugging face With that we will also
[15:42] library provides easy access to a wide variety
[15:50] task It is developed by hugging face and is a
[15:59] and researchers to work with data for training
[16:06] see what is the datasets library Why to use it
[16:14] how to install it Let us start We already covered
[16:20] why use the datasets library One of the reasons is
[16:30] to work with large data sets The data sets can be
[16:39] to ease the work of accessing and working on
[16:47] It has a unified API for processing data sets You
[16:54] other ML frameworks with the datasets library So
[17:00] Thousands of data sets are provided by
[17:06] pre-processing pipelines So before installing
[17:13] website So here is the link huggingface.co the
[17:22] see how many data sets are provided over 350K and
[17:28] can get all the details In this tutorial we will
[17:36] set easily using hugging face Now let us see the
[17:44] load and pre-process data sets for task like spam
[17:51] With that you can also work with sentiment
[17:59] can easily build question answering systems Some
[18:05] that named entity recognition purpose can also be
[18:13] hugging face load and pre-process your custom data
[18:23] to install the datasets library So you can use
[18:31] and manage Python packages and libraries Just use
[18:37] that you can also use Google Colab easily But
[18:43] You have an exclamation mark for Google Colab
[18:50] download it from the hugging face GitHub
[18:57] g plus github.com huggingface/datas tell pip to
[19:05] sets repository on github Now let us see how
[19:10] Google colab So I'll just use the second syntax
[19:21] So this was our Google Colab We already saw
[19:28] can install the data set library here itself But
[19:38] notebook Now a new Python notebook
[19:44] install data sets pip install pip
[19:52] just run the cell from here I have
[19:56] wait Tick mark is visible That means we
[20:04] save it from here I told you before also save and
[20:13] this way guys we can easily install the datasets
[20:20] how to work with them and its use cases Guys
[20:30] understood the concept its use cases also and
[20:39] In this lesson we will understand the tokenizers
[20:46] how to install it The tokenizers library is a fast
[20:55] often used alongside the transformers library We
[21:01] previous lessons So the tokenizers library is a
[21:07] tokenizing text data which is a crucial step in
[21:16] splitting text into smaller units such as words
[21:22] into numerical representations that ML models can
[21:29] the tokenizers library why use it its use cases
[21:38] already saw what is the tokenizers library So now
[21:46] quite quick for tokenization that means optimized
[21:54] It also supports custom tokenizers as well
[22:00] tokenization algorithms Integration is possible
[22:07] libraries like transformers It has an easy API for
[22:17] that you can easily access pre-trained
[22:24] easily tokenize the textual data for classifying
[22:31] that you can also analyze the spam easily
[22:39] with entity labels It is also used for machine
[22:48] text generation and even question answering
[22:59] specific data sets Now let us see how to install
[23:08] package manager to download install and manage
[23:13] space tokenizers to install it With that we can
[23:20] We already saw how to install a library on Google
[23:27] pip space install space tokenizers to install it
[23:36] package from the hugging face data sets repository
[23:44] install from the GitHub repository Type pip space
[23:51] it Now let us see how to install tokenizers
[24:02] again So here is our Google Colab We already
[24:09] We can install the tokenizer library here itself
[24:13] But let me create a new Python
[24:18] notebook Now let us type the command
[24:30] space tokenizers and click on
[24:40] Now the tokenizers library will get
[24:42] installed You can also save
[24:46] this As I told before it will create a Python
[24:59] name And this is our Python notebook Okay We will
[25:09] work on the use cases of hugging face So guys
[25:17] saw its purpose as well as the use cases With
[25:23] on Google Colab In this lesson we will learn
[25:31] we will also learn how to create it Let us start
[25:42] characters This is mainly used to access hugging
[25:50] key and hugging face access token are the same
[25:57] access token that is an API key With that we will
[26:06] Also we will understand that when the hugging
[26:14] we will learn how to create an API key Let us
[26:22] an access token in hugging face Now let us see
[26:29] it is When you're using a private or gated model
[26:38] access token You must have heard about metas lama
[26:46] authenticate That means you need to create an API
[26:53] hugging face inference API then you need an access
[27:01] models or data sets or even spaces to the hugging
[27:10] when do you not need a hugging face access token
[27:15] are publicly available to download and use you
[27:23] if you're using the models via the transformers
[27:28] token These are publicly available and can be
[27:33] without any API key Also a lot of open source
[27:40] you don't need an API key You don't need an access
[27:45] upcoming lessons we'll be working on these public
[27:50] need to create a hugging face access token Now
[27:57] token So we will go to the hugging face website
[28:05] start Open the official website huggingface.co
[28:11] /join and press
[28:15] enter So here it is you need to join that means
[28:25] you can use your email address So let me create my
[28:35] id Now enter the password Here it is Now
[28:45] username Add your name You can also
[28:54] optional LinkedIn profile also You
[28:58] click Also you can add your GitHub
[29:10] As you can see these are optional Click
[29:17] account We have created an account
[29:23] for a confirmation link Now your account is
[29:27] verified Your email address has been verified
[29:36] Click on your profile Go below It's written
[29:47] need to create a new token by clicking here
[29:52] anyone Create new token Add the token name
[30:03] below click create token The key created
[30:16] Here it's written save it somewhere safe You will
[30:21] model Click done Now all your keys are visible
[30:31] And when you'll click here you can edit it
[30:35] it Okay we saw what are access tokens or API
[30:44] how to create it In this lesson we will learn
[30:51] For that we will use the datasets library Let
[30:59] structured data which can be used for training
[31:05] So hugging face is having a lot of data sets on
[31:12] cases like NLP We will use the datasets library
[31:20] see First let us see the data sets Go to the
[31:30] the data sets provided by hugging face You
[31:35] download it So we will go to the same platform
[31:40] tutorial Here it is Okay So
[31:49] created In this first we installed the
[31:58] to install it on Google Colab using the
[32:05] set using the load data set function This
[32:15] hugging face hub or load them from local
[32:21] the hugging face hub right now Here it is Okay
[32:30] I'm printing the data set using the print method
[32:38] This provides access to various public data sets
[32:44] IMDB dataset The IMDB dataset contains movie
[32:51] sentiment classification When you'll run it will
[32:58] Here we are printing the data set This will split
[33:07] it will display an overview of the data
[33:11] each split Let us see after running Here
[33:19] the IMDb data set as data set dictionary which
[33:27] The train contains 25k rows with features text
[33:35] positive or negative Here for test that is 25k
[33:44] It contains 50k rows but this plate typically
[33:49] It's often used for tasks like pre-training or
[33:55] download a data set In this lesson we will learn
[34:02] us see So to download we will use the transformers
[34:08] from the hugging face hub So let us see a
[34:17] hugging face We will use the transformers library
[34:26] VS code We already created a notebook file open
[34:36] already In this what we did first we installed
[34:45] that hugging face developed this library So we
[34:52] that what we did here we downloaded a model using
[35:02] pre-trained method for this This method downloads
[35:08] from the hugging face hub We are downloading a
[35:16] what we will get we ran this and we got the shape
[35:26] where each token in a sequence is represented
[35:33] BERT hyphen base uncased model and pass the input
[35:45] shape represents the tensor dimensions For this
[35:52] following Here one is visible Okay it
[36:02] input sentence Seven is the sequence length
[36:09] hello hugging face including special tokens
[36:14] face 768 is the hidden size Each token
[36:24] vector standard for BERTs base architecture In
[36:31] using the transformers library with Google
[36:38] implement sentiment analysis with hugging
[36:44] analysis with its type After that we will run
[36:55] So we already discussed the transformers library
[37:00] for task like sentiment analysis Now what is
[37:06] determining the sentiment expressed in a piece of
[37:14] say I love cricket So this is a positive sentence
[37:22] that is a negative sentiment Similarly when I'll
[37:30] will be more clear First one is polarity detection
[37:37] product is positive Obviously the service is
[37:42] the things are not clear it will be neutral like
[37:48] detection Let's say you said this is not good
[37:57] anger And joy is expressed by a sentence like I'm
[38:05] includes happiness frustration and other emotions
[38:17] sentiment towards a specific product or service
[38:22] slow In this case the food is having a positive
[38:29] good it is a negative sentiment Then the intent
[38:37] complain Let's say you said where can I buy this
[38:45] the types of sentiment analysis Now let us see the
[38:54] So we won't be creating an access token
[39:00] told we don't need it We will run the code
[39:05] change the runtime on Google Colab So I'll
[39:12] start Here is our Google Colab
[39:19] Open notebook I already created
[39:26] analysis Here it is So for efficiency we can
[39:39] Here click change runtime type Okay We can see
[39:48] If your project is quite complex or you are
[39:56] the V2-8 TPU also I'll keep the same Okay So
[40:04] the required libraries that is transformers
[40:11] discussed how to install it in the previous
[40:17] cell In this we imported the necessary modules in
[40:28] pipeline The pipeline function provides
[40:35] including sentiment analysis You can load a
[40:42] So here what we did we loaded the following
[40:53] analysis Since we have loaded the sentiment
[41:00] sentiment of a piece of text So here I love
[41:06] text and I hate when Virat Kohli misses a
[41:10] a positive sentence and this is a negative
[41:15] the sentiment analysis Here the output you
[41:22] is Here each dictionary contains the sentiment
[41:31] and the confidence score So here we have analyzed
[41:40] to the sentiment analyzer Now let us understand
[41:47] of the hugging face sentiment analysis pipeline
[41:54] that the model assigns to the predicted sentiment
[42:02] the given text corresponds to the predicted
[42:08] one As you can see the score closer to one means
[42:14] the score was closer to zero that would have mean
[42:20] label positive indicates that the model predicts
[42:27] the following The negative means the opposite
[42:34] be wondering why the score is so high close to
[42:39] been fine-tuned on a large data set and is
[42:47] The input text likely contains strong unambiguous
[42:54] the sentiment with high confidence like hate
[43:01] this way guys we can work on sentiment analysis
[43:09] how we can use the hugging face for text
[43:16] what is text classification With that we will also
[43:23] text classification After that we will create and
[43:35] classification as the name suggests can be used
[43:42] have seen that some emails go to spam some emails
[43:48] can also classify news articles or documents like
[43:55] related article under the technology category
[44:00] intent detection like to cancel an order to book
[44:08] covered the sentiment analysis So here is the
[44:15] classification As the name suggest sentiment
[44:23] sentiment Let's say positive sentiment for a
[44:32] labels for text classification depends on the
[44:39] spam or different topics with that For sentiment
[44:46] negative or neutral Some use cases include
[44:53] classification under sentiment analysis one of the
[45:04] us see a coding example where we will detect spam
[45:15] available model that is the following So we won't
[45:24] this So let us see the example and classify
[45:30] Colab We created these notebooks till now Let
[45:38] notebook So here it is We already created it
[45:48] the required libraries that is to begin with
[45:56] as the torch library So we have used the pip
[46:07] that we will import the necessary modules
[46:15] Then we have loaded a pre-trained spam detection
[46:21] available So we did not applied any key for it
[46:30] performing the spam detection So first we have
[46:36] these text are spam or not spam We have classified
[46:43] Here it is We have mapped labels to spam and not
[46:52] spam Neutral means not spam Positive means not
[46:59] for in loop Here it is What will happen a score
[47:11] will also include the label whether the text is a
[47:17] visible These are the confidence scores Here it is
[47:27] obviously because it is showing congratulations
[47:33] here to claim Now the second one is not a spam
[47:38] at 12 p.m So obviously this is not a spam The
[47:48] a lot of such spam emails that your Gmail account
[47:55] is displaying the score Low confidence scores
[48:04] predictions The following model is fine-tuned for
[48:13] spam detection We are still adapting it for spam
[48:21] spam but the confidence score is even less than
[48:28] indicate that the model is uncertain about
[48:34] here from the hugging face Here we are showing an
[48:43] library on hugging face to detect spam that is
[48:52] will understand how to perform text summarizations
[48:58] why we need to summarize and then we will see a
[49:06] Let us start The hugging face transformers
[49:13] task that includes summarizing text as well So
[49:22] in a lot of real world applications You must
[49:29] snippets With that summarizing documents or
[49:37] concise responses With that you can extract key
[49:45] large data sets also Now let us see an example
[49:52] publicly available on hugging face So we don't
[50:00] run the code on Google Colab like we saw before So
[50:07] will open our code file Open notebook So here we
[50:17] code First what we did we installed the required
[50:30] as well as the PyTorch library here using the pip
[50:36] command before After that we will use automodel
[50:46] for more control over the process so that we
[50:52] this is what we have done here Here we have
[50:58] summarization So here we have set the input
[51:05] summarize this First we have tokenized the
[51:14] you can see some parameters These parameters
[51:22] Max_length is the maximum number of tokens
[51:28] summary will be no longer than 512 tokens
[51:37] generate the summary we have used the generate
[51:41] input the following tokenized Then the
[51:46] of tokens in the summary This is the
[51:53] Length penalty What is this this encourages
[52:01] That means longer summaries Num beams controls
[52:08] quality but slow down inference Here we have
[52:15] decoding Okay So here was our input and this is
[52:26] we have summarized it Okay So in this way guys
[52:35] can summarize text easily In this lesson we will
[52:43] hugging face that is textto text generation Let us
[52:52] face transformers library Some models are already
[52:59] includes let's say translating English text to
[53:06] requires a task prefix to specify the type of task
[53:14] Textto text generation includes not only
[53:20] question answering and even sentiment
[53:25] between text to text and text generation So
[53:32] text generation where the model generates text
[53:38] systems text completions and others The text
[53:45] tosequence task where the model will take an
[53:51] like your text summarization paraphrasing and even
[53:59] translation using the hugging face transformers
[54:08] is publicly available on hugging face This model
[54:14] used for task like summarization translation and
[54:20] on Google Colab Here is a Google Colab We just
[54:27] open Now let us open the
[54:42] First we will install the required libraries that
[54:49] install command We already saw this command
[54:56] translation model that is here we have loaded
[55:04] model that can handle translation
[55:12] specific prompt So we are loading a T5 model
[55:18] here Here we have prepared the input text So this
[55:32] to Spanish That is the following text will get
[55:41] ids that the model can process Use the model to
[55:50] the generation process with parameters like
[55:57] lesson also Here the output tokens will be
[56:04] the translated text So here is the output
[56:12] I love cricket So here it is translated to
[56:19] translation In this lesson we will understand how
[56:27] We will also see an example Let us start So we
[56:34] face for performing question answering task
[56:42] we will use the following model which
[56:46] So we don't need to create an access token for
[56:59] So here we will open our
[57:00] code First we will install the required
[57:12] same pip install command which we saw
[57:18] After that we will load a pre-trained QA
[57:28] tokenizer prepare the input for QA task
[57:36] we need a context as well as a question What
[57:41] where the answer might be found that is the
[57:47] here is the question So this is about me and
[57:52] to answer Okay So we have said both After
[57:58] the context and question using the tokenizer
[58:05] Pass the tokenized input to the model
[58:13] It will extract the start and end scores
[58:16] also Okay it will get the most likely start and
[58:28] to convert token ids back to words so that the
[58:38] set here and it will be decoded back to words
[58:44] was where Amit Diwan is based The context was
[58:52] this way guys we can perform question answering
[59:00] can perform text to image using hugging
[59:08] So here we will use the hugging face diffusers
[59:16] model also which is one of the most popular text
[59:24] Now what is the diffusers library and stable
[59:29] Python library to focus on diffusion models for
[59:36] These are a class of generative models only
[59:44] diffusion it is a latent diffusion model
[59:50] So you can generate images from text prompts
[59:58] generative model Let us see the example here Here
[1:00:08] face Let us see the example and convert text to
[1:00:18] on Google colab itself So let us see here is our
[1:00:27] image
[1:00:30] Here it
[1:00:34] is First we will install the required libraries
[1:00:45] discussed So now we will load the stable
[1:00:54] provides a stable diffusion pipeline that makes
[1:01:01] We will load the stable diffusion model here
[1:01:08] generate an image by passing a text prompt to the
[1:01:14] a futuristic cityscape at sunset The following
[1:01:25] This image will get saved on Google Colab
[1:01:31] also print image saved as generated
[1:01:38] generated Okay where it will be visible
[1:01:44] files Now I'll run it
[1:01:56] I'll run
[1:01:56] it I'll run this now
[1:02:22] Now I'm running to generate an image and save
[1:02:24] it Okay So here is our image It's
[1:02:37] dotpng Okay So it generated it I'll just go here
[1:02:43] From here you can download it You
[1:02:48] download It downloaded Okay Here it is So
[1:03:08] In this lesson we will understand how to perform
[1:03:14] text to video synthesis We will understand what
[1:03:21] let us start Text to video includes generating
[1:03:28] text and generating a video Like we saw in
[1:03:33] a text and generated an image In this case
[1:03:40] pre-trained models and tools for generating
[1:03:46] The text to video synthesis term I just told it
[1:03:54] a textual description Since it's a complex task
[1:04:03] generative models or even diffusion models Okay
[1:04:08] It is used for generating images or videos Let
[1:04:14] moving towards the example one of the most
[1:04:20] for video generation and editing Mostly for AI
[1:04:28] deep minds perceiver IO can also be used to
[1:04:35] include text even images and even videos You need
[1:04:42] that you can build pipelines for generating
[1:04:48] will use the diffuser library also We already
[1:04:53] source library developed by hugging face and used
[1:05:01] the publicly available stable division model
[1:05:09] Colab like we saw before Let us start Here is
[1:05:18] notebook We will open our notebook for text to
[1:05:25] is First we will install So here we have used the
[1:05:35] well as the diffusers library also with PyTorch
[1:05:43] here we are loading it This is the model I already
[1:05:52] load a pre-trained text image model like stable
[1:05:59] set the prompt Here we will generate individual
[1:06:06] the text description A futuristic cityscape at
[1:06:13] frames using the for in loop Here it is 10 and
[1:06:22] CV library to stitch the frames into a video Here
[1:06:32] so that we can stitch it We have also used the
[1:06:40] So this will save frames as images and this will
[1:06:48] will display the output which is gathering the
[1:06:56] be displayed like this in a form of frames So
[1:07:03] because we are generating 10 frames here and
[1:07:10] So here is the output The output video will have
[1:07:16] also generate frames How many frames 10 frames
[1:07:23] Frame i the value of i So the frames would be
[1:07:34] until 9 that means 10 frames and the output
[1:08:21] Now we will click here and here you can see I told
[1:08:32] and output video will be here So this was the
[1:08:42] It downloaded right-click and
[1:08:44] open Here is our video Okay You can see 10
[1:08:51] frames So in this way guys we can generate
[1:09:06] for watching the video guys If you like the video
[1:09:13] by subscribing and joining Click on the Join
[1:09:19] clicking join here and you can also go to any
[1:09:26] dots and click thanks You can also directly
⚡ Saved you time reading this? Transcribe any YouTube video for free — no signup needed.