Run ChatGPT-like LLMs on your laptop in 3 lines of code (github.com)
I've been playing around with https://github.com/imartinez/privateGPT and wanted to create a simple Python package that made it easier to run ChatGPT-like LLMs on your own machine, use them with non-public data, and integrate them into practical GPU-accelerated applications.
This resulted in Python package I call OnPrem.LLM.
In the documentation, there are examples for how to use it for information extraction, text generation, retrieval-augmented generation (i.e., chatting with documents on your computer), and text-to-code generation: https://amaiya.github.io/onprem/
Enjoy!
40 comments
[ 4.6 ms ] story [ 82.0 ms ] threadWhat sold me on ChatGPT was its efficacy combined with its ease of use. As the owner of a consultancy, I find time to do technical exploration to be more and more scarce - stuff like this that makes it super easy for me to run an LLM is most welcome.
And... If you'd like a more hands on approach, here is a manual approach to get llama running locally
and a little script like this will get it running swimmingly Enjoy the next hours of digging through flags and the wonderful pit of time ahead of you.NOTE: I'm new at this stuff, feedback welcome.
>We currently support models in GGML format. However, the GGML format has now been superseded by GGUF.
>Future versions of OnPrem.LLM will use the newer GGUF format.
https://github.com/ggerganov/llama.cpp/releases/tag/master-6...
Here is the starting output of running Llama 65B in a gist
https://gist.github.com/zitterbewegung/4787e42617aa0be6019c3...
GGUF is a new format introduced by the llama.cpp team on August 21st 2023. It is a replacement for GGML, which is no longer supported by llama.cpp. The key benefit of GGUF is that it is a extensible, future-proof format which stores more information about the model as metadata.
There's also plenty of other local LLM type tools like GPT4All, LMStudio, Simon Wilsons LLM, privateGPT, and about a million other setups.
By chance, have you checked out Ollama (https://github.com/jmorganca/ollama) as a way to run the models like Llama 2 under the hood?
One of the goals of the project is to make it easy to download and run GPU-accelerated models, ideally with everything pre-compiled so it's easy to get up and running. It's API that can be used by tools like this – would love to know if it would be helpful (or not!)
There's a LangChain model integration for it and a PrivateGPT example as well that might be a good pointer on using the LangChain integration: https://github.com/jmorganca/ollama/tree/main/examples/priva.... There's also a LangChain PR open to add support for generating embeddings, although there's a bit more work to do to support the major embedding models.
Best of luck with the project!
Training your own from nothing is a monumental task, I don't think many of us can realistically do it from scratch.
You can see the actual size from hugging face. For example, https://huggingface.co/WizardLM/WizardLM-7B-V1.0/tree/main
Size with quantization, https://github.com/ggerganov/llama.cpp#quantization
7B = 7 Billions parameters.
If 1 parameter takes 1 byte then a 7B model would be about 7GB in size.
Usually 1 parameter takes 4 bytes tho (a 32-bit float), so it would be aboult 28GB.
You can use 16-bit, 8-bit or even 4-bit float.
Lol but for real today for the first time when browsing new laptops I was looking for high vram because of llm.
Seems like all of these open source wrappers, just as the closed sourced ones, are a race to the bottom.
The focus for Ollama is to make downloading and serving a model easy – there's an included `ollama` CLI but it's all powered by a REST API. Hopefully, it's a way to support really cool applications of LLMs like OP's onprem tool.
OP's tool is more focused on ingesting and analyzing data. There seems to be quite a bit of interesting opportunity as an application of LLMs – e.g. analyzing not only local docs but data in a remote data store.
Is there a library that offers a layer on top of local models that simulates the OpenAI API?