Find LLM to run on single gpu with only 8 GB ram
I have a single nvidia gpu with 8 GB of ram.  I’m running it on an ubuntu server 18.04 LTS.  I’m able to pass queries and get response from flan-T5, but when I tried performing peft with lora I got a “gpu out of memory” error.  Similarly I tried running camel-5b and llama2-7b-chat as chat agents, and both threw a “gpu out of memory error.”  I’m trying to experiment with LLM, learn the structure of the code, prompt engineering.  Ultimately I’d like to develop a chat agent with llama2-70b-chat even if I have to run it on colab.  can anyone suggest a similar structure LLM to llama2-7b-chat that might be able to run on my single gpu with 8 gb ram?
2024-03-16T16:23:29Z
Hello,Do you find any good models, I am facing the same hardware limitations as you.So please tell me some good ones if you find any.Thanks.
2024-03-16T20:09:58Z
Hi@scotsditchand@knt21,If you want to fine-tune the model then use phi-2 Small language model. It’s quite impressive. If you want to use LLM then use quantized versions of actual LLM which takes very less space. I like this modelTheBloke/openchat-3.5-0106-GPTQ · Hugging Facewhich is just 4.16 GB in total. Check the leadership board to see which model is the best and then choose the quantized version of it.
2024-03-17T16:59:02Z
Hello thank you, I’m looking for a model to generate response in RAG system and I’m kind of more concerned about the model takes up in ram rather than model size, also can you just guide me how to select a model from huggingface, I mean even if I narrow down a bit on the basis of license, language, task, etc there are sometimes still thousands or hundreds of choices and also how do I select on MTEB leaderboard (same issue lots of choices) ,I’ll appreciate if you gudie me on that.Thanks again.
2024-03-17T17:20:05Z
I built RAG and used same model which I suggested. It was working smooth with some prompt engineering. You are talking about the generative model and referring to Embedding space MTEB. MTEB leaderboard is for embedding models.How did I choose the model:Add filter on Open LLM leadership board:Open LLM Leaderboard - a Hugging Face Space by HuggingFaceH4If you want to see the model’s performance on your data then you can use this Arena (quick test):LMSys Chatbot Arena Leaderboard - a Hugging Face Space by lmsys
2024-03-17T18:02:38Z
Oh thank you very much, I’ll try your advice.Again thanks for taking out your valuable time.I think also Text or Text2Text will work better? Because I tried to use Text2Text with index.as_query_engine method and it returned me error (I forgot what it was I guess  llm has no attribute Metadata).Also when I download Textgen models with Transformers library and it doesn’t fit with the index.as_query_engine but when I download it with HuggingFaceLlm it works.
2024-03-17T21:32:18Z
Hmm, I think you are referring llamaindex library. If so, I have not used it in my implementation rather I used the Gen model from huggingface itself.You can refer toLLM-demo/Zephyr_LLM.ipynb at main · mit1280/LLM-demo · GitHub. It’s not gen implementation but if you change themessagesthen it should work for your use case. I am thinking of creating an end-to-end RAG tutorial meanwhile you can get started with the above code.
2024-03-18T02:01:05Z
Oh alright, thank you and alsohow to identify quantized version of these huge models from huggingface which i can download via transformers library?I mean hint or something in namne (for example, for instruct models we have instruct or it written in name).yes many times when using these models I get error for accelerate library but I have downloaded it, even i can import it on my notebook but the huggingface will not detect it, I even tried restarting kernel, re-installation, etc.and after we have downloaded model via transformers library, do we have any function or some other way by which we can get the prompt template, other than the model card?
2024-03-20T11:02:52Z
I will try to share demo code in this weekend hopefully.
2024-03-21T22:44:32Z
here you go@knt21RAG_TUTORIAL/Tutorial_RAG.ipynb at main · mit1280/RAG_TUTORIAL · GitHub.It’s very basic implementation so you need to update prompt and the way data is divide into chunks and other stuff too. This will give you basic idea about how you can use it.
2024-03-22T02:08:28Z
Thanks for thisI’ll look into it meanwhile I am also trying to download quantized model by myself.