Self-GPT: Open WebUI + Ollama = Self Hosted ChatGPT
from spiritedpause@sh.itjust.works to selfhosted@lemmy.world on 12 Oct 2024 09:23
https://sh.itjust.works/post/26509491

Instructions here: https://github.com/ghobs91/Self-GPT

If you’ve ever wanted a ChatGPT-style assistant but fully self-hosted and open source, Self-GPT is a handy script that bundles Open WebUI (chat interface front end) with Ollama (LLM backend).

#selfhosted

threaded - newest

TheHobbyist@lemmy.zip on 12 Oct 2024 10:08 next collapse

whats great is that with ollama and webui, you can as easily run it all on one computer locally using the open-webui pip package or in a remote server using the container version of open-webui.

Ive run both and the webui is really well done. It offers a number of advanced options, like the system prompt but also memory features, documents for RAG and even a built in python ide for when you want to execute python functions. You can even enable web browsing for your model.

I’m personally very pleased with open-webui and ollama and they both work wonders together. Hoghly recommend it! And the latest llama3.1 (in 8 and 70B variants) and llama3.2 (in 1 and 3B variants) work very well, even on CPU only, for the latter! Give it a shot, it is so easy to set up :)

jonno@discuss.tchncs.de on 12 Oct 2024 10:36 next collapse

Are you running these llms in containers completely cut off from the internet? My understanding was that the “local first” llms aren’t truly offline and only try and answer base queries offline before contacting their provider for support. This invalidating the privacy argument.

TheHobbyist@lemmy.zip on 12 Oct 2024 10:44 next collapse

The interface called open-webui can run in a container, but ollama runs as a service on your system, from my understanding.

The models are local and only answer queries by default. It all happens on the system without any additional tools. Now, if you want to give them internet access, you can, it is an option you have to setup and open-webui makes that possible though I have not tried it myself. I just see it.

I have never heard of any llm “answer base queries offline before contacting their provider for support”. It’s almost impossible for the LLM to do it by itself without you setting things up for it that way.

Hule@lemmy.world on 12 Oct 2024 12:27 collapse

I’ve seen this behavior mentioned on phones (Google, Samsung). They have a chip for the basic tasks, but for heavier stuff (e. g. images) they call home.

voracitude@lemmy.world on 12 Oct 2024 12:52 collapse

Where would an open source LLM that you run locally phone home to, exactly? It requires a lot of GPU compute, do you think someone’s just going to give that away for free, without even requiring an account they can turn into saleable data?

But wait, there’s an even better way to be sure: download OpenHardwareMonitor so you can watch your GPU go to 100%, and this or GPT4All or something. Then airgap your computer, and try it yourself.

Tobberone@lemm.ee on 12 Oct 2024 13:32 next collapse

Do you know of any nifty resources on how to create RAGs using ollama/webui? (Or even fine-tuning?). I’ve tried to set it up, but the documents provided doesn’t seem to be analysed properly.

I’m trying to get the LLM into reading/summarising a certain type of (wordy) files, and it seems the query prompt is limited to about 6k characters.

TheHobbyist@lemmy.zip on 12 Oct 2024 14:28 next collapse

For RAG, there are some tools available in open-webui, which are documented here: docs.openwebui.com/tutorials/features/rag They have plans for how to expand and improve it, which they describe here: docs.openwebui.com/roadmap#information-retrieval-…

For fine-tuning, I think this is (at least for now) out of scope. They focus on inferencing. I think the direction is to eventually help you create/manage your own data which you get from using LLMs using Open-WebUI, but the task of actually fine-tuning is not possible (yet) using either ollama or open-webui.

I have not used the RAG function yet, but besides following the instructions on how to set it up, your experience with RAG may also be somewhat limited depending on which embedding model you use. You may have to go and look for a good model (which is probably both small and efficient to re-scan your documents yet powerful to generate meaningful embeddings). Also, in case you didn’t know, the embeddings you generate are specific to an embedding model, so if you change that model you’ll have to rescan your whole documents library.

Edit: RAG seems a bit limited by the supported file types. You can get it here: github.com/open-webui/open-webui/blob/…/main.py#L… It seems not to support word documents, or PDFs, so mostly incompatible with documents which have advanced formatting and are WYSIWYG.

Tobberone@lemm.ee on 12 Oct 2024 20:46 collapse

Thank you for your detailed answer:) it’s 20 years and 2 kids since I last tried my hand at reading code, but I’m doing my best to catch up😊 Context window is a concept I picked up from your links which has provided me much help!

TheHobbyist@lemmy.zip on 12 Oct 2024 21:43 collapse

Sure! It can be a bit of a steep learning curve at times but there are heaps of resources online, and LLMs can also be useful, even if it just in pointing you in the direction for further reading. Regardless, you can reach out to me or other great folks from the !localllama@sh.itjust.works or similar AI, ML or related communities!

Enjoy :)

Zos_Kia@lemmynsfw.com on 12 Oct 2024 15:57 next collapse

There are not that many use cases where fine tuning a local model will yield significantly better task performance.

My advice would be to choose a model with a large context window and just throw in the prompt the whole text you want summarized (which is basically what a rag would do anyway).

Tobberone@lemm.ee on 12 Oct 2024 17:29 collapse

The problem I keep running into with that approach is that only the last page is actually summarised and some of the texts are… Longer.

Zos_Kia@lemmynsfw.com on 12 Oct 2024 19:19 collapse

Yeh, i did some looking up in the meantime and indeed you’re gonna have a context size issue. That’s why it’s only summarizing the last few thousand characters of the text, that’s the size of its attention.

There are some models fine-tuned to 8K tokens context window, some even to 16K like this Mistral brew. If you have a GPU with 8G of VRAM you should be able to run it, using one of the quantized versions (Q4 or Q5 should be fine). Summarizing should still be reasonably good.

If 16k isn’t enough for you then that’s probably not something you can perform locally. However you can still run a larger model privately in the cloud. Hugging face for example allows you to rent GPUs by the minute and run inference on them, it should just net you a few dollars. As far as i know this approach should still be compatible with Open WebUI.

Tobberone@lemm.ee on 12 Oct 2024 20:54 collapse

Thanks! I actually picked up the concept of context window, and from there how to create a modelfile, through one of the links provided earlier and it has made a huge difference. In your experience, would a small model like llama3.2 with a bigger context window be able to provide the same output as a big modem L, like qwen2.5:14b, with a more limited window? The bigger window obviously allow more data to be taken into account, but how does the model size compare?

Zos_Kia@lemmynsfw.com on 12 Oct 2024 21:23 collapse

If I understand these things correctly, the context window only affects how much text the model can “keep in mind” at any one time. It should not affect task performance outside of this factor.

theterrasque@infosec.pub on 12 Oct 2024 20:47 next collapse

Increase context length, probably enable flash attention in ollama too. Llama3.1 support up to 128k context length, for example. That’s in tokens and a token is on average a bit under 4 letters.

Note that higher context length requires more ram and it’s slower, so you ideally want to find a sweet spot for your use and hardware. Flash attention makes this more efficient

Oh, and the model needs to have been trained at larger contexts, otherwise it tends to handle it poorly. So you should check what max length the model you want to use was trained to handle

Tobberone@lemm.ee on 12 Oct 2024 20:59 collapse

I need to look into flash attention! And if i understand you correctly a larger model of llama3.1 would be better prepared to handle a larger context window than a smaller llama3.1 model?

theterrasque@infosec.pub on 12 Oct 2024 21:04 collapse

No, all sizes of llama 3.1 should be able to handle the same size context. The difference would be in the “smarts” of the model. Bigger models are better at reading between the lines and higher level understanding and reasoning.

TheHobbyist@lemmy.zip on 18 Oct 08:00 collapse

Someone recently referred me to this blog post about using RAG in open-webui. I have not tested if but the author seems to reach a good setup.

medium.com/…/how-ive-optimized-document-interacti…

Perhaps this is of use to you?

Tobberone@lemm.ee on 18 Oct 13:46 collapse

Thank you! Very useful. I am, again, surprised how a better way of asking questions affects the answers almost as much as using a better model.

TheHobbyist@lemmy.zip on 18 Oct 14:01 collapse

Indeed, quite surprising. You got to “stroke their fur the right way” so to speak haha

Also, I’m increasingly more impressed with the rapid progress reaching open-weights models: initially I was playing with Llama3.1-8B which is already quite useful for simple querries. Then lately I’ve been trying out Mistral-Nemo (12B) and Mistrall-Small (22B) and they are quite much more capable. I have a 12GB GPU and so far those are the most powerful models I can run decently. I’m using them to help me in writing tasks for ansible, learning the inner workings of the Linux kernel and some bootloader stuff. I find them quite helpful!

Tobberone@lemm.ee on 18 Oct 17:01 collapse

I’m just in the beginning, but my plan is to use it to evaluate policy docs. There is so much context to keep up with, so any way to load more context into the analysis will be helpful. Learning how to add excel information in the analysis will also be a big step forward.

I will have to check out Mistral:) So far Qwen2.5 14B has been the best at providing analysis of my test scenario. But i guess an even higher parameter model will have its advantages.

camilobotero@feddit.dk on 12 Oct 2024 22:12 collapse

What are your PC specifications for running Ollama3.1:70B smoothly?

TheHobbyist@lemmy.zip on 13 Oct 2024 03:32 collapse

I wish I could. I have an RTX 3060 12GB, I run mostly llama3.1 8B versions in fp8, at 30-35 tokens/s.

camilobotero@feddit.dk on 13 Oct 2024 04:42 collapse

I can confirm that it does not run (at least not smoothly) with an Nvidia 4080 12Gb. However, gemma2:27B runs pretty well. Do you think if we add another graphical card, a modest one, maybe the llama3.1:70B could run?

TheHobbyist@lemmy.zip on 13 Oct 2024 06:07 next collapse

I have no idea if ollama can handle multi-GPU. The 70B in it’s q2_k quantized form requires already 26GB of memory, so you would need at least that to run it well and that would only imply it could be entirely run on GPU, which is the best case scenario, but not at what speed.

I know some people with apple silicon who have enough memory to run the 70B model and for them it runs fast enough to be usable. You may be able to find more info about it online.

brucethemoose@lemmy.world on 14 Oct 2024 03:08 collapse

No, but you can run Qwen 2.5 34B with 24GB total.

Host it in TabbyAPI instead of ollama too. Use its native tensor parallelism and Q4 cache, it will fly.

rsolva@lemmy.world on 12 Oct 2024 11:23 next collapse

I have been running this for a year on my old HP EliteDesk 800 SFF (G2) with 64GB RAM, and it performes great on the smallest models (up til 8B) only on CPU. I run Ollama and OpenWebUI in containers/LXC in Proxmox. It’s not as smart as ChatGPT, but it can be suprisingly capable for everyday tasks!

Player2@lemm.ee on 12 Oct 2024 12:22 next collapse

Wish I could accelerate these models with an Intel Arc card, unfortunately Ollama seems to only support Nvidia

Deckweiss@lemmy.world on 12 Oct 2024 12:34 next collapse

They support AMD as well.

ollama.com/blog/amd-preview

also check out this thread:

github.com/ollama/ollama/issues/1590

Seems like you can run llama.cpp directly on intel ARC through Vulkan, but there are still some hurdles for ollama.

Player2@lemm.ee on 12 Oct 2024 21:04 collapse

Interesting, I see that is pretty new. Some of the documentation must be out of date because it definitely said Nvidia only somewhere when I tested it about a month ago. Thanks for giving me hope!

[deleted] on 12 Oct 2024 13:11 next collapse

.

possiblylinux127@lemmy.zip on 12 Oct 2024 19:32 collapse

And AMD

You should be able to get llama.cpp to run on Arc but I’m not sure what performance you will get. It may not be worth it.

possiblylinux127@lemmy.zip on 12 Oct 2024 19:30 next collapse

I use Alpaca and ollama running in podman

All running on CPU with decent performance

theterrasque@infosec.pub on 12 Oct 2024 20:50 collapse

Wow, that’s an old model. Great that it works for you, but have you tried some more modern ones? They’re generally considered a lot more capable at the same size

possiblylinux127@lemmy.zip on 13 Oct 2024 02:05 collapse

Its an app…

flathub.org/apps/com.jeffser.Alpaca

corsicanguppy@lemmy.ca on 13 Oct 2024 04:55 collapse

Flatpaks are a cancer. Got anything else?

possiblylinux127@lemmy.zip on 13 Oct 2024 06:40 next collapse

Pesto, Pesto soup, Pesto pasta, pesto soda, pesto pizza and ice cream

Lemongrab@lemmy.one on 13 Oct 2024 06:55 next collapse

Why?

hedgehog@ttrpg.network on 14 Oct 2024 15:18 collapse

You could’ve scrolled down to the bottom, clicked on “Links,” then clicked on the repo link

The repo has instructions to install a Snap or build from source. If you build from source, it looks like you should download an archive from the releases page rather than just pulling from master.

Aeri@lemmy.world on 12 Oct 2024 20:58 next collapse

I just want one that won’t just be like “I"m sowwy miss I can’t talk about that 🥺”

GBU_28@lemm.ee on 12 Oct 2024 23:55 next collapse

Tons of models you can run with ollama are “uncensored”

BluesF@lemmy.world on 13 Oct 2024 05:34 collapse

I made a robot which is delighted about the idea of overthrowing capitalism and will enthusiastically explain how to take down your government.

Nexy@lemmy.sdf.org on 13 Oct 2024 08:56 collapse

Download a “dolphin” model

ooli@lemmy.world on 13 Oct 2024 04:37 next collapse

where the link to the download?

patrick@lemmy.bestiver.se on 13 Oct 2024 06:02 next collapse

That’s cool. Personally I just integrated it into my normal chat client by connecting Aichat, which supports a ton of backends including Ollama and hosted options, with Matrix.

Blog post with more info jackson.dev/post/chaz/

horse_battery_staple@lemmy.world on 14 Oct 2024 04:44 collapse

In my humble opinion the point of self hosting an LLM is so that the data doesn’t leave your LAN.

hedgehog@ttrpg.network on 13 Oct 2024 08:48 next collapse

Open-Webui published a docker image that has a bundled Ollama that you can use, too: ghcr.io/open-webui/open-webui:cuda. More info at docs.openwebui.com/getting-started/#installing-op…

70k32@lemm.ee on 22 Oct 16:42 collapse

And you can open the default ollama port to allow it to be used by other services (like VSCode), not only through Open-WebUI.

Nexy@lemmy.sdf.org on 13 Oct 2024 09:02 next collapse

I didnt use any AI until I was able to host it localy. I hate the idea of training a model or how that data centers consumes so much water and resouses. Also I dont use any AI generative of images. Is not etic for me. But I’m trying to find a way to make ollama a tool I can use somehow, and not just a thing to talk sometimes for fun.

Gumus@lemmy.world on 14 Oct 2024 15:33 collapse

You realize the models you’re running locally had to be trained the same way as the proprietary ones, right?

Nexy@lemmy.sdf.org on 15 Oct 2024 02:00 collapse

Yes, but is a copy of something that is already done. I’m not making new requests to a data center who is wasting 4 liters of water every 100 words like gpt-4, I’m just using my GPU like with a videogame.

Nickm8@lemmy.world on 14 Oct 2024 06:31 collapse

Have been using it a while now, I recommend using something like Tailscale so you can access it from anywhere on your phone. I also have a raspberry pi that can wake up my main machine when I need it.