LangChain + HuggingFace's Inference API (no OpenAI credits required!)

  Рет қаралды 49,409

Samuel Chan

Samuel Chan

Жыл бұрын

We combine LangChain with GPT-2 and HuggingFace, a platform hosting cutting-edge LLM and other deep learning AI models. This has the added benefit of not incurring any charges since we're not using OpenAI (might as well, seeing we're in a recession right about now) but instead using the GPT-2 model hosted on HuggingFace..
LangChain is a fantastic tool for developers looking to build AI systems using the variety of LLMs (large language models, like GPT-4, Alpaca, Llama etc), as it helps unify and standardize the developer experience in text embeddings, vector stores / databases (like Chroma), and chaining it for downstream applications through agents.
Mentioned in the video:
- Watch PART 1 of the LangChain / LLM series: • LangChain + OpenAI tut...
- Watch PART 2 of the LangChain / LLM series:
• LangChain + OpenAI to ...
- HuggingFace's T5 base finetuned WikiSQL model
huggingface.co/mrm8488/t5-bas...
- HuggingFace GPT2 model
huggingface.co/gpt2
All the code for the LLM (large language models) series featuring GPT-3, ChatGPT, LangChain, LlamaIndex and more are on my github repository so go and ⭐ star or 🍴 fork it. Happy Coding!
github.com/onlyphantom/llm-py...

Пікірлер: 116
@2dapoint424
@2dapoint424 6 ай бұрын
Such informative video. Thanks for sharing this Samuel. Is there a way to download the hugging face models locally and run it without the internet?
@GEORGEBELG
@GEORGEBELG Жыл бұрын
Great content and to the point. Thank you!
@SamuelChan
@SamuelChan Жыл бұрын
Thank you! :)
@SudhakarVyas
@SudhakarVyas Ай бұрын
Thanks for this video! Quick question, Is there any risk of PII leakage in this implementation ? Asking this because we cannot see the model getting downloaded locally.
@Dr_Tripper
@Dr_Tripper Жыл бұрын
Definitely informative for an introduction. I learned something very important about HF. But I did not hear a lot of 'langchain' discussion. I'll check out your other vids to see what you got.
@SamuelChan
@SamuelChan Жыл бұрын
Hey thank you! I also have the Table of Content on the README of this github repo if that could be helpful in navigating the different topics! github.com/onlyphantom/llm-python
@sushmitaraj6948
@sushmitaraj6948 8 ай бұрын
@@SamuelChan I am trying to run the above code but i m getting error - Entering new LLMChain chain... Prompt after formatting: You had one job : Fintech CEO and you dont have to be sarcastic Traceback (most recent call last): File "gpt2.py", line 15, in print(llm_chain.run("Fintech CEO")) File "\AppData\Local\Programs\Python\Python38\lib\site-packages\langchain\chains\base.py", line 114, in run return self({self.input_keys[0]: text})[self.output_keys[0]] File "j\AppData\Local\Programs\Python\Python38\lib\site-packages\langchain\chains\base.py", line 87, in __call__ outputs = self._call(inputs) File "\AppData\Local\Programs\Python\Python38\lib\site-packages\langchain\chains\llm.py", line 63, in _call response = self.llm(prompt, **kwargs) File "\AppData\Local\Programs\Python\Python38\lib\site-packages\langchain\llms\huggingface_hub.py", line 95, in __call__ response = self.client(inputs=prompt, params=_model_kwargs) File "j\AppData\Local\Programs\Python\Python38\lib\site-packages\huggingface_hub\inference_api.py", line 213, in __call__ raise NotImplementedError( NotImplementedError: text/html; charset=utf-8 output type is not implemented yet. You can pass `raw_response=True` to get the raw `Response` object and parse the output by yourself. I have tried using different models but keeep getting the same error.Please help
@cm-a-jivheshchoudhari9418
@cm-a-jivheshchoudhari9418 8 ай бұрын
How to explicitly define length of prompt being generated in this HuggingFaceHub?
@user-jk7io4bi7q
@user-jk7io4bi7q 7 ай бұрын
Definitely informative for an introduction, I agree. BUT it seems that something wrong with "requirements.txt": the components 'distutils', 'torch', 'triton' don't have the right version and last but not least there is no version of 'uvloop' for Windows. Need some help.
@karthikj8969
@karthikj8969 9 ай бұрын
How do you get the full contents without worrying about max_length ??
@saraili3971
@saraili3971 Жыл бұрын
Exactly what I want! Many thanks!
@SamuelChan
@SamuelChan Жыл бұрын
You’re welcome! 😊
@user-of7me2ex3y
@user-of7me2ex3y 3 ай бұрын
very good video for starters 🙂
@Freeguy_01
@Freeguy_01 Жыл бұрын
Hi good video ,have a question: on huggingface llms , do I need to download them on my PC , because I may have some old laptop with little ram to that . Any advice plz
@SamuelChan
@SamuelChan Жыл бұрын
If you are having memory issues, you can change the cache location: export TRANSFORMERS_CACHE=/whatever/path/you/want I have a more detailed video explaining this here: kzfaq.info/get/bejne/p6eme9ZnurTGYp8.html You will need something that can fit your RAM, otherwise you’ll have to do the inference “off machine”. Hope it’s helpful!
@hardtosay123
@hardtosay123 Ай бұрын
thank you man
@jorgefelipegaviriafierro705
@jorgefelipegaviriafierro705 Жыл бұрын
Hi, I have a quick question, first of all thank you for the great content, instantly subscribed, and second, where did you pass in the database in this video? thank you!
@SamuelChan
@SamuelChan Жыл бұрын
Hey thanks a lot! 😊 For databases with LangChain I have a video dedicated to that LangChain + OpenAI to chat w/ (query) own Database / CSV! kzfaq.info/get/bejne/fOBgiq2I38yygH0.html So the idea with langchain is that it’s quite agnostic to the LLM of your choice, you specify it in the call to your chain to use open source LLMs on huggingface instead of OpenAI and the rest of the code pretty much stays the same! :)
@Swaggerdawg
@Swaggerdawg 11 ай бұрын
Does Hugging Face also have credits? So would it stop working if the credits expire? (for image generation)
@SamuelChan
@SamuelChan 10 ай бұрын
It doesn’t work off a “credit” system no. It does require you to sign up but that’s more so to prevent abuse of its inference api / service than to limit you.
@izainonline
@izainonline 10 ай бұрын
How effective its performance compares to openai paid key
@chelciedealmeida9511
@chelciedealmeida9511 Жыл бұрын
Thank you for the video. Do you have an example using T5 with a postgres db?
@SamuelChan
@SamuelChan Жыл бұрын
No, not at the moment but it should be straightforward! The following video might also be helpful when working with a database! kzfaq.info/get/bejne/fOBgiq2I38yygH0.html
@jhhh9106
@jhhh9106 7 ай бұрын
this code is not working now can you please make new video and explain how to use hugging face and langchain
@justinjoseph2366
@justinjoseph2366 Жыл бұрын
Hey, on running the same code given by you, my code is generating a small/single line and then it repeats the same line till it reaches the word limit(100 here)
@SamuelChan
@SamuelChan Жыл бұрын
LLM are by default non-deterministic so you’ll get different results given the same input - you can try tinkering with different settings like temperature etc; or try using a newer version of the model / larger LLMs
@hussienhamza3542
@hussienhamza3542 Жыл бұрын
Hey samuel , Thanks alot for the video , I didn't know before that HF have a free api but quick question , I'm building a project that requires an LLM and i can't pay for the openAi credits , so is the HF free api can do? if the project will have multiple requests and act as chatbot , or is there other way i can get free api for LLM for building applications?
@SamuelChan
@SamuelChan Жыл бұрын
If you can find a second hand 3090 card, or a 4070 card. Both offer great value for GPU deep learning work anyway and sufficient VRAM. Run your LLM on your an open source model hosted on your machine kzfaq.info/get/bejne/p6eme9ZnurTGYp8.html
@sanjay28js
@sanjay28js Жыл бұрын
Hi, I have to query from database. Can you suggest me a way to do a transfer learning to pre trained model
@SamuelChan
@SamuelChan Жыл бұрын
Might be what you’re looking for: LangChain + OpenAI to chat w/ (query) own Database / CSV! kzfaq.info/get/bejne/fOBgiq2I38yygH0.html You could use GPT-3 or just swap it out to any LLM of your choice (look at my other videos on how to load in a locally hosted model for that!) Good luck! :)
@moreshk
@moreshk Жыл бұрын
Great video! any thoughts on which of the open source LLMs are comparable to GPT3.5 or GPT4 in terms of their performance? GPT2 and T5 seem to be too simplistic to be useful
@SamuelChan
@SamuelChan Жыл бұрын
I think the candidates are Llama, Alpaca, Vicuna and Dolly? Having said that, I'm sure my answer would be outdated when I check back in 3-6 months. Meta's OPT-175B is also another choice of course. "We show that OPT-175B is comparable to GPT-3, while requiring only 1/7th the carbon footprint to develop" (huggingface.co/docs/transformers/model_doc/opt) and "OPT-175B is a GPT-3 equivalent model trained by Meta. It is by far the largest pretrained language model available with 175 billion parameters" (ai.facebook.com/blog/democratizing-access-to-large-scale-language-models-with-opt-175b/). I'm in the middle of recording a tutorial of running locally hosted LLM offline that uses OPT-30B, and that itself is a 60GB model. OPT-66B is ~130GB. You need a server with quite substantial RAM and memory, and in the first few times I run it while having my video recording software in the background, the process would crash :( May have to rent a cloud server, run it on that, and then do my screencasting and audio on my linux box separately. But that substantially increase the scope and accessibility of the tutorial so I'm not really keen on that too - viewers won't be able to reproduce the tutorial.
@moreshk
@moreshk Жыл бұрын
@@SamuelChan I think out of the above options Dolly is the only one with Apache 2. Havent got around to trying it out though to see if it is any good. I am waiting for access to GPT4 API and it is quite frustrating to not have a quality LLM API access. Look forward to your next video
@SamuelChan
@SamuelChan Жыл бұрын
@@moreshk did I misunderstand your quality LLM comment? You do not consider gpt3 or gpt3.5 good enough? (hence waiting on the gpt4 api) On open models, to me its a matter of time. I'm not a gambler but if I have to pin down a "most likely outcome", my bet is that there would be two or more open source LLM (not just source code, but also open in its instruction tuning etc) competitive or surpassing proprietary ones. Meta's OPT 175b paper is really worth a read (link in the comment above). I might be wrong of course, but to me that's probabilistically most likely than the alternative outcome. I'd be surprised that a closed source, proprietary one dominates the market in 24 months with no comparable / competitive alternatives.
@moreshk
@moreshk Жыл бұрын
@@SamuelChan I am not an expert, so whatever I saw should be taken with a grain of salt. I am only getting my feet wet atm by following online tutorials such as yours. GPT 3 and 3.5 are good by themselves, but there are specific use cases that seem to need GPT4 API. Teenage AGI is an example, there is another where someone loads many large PDFs and reads data off that. Both will work with 3.5 but the responses will be of lower quality I am told
@SamuelChan
@SamuelChan Жыл бұрын
@@moreshk No I really appreciate it. Thanks for sharing your observations! LLM is still in its early formative years and so I get what you're saying. Been reading a ton of documentation and papers -- fully expecting half of them to be redundant in 12 months, so I'm just as much a beginner in that I'm learning and building on the go (I'm lucky I'm self-employed, so I get to learn and iterate on a self-determined pace) and then sharing these mini projects in these tutorial forms.
@unexpectedworld1410
@unexpectedworld1410 Жыл бұрын
Can we use image-to-text model with this method? How to do this only using api request?
@SamuelChan
@SamuelChan Жыл бұрын
Seems like there are several promising projects on huggingface so I would say yeah it’s definitely possible. You’re doing image to text through the inference API; huggingface.co/models?pipeline_tag=image-to-text
@sharvaripatil970
@sharvaripatil970 11 ай бұрын
How can I use this model for my own dataset for particular domain??
@SamuelChan
@SamuelChan 11 ай бұрын
I cover this throughout the LLM series! :) github.com/onlyphantom/llm-python for the table of content. Part 2,3,6,7,8,9 all demonstrates how you would build LLM apps and workflows with your own data in your own particular domain. Here's part 2 video: kzfaq.info/get/bejne/er9_iMKLlc6lp6M.html -- you can work your way through from part 1 to part 14 too; The entire LLM series is ~8 hours long.
@moslemsamiee6293
@moslemsamiee6293 Жыл бұрын
Hi Thank you so much for your great video. I have a question : Can I use gpt2 in the way that you explained in the video for question answering?
@SamuelChan
@SamuelChan Жыл бұрын
You can use gpt2 for question answering by “prompting” it first. A good video that explains this is in my Cohere tutorial kzfaq.info/get/bejne/q7hpZtyFs63YgGg.html My Guidance tutorial also touches on this technique kzfaq.info/get/bejne/oZp1ncZkx7K1mYk.html
@moslemsamiee6293
@moslemsamiee6293 Жыл бұрын
Thank for your response. Can I use gpt2 + langchain to make question answering over my document using "promting"? Do you have any video about it or do you any tutorial about it?
@SamuelChan
@SamuelChan Жыл бұрын
gpt2 is a text completion model at heart. You can “trick” it into Q&A by doing a few Q&A examples in your prompt so that it continues to emulate that style in its response. The Cohere tutorial I linked to above shows how I approach it :)
@moslemsamiee6293
@moslemsamiee6293 Жыл бұрын
@@SamuelChan Thank you so much Samuel for your responding. I will do it.
@user-ut2fx9wz6z
@user-ut2fx9wz6z Жыл бұрын
can you try llama 70 b with a good prompt?
@SamuelChan
@SamuelChan Жыл бұрын
Not sure what's a good prompt but this is a nice follow up video: kzfaq.info/get/bejne/p6eme9ZnurTGYp8.html and I plan on releasing one with Llama 2 but I just got back from a very long holiday in Japan so would take a while to settle down at work etc before I have time making videos again!
@SD-rg5mj
@SD-rg5mj 11 ай бұрын
hello I was telling you that I have trouble understanding everything well what you explain in this video since first of all I speak bad English but above all I don't know anything about code so I have trouble following but I followed a tutorial that allows to use and automate chatgpt in a Google sheet without touching the code, I was wondering if with this method I could ask chatgpt to describe the images that are in my Google sheet? Thank you Cyril
@SamuelChan
@SamuelChan 11 ай бұрын
hey, yeah you could do that with GPT-4. That would allow you to ask for a description of the images you upload. "We’ve created GPT-4, a large multimodal model (accepting image and text inputs, emitting text outputs) that, while less capable than humans in many real-world scenarios, exhibits human-level performance on various professional and academic benchmarks." www.videogamer.com/cdn-cgi/image/width=845,height=807,fit=crop,quality=80,format=auto,onerror=redirect,metadata=none/wp-content/uploads/image-278.png openai.com/research/gpt-4
@nikhilraj3052
@nikhilraj3052 Жыл бұрын
Hey. A big doubt. I am a student and i am working on a project. I want to create text to sql without no API Key. Here you did use your Huggingface API Key. Is there any way that i can do text to sql without any api key, lets say someone found my api key and leaked the data. I personally wouldnt want to do that. So is there anyway where i dont use any API's and work on the text to sql using NLP or any other methods?
@nikhilraj3052
@nikhilraj3052 Жыл бұрын
I was looking into Bert and all , to be honest i am very new to this area. I am still learning. Could you just help me out?
@SamuelChan
@SamuelChan Жыл бұрын
Hey Nikhil, huggingface’s API is free for a vast majority of use cases until you start running up some big volume, so I’d say that’s the simplest way to get set up. The alternative, if you don’t want to sign up for a huggingface account, is to run the model locally. You’ll download the model (let’s say GPT-2 or a BERT based model) and then run the model offline on your own machine’s GPU (hopefully). Here’s a video tutorial in the LLM series that goes over that process: kzfaq.info/get/bejne/p6eme9ZnurTGYp8.html
@kaimaurin-jones9688
@kaimaurin-jones9688 Жыл бұрын
Hey Samuel, I love the channel! Great videos. I'm working on something that I've been stuck on for weeks now and haven't been able to find a solution for. I'm looking to use a HF Inference Endpoint (one I'm paying for - NOT the free one) as the LLM in a QA chain to ask it questions about documents I pass into it. I've gotten it to work for the free HF inference API, but I can't find a way to make LangChain work with my HF Inference Endpoint. I would appreciate any advice you could offer. Thanks.
@SamuelChan
@SamuelChan Жыл бұрын
What about it is not working? Might need more details to be able to reproduce your problem and attempt some troubleshooting!
@kaimaurin-jones9688
@kaimaurin-jones9688 Жыл бұрын
@@SamuelChan can I send you a message or email you? I could even send a notebook with the exact code and way I envision it working
@SamuelChan
@SamuelChan Жыл бұрын
I’m currently on a months long holiday in Japan (currently in Sapporo, just got here from Hakodate) so I don’t have my work devices with me. I can take a look at it when im back! If you need some urgent help, you could also look at booking an expert by the hour from collective.supertype.ai I work with them and they’re a lovely bunch and very experienced with these kind of LLM consulting work :)
@kaimaurin-jones9688
@kaimaurin-jones9688 11 ай бұрын
@@SamuelChan Thank you!
@Coms_Productions
@Coms_Productions Жыл бұрын
Were allowed to use the Inference API by HF for running our projects, right? Lets say a Discord Chatbot running the GPT-2 API? Or is it all about the license attributed to the HF models?
@SamuelChan
@SamuelChan Жыл бұрын
GPT-2 is open source, so you could download and host this model yourself and not have licensing issues. You can use as much as you need as long as it's being served from your home server / cloud server. Running on HuggingFace API though you'll need to consult their commercial terms based on your usage patterns.
@Coms_Productions
@Coms_Productions Жыл бұрын
@@SamuelChan My PC will not be able to handle running an LLM with its hardware. But I can just download the models onto Google Colab's free tier, right? Like what you did
@SamuelChan
@SamuelChan Жыл бұрын
@@Coms_Productions yeah of course; you can also find a cloud gpu (Paperspace, Gradient, Kaggle, Colab) or something like Modal -- most of these have a great free tier to try out. For longer term usage, buying a graphics card with enough VRAM (3060 is a popular choice) might still be way more economical though -- there are plenty of second hand ones from the crypto mining bust (ex mining rigs). Then get enough RAM on your CPU and turn it into a simple home server.
@Coms_Productions
@Coms_Productions Жыл бұрын
@@SamuelChan Thank you so much 😄, can finally play with these models
@unknownpig5957
@unknownpig5957 Жыл бұрын
Also, i am getting output like this (any idea what are those Entering new LLMChain chain...←[0m Prompt after formatting: ←[32;1m←[1;3mTell me: How does human respiratory system work?←[0m ←[1m> Finished chain.←[0m How does it work? How does it work? How does it work? How does it work? Press any key to continue . . .
@SamuelChan
@SamuelChan Жыл бұрын
You’ll need to do better in the prompt. It is a text completion model so you’ll want to “trick” it into doing Q&A by feeding it examples of Q&A. Some call this prompt engineering or prompt design. You can watch my videos on Cohere and Guidance where I explain this in greater depth. kzfaq.info/get/bejne/q7hpZtyFs63YgGg.html kzfaq.info/get/bejne/oZp1ncZkx7K1mYk.html
@ko-Daegu
@ko-Daegu Жыл бұрын
Can we use stable diffusion this way or Vicuna ? to my understanding LangChain is only dealing with LLM so no Text-to-Img or Sound-to-Text right ?
@SamuelChan
@SamuelChan Жыл бұрын
Your understanding is right. For audio to text you can use Whisper. I have a video on that coming up in 3 days (in final stages of tuning out the idea for bg noise removal etc)! Come back on Monday!
@utk1000
@utk1000 4 ай бұрын
ImportError: cannot import name 'HuggingFace_Hub' from 'langchain' . how tf does it not exist anymore?
@user-rv7gb6xk4f
@user-rv7gb6xk4f Ай бұрын
i think you should try "from langchain_community" instead?
@ggopi767
@ggopi767 Жыл бұрын
Do we need GPU in local in order to run this?
@SamuelChan
@SamuelChan Жыл бұрын
No. But if you are interested in running it locally check out my video on this (large language models running downloaded from huggingface to your machine) specifically: kzfaq.info/get/bejne/p6eme9ZnurTGYp8.html If you have a CUDA-compatible card though, you just need to add a device parameter and its underlying model (PyTorch) will be smart enough to take advantage of your GPU. The video I linked to explained it in more details!
@ggopi767
@ggopi767 Жыл бұрын
@@SamuelChan Okay. Can we run all the models from huggingface hub free version? or can only run light weight models and need to download heavy models like Llama2 when we are using free version in huggingface?
@SamuelChan
@SamuelChan Жыл бұрын
Yeah definitely not all models have a huggingface inference API, you may need to install transformers and host it on your machine if there is no hosted version! For Llama2 model specifically you also need to request and be granted access to the weights too in addition to what I mentioned above! :) ai.meta.com/resources/models-and-libraries/llama-downloads/
@Iffycult
@Iffycult Жыл бұрын
Hey can you make a tutorial for a custom chatbot connected to a pdf which replies on messenger, like a custom chatbot for any business on messenger
@SamuelChan
@SamuelChan Жыл бұрын
Cool idea! The first business I started (2014) was a Slack chatbot, sold 2 years later after a lot of hustle. Built several chatbots during the time running it, never on FB Messenger though.
@Iffycult
@Iffycult Жыл бұрын
@@SamuelChan it would be great if you can make a tutorial on this, im sure people would need it for customer service or general inquiry for their companies!
@SD-rg5mj
@SD-rg5mj Жыл бұрын
hello I would like the generated content to go directly into a Google sheet, could I do it with the API? THANKS
@SamuelChan
@SamuelChan Жыл бұрын
If you’re using python (I assume you are) this is very simple by combining what you already do with another google sheets library. Watch my google api video to get a sense of how working with Google’s api look like. It’s maybe an extra 5 lines of code! :)
@SD-rg5mj
@SD-rg5mj Жыл бұрын
@SamuelChan you say it's not hard but for me it sure will be, I don't know anything about code
@SamuelChan
@SamuelChan Жыл бұрын
Maybe take a look at the docs developers.google.com/sheets/api/quickstart/python I also have some videos on working with Google’s client library + OAuth if prefer a step by step instructions in video. We are all beginners at some point and had to start somewhere! :) you got this!
@SD-rg5mj
@SD-rg5mj Жыл бұрын
​@SamuelChan ok thank you very much, so the easiest way is with face hugging? you don't know any other image to text? hugging face is the best?
@SamuelChan
@SamuelChan Жыл бұрын
With image to text, do you mean OCR? Py-Tesseract perhaps? You wouldn’t need huggingface at all
@kevinehsani3358
@kevinehsani3358 Жыл бұрын
I am duplicating your code and for some strange reasons it says " Did not find huggingfacehub_api_token, please add an environment variable `HUGGINGFACEHUB_API_TOKEN` which contains it, or pass `huggingfacehub_api_token` as a named parameter. (type=value_error)". I regenerated an access token as write and put it directly into code as HUGGINGFACEHUB_API_TOKEN = "hf_wjP.........z" still the same problem!! I have used huggingface before!? Is my variable name wrong?
@SamuelChan
@SamuelChan Жыл бұрын
Hey you can’t add it as a variable directly into the code. You have to set it as an environment variable (EXPORT or the SET in shell) or set it using something like .env and load_dotenv(). The error message says you can also pass huggingfacehub_api_token as a named parameter (python is case sensitive, so make sure you name it as such). But keep in mind that’s not a python variable you create (it seems like you’re doing that) but as a parameter you passed into the function call :)
@kevinehsani3358
@kevinehsani3358 Жыл бұрын
@@SamuelChan Thanks. I had it in .env, the problem was upper case. Thanks again
@fneful
@fneful 8 ай бұрын
waiting for Llama 2 video.
@fintech1378
@fintech1378 Жыл бұрын
how bout gpt 3 and 4?
@SamuelChan
@SamuelChan Жыл бұрын
Both requires an OpenAI account and not open source models :)
@arvindelayappan3266
@arvindelayappan3266 9 ай бұрын
any updates here ... ;-)
@wiktorm9858
@wiktorm9858 Жыл бұрын
Moving video screen to the left corner would make more sense
@SamuelChan
@SamuelChan Жыл бұрын
I’ll give that a try!
@TincoNomad
@TincoNomad Жыл бұрын
Hi, I'm having this error "Error in on_chain_start callback: 'name'" So the answer text is like this Prompt after formatting: You had one job 😡! You're the customer service agent, and you didn't have to be sarcastic > Finished chain. . You were just a good guy. I'm not sure if you're aware of the fact that you're a customer service agent. You're a customer service agent. You're a customer service agent. You're a customer service agent. You're a customer service agent. You're a customer service agent. You're a customer service agent. You're a customer service agent. You It goes into a loop. Does anyone know Why? Some help please
@SamuelChan
@SamuelChan Жыл бұрын
Set a higher penalty for repetition? Dial it all the way up to penalise repetition and see if that’s where the problem is?
@TincoNomad
@TincoNomad Жыл бұрын
@@SamuelChan Thanks, but, what do you mean? 😅 I'm kinda "new". O by the way, when I don't use "Verbose=True" I don't get the "Error in on_chain_start callback: 'name'" message, but the repetition keeps the same . You were just a good guy. I'm not sure if you're aware of the fact that you're a customer service agent. You're a customer service agent. You're a customer service agent. You're a customer service agent. You're a customer service agent. You're a customer service agent. You're a customer service agent. You're a customer service agent. You . You were just a good guy. You were just a good guy. You were just a good guy. You were just a good guy. You were just a good guy. You were just a good guy. You were just a good guy. You were just a good guy. You were just a good guy. You were just a good guy. You were just a good guy. You were just . You were just a good guy. You were a good guy. You were a good guy. You were a good guy. You were a good guy. You were a good guy. You were a good guy. You were a good guy. You were a good guy. You were a good guy. You were a good guy. You were a good guy. You were a good . You're the one who's going to get the job done. You're the one who's going to get the job done. You're the one who's going to get the job done. You're the one who's going to get the job done. You're the one who's going to get the job done. You're the one who's going to get the job done. You
@SamuelChan
@SamuelChan Жыл бұрын
Line 21 is where you set the model parameters :) github.com/onlyphantom/llm-python/blob/main/05_hf.py You want to more harshly penalise the repetition, to discourage the behavior (of repeating the same thing). Might also be interesting to tune the temperature = higher produces more unpredictable, random results, lower produces safer guesses.
@TincoNomad
@TincoNomad Жыл бұрын
@@SamuelChan I reduce the max_lenght to 50, with the first print runs pretty well, but then it duplicates again. 🤷 Error in on_chain_start callback: 'name' Prompt after formatting: You had one job 😡! You're the customer service agent and you didn't have to be sarcastic > Finished chain. . You were just a good guy. I'm not sure if you're aware of the fact that you're a customer service agent. Error in on_chain_start callback: 'name' Prompt after formatting: You had one job 😡! You're the politician and you didn't have to be sarcastic > Finished chain. . You were just a good guy. You were just a good guy. You were just a good guy. You were just a good guy. You were Question. Why the "Error in on_chain_start callback: 'name'" message when using "Verbose=True"?
@SamuelChan
@SamuelChan Жыл бұрын
Can you raise a GitHub issue on that Verbose=True behavior if you suspect there is an issue? That will remind me to check on it when I have time this week (Currently away from my home pc)!
@forheuristiclifeksh7836
@forheuristiclifeksh7836 Жыл бұрын
5:00
@greendsnow
@greendsnow Жыл бұрын
Still more expensive than gpt 3.5 turbo
@SamuelChan
@SamuelChan Жыл бұрын
I'm not sure I follow here. GPT-2 is open source, and huggingface costs nothing except if you choose to upgrade to a paid plan. Whole thing is as free as it gets, without requiring an openai api key
@patrykkosik9729
@patrykkosik9729 Жыл бұрын
@@SamuelChan There are API limits.
@SamuelChan
@SamuelChan Жыл бұрын
Have you run into any API limits? Ive never run into personally and the docs says it may happen only under “very heavy use cases” citing an example of 10k simultaneous requests. How heavy were your workflows before you start hitting limits?
@patrykkosik9729
@patrykkosik9729 Жыл бұрын
​@@SamuelChan There is info even in the pricing. PRO version is limited to 1 milion characters. So the free one is also limited, probably up to 300k char.
@Coms_Productions
@Coms_Productions Жыл бұрын
​@@patrykkosik9729300k per what? Per month? Per account??
@SD-rg5mj
@SD-rg5mj 11 ай бұрын
hello could I send you a pm on your social networks? Thanks
@SamuelChan
@SamuelChan 11 ай бұрын
If it’s a work enquiry, email might be better! You get my email by going to the Channel section and click on “show email” or whatever it’s called.
Understanding Embeddings in LLMs (ft LlamaIndex + Chroma db)
29:22
What are AI Agents?
12:29
IBM Technology
Рет қаралды 119 М.
Smart Sigma Kid #funny #sigma #memes
00:26
CRAZY GREAPA
Рет қаралды 2,7 МЛН
Doing This Instead Of Studying.. 😳
00:12
Jojo Sim
Рет қаралды 20 МЛН
Best KFC Homemade For My Son #cooking #shorts
00:58
BANKII
Рет қаралды 72 МЛН
OpenAI Embeddings and Vector Databases Crash Course
18:41
Adrian Twarog
Рет қаралды 436 М.
The Best Way to Deploy AI Models (Inference Endpoints)
5:47
A language for LLM prompt design | Guidance
43:15
Samuel Chan
Рет қаралды 10 М.
How to Use Hugging Face Inference API
8:06
Fahd Mirza
Рет қаралды 6 М.
What is LangChain?
8:08
IBM Technology
Рет қаралды 183 М.
Лучший браузер!
0:27
Honey Montana
Рет қаралды 1,1 МЛН
Хакер взломал компьютер с USB кабеля. Кевин Митник.
0:58
Последний Оплот Безопасности
Рет қаралды 2,3 МЛН
low battery 🪫
0:10
dednahype
Рет қаралды 1,7 МЛН
Это - iPhone 16!
16:29
Rozetked
Рет қаралды 409 М.