NEW Flan-T5 Language model | CODE example | Better than ChatGPT?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello Community today I want to show you my preferred large language model and it is flan T5 so what is flying T5 as you can see here on November 23rd 2022 Google released a new publication scaling instruction fine-tuned language models and they also released here a flan T5 and if you want to read the paper I highly recommend it they tell you all the details about it but you know what I just wanna program it I want to show you how to use this model and maybe even have some sort about the upcoming gpt4 so here we go what we do we have a runtime we change the runtime to zero to leave everybody else who's doing research the GPU so remember we are running here on a CPU only and just to show you this that my CPU count is two so we are really at the smallest CPU available so what we do we install our Transformers yes take some time take some time Transformers yes yes yes from hugging face so how do you start if you have a new language model well easy you go to hugging phase and load the code for your inference we do not want to train the model we remove the high infrastructure for this now we don't have Hopper and video or anything at all we just wanna use it so let's do this hug and face Transformers flan T5 here we go beautiful and you can see hugging fast flan T5 was released but the paper just showed you and you can directly use it this is the code for inference so we say copy we go back yes you know this is over the year and we say thank you and now yeah let's show you that it's really gone yes I know and then we have here our prompt say um explain artificial intelligence that would be nice okay let's do this execute this we're running here of course as you see with the smallest available flan model so if you want to run we are sitting on a bicycle and we are racing against a Ferrari High Performance Tuned cars so you have an idea how we can optimize this further but let's go with the default I want to show you the result if you print then the result tokenizer what is the result you see the model is rather minimum we only have 300 megabyte model that we download and artificial intelligence is a tool used to describe the behavior of a person an interesting version I think a very short version maybe we need some more meat on the bone so you might want a longer output so the question is how can you optimize this here on a free call-up notebook and there are a lot of things you can do let me show you these are my personal set of parameters I am experimenting with this only for less than a week so please I show you my knowledge with you at first I go for a model that has three gigabytes this is the large model this is the largest model I can load on a free collab notebook you remember we have 12 gigabyte RAM CPU Ram I do not use a GPU and there is an XL model from flan T5 but this would be already 10 gigabyte to download and it crashes immediately on my memory so if you go with large this is the largest model you can use on a free collab notebook three gigabytes in about two minutes beautiful we don't have a look at the model configuration that we are downloading but it is the same model you're used with the Transformer you have your model sequence to sequence language model from some pre-trained model you have an auto tokenizer from some pre-trained model remember with T5 you had a specific T5 tokenizer now they recommend to go with an auto tokenizer because not all optimizations are done yet so beautiful no problem at all and then I use here some beam search I want to implement which has a feature called No repeat engram size which specifies that the largest engram that should not be repeated uh default we have three I will set it to two and as you can see here my text is now the same explain artificial intelligence and I will show you the difference the significant difference and even if you go we just go here with large if you have a personal PC and you have I don't know 64 gigabytes uh CPU Ram you can download Excel and Excel gives you even better results but it remember this is three times as big as our large model so beautiful we are still low downloading our Google flan T5 large beautiful beautiful so I can show you some other parameters I want a minimum length of 256 I want a maximum token length in my output sentence of 512 I want to increase the length penalty I want a little bit longer output so I go from one to two now beam search classical beam storage I want to have a number of beams is set default to four I want to go with 16 choose your whatever you like and you have with the beams uh another feature where you can say no repeat diagram size I set it to two it's a very strict one but I don't want to have repeated sentences as an output if I go with 512 tokens I want really a paragraph as an output if you want multiple Alternatives of the text you set the number of return sequences from 1 to 2 or 3 whatever you like early stopping is true yes of course this would be it so I finished downloading here my model yes yes yes it's coming another two megabytes yes are we finished now come on yeah done so my model configuration just to show you the flan T5 here we go if you're interested Google find T5 large architecture is of course the T5 architecture for conditional generation and then you have all the beautiful things here the number of heads 16 the number of layer 24. the maximum distance for the attention is 128 number of buckets word embeddings is false yes yes yes the version you can use beautiful so what I do is now I execute my text explain artificial intelligence as you see a alternative that what is large language model gpd3 and then also add a short introduction to machine learning I will show you the results in a second but as you can see since we are running here on a CPU with only two cores it's gonna take us about four to five minutes no problem at all I'm back with you when the execution of this cell is finished and here we are after three minutes and 40 seconds artificial intelligence is the development of computer programs that are able to perform tasks in a way that would not be possible with human intelligence well I don't know about this yeah it's based on that your computers can learn to do things that human can do and they can do it better than human things they're doing the same things artificial intelligence is used in many areas of science robotics computer vision speech recognition autonomous vehicles robots Internet of Things Mia has also used to improve the quality of life by reducing the number of people that need to travel to work every day as well as lowering their cost of living for the majority of the world's population which is estimated to be around 1.3 billion people in the United States alone no I don't think so according to the U.S Center of this is called troll CDC no yeah has the potential Revolution on many aspects in life combined how we shop the types of food weed where we sleep what kind of music we listen to with the books we read the reviews amount we are sitting in front of the computers like I do now making it easier for us to spend time with our loved ones well maybe with the next version but it is not bad just to show you I did it before and you see it is the same text now for gpd3 is a large language model based on a grammatic structure of tetragrammatically inherent languages so the English French German Italian Spanish Portuguese this is developed University of California okay I thought it was another company but okay is to model destruction semantic of large-scale natural language processing system yeah it's been used in linguistic research for more than 20 years used by linguist computer scientist researchers well language model yeah but large language model has not have not been used for more than 20 years so you see the mistake here it just takes the language model but the scientific term is large language model so he splits it up in the token and looks for language model and then we get such a result okay in computer science teaching and learning a research development of computer assisted learning Cadillac I have no idea so it's a core computer assistant reasoning artificial intelligence and computer programming languages not so bad not so bad machine learning here's the text for you if you want to read it so you got really significant text out of it you have to be careful but it is neutral it is more or less to the point sometimes there are information in there the estimated 1.3 billion people in the US alone this would be a surprise to me also to the United States I suppose so you see but in general I found it to be the most reliable neutral non-polarizing system you can ask here some text some short a few short learning example if you want so give it a try yourself you see these are my optimization I apply and with this simple line of codes you can get amazing results if you compare this to the standard output that is provided if you do not use the reasonable size of the system with a little bit of fine-tuning your code I say thank you I hope you enjoyed it and I see you in my next video
Info
Channel: code_your_own_AI
Views: 18,554
Rating: undefined out of 5
Keywords: LLM, Large Language Models, Flan-T5, T5, Inference, Code, AI, Machine Learning
Id: _Qf_SiCLzw4
Channel Id: undefined
Length: 10min 47sec (647 seconds)
Published: Thu Dec 01 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.