-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from mborne/open-webui-proxy
ollama / open-webui - split and add proxy support
- Loading branch information
Showing
9 changed files
with
114 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DEVBOX_HOSTNAME=dev.localhost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# ollama | ||
|
||
Containers running [Ollama](https://hub.docker.com/r/ollama/ollama) | ||
|
||
## Usage with docker | ||
|
||
* Ensure that GPU support is enabled in docker (or adapt [docker-compose.yaml](docker-compose.yaml)) : | ||
|
||
```bash | ||
docker run --gpus all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark | ||
``` | ||
|
||
* To use Ollama CLI : | ||
|
||
```bash | ||
# pull models from https://ollama.com/library | ||
docker compose exec ollama ollama pull llama3 | ||
docker compose exec ollama ollama pull gemma2 | ||
# interactive model | ||
docker compose exec ollama ollama run llama3 | ||
``` | ||
|
||
* To use [Ollama API](https://github.com/ollama/ollama/blob/main/docs/api.md#api) : | ||
|
||
```bash | ||
# list models | ||
curl -sS http://localhost:11434/api/tags | jq -r '.models[].name' | ||
|
||
# pull model from https://ollama.com/library | ||
curl http://localhost:11434/api/pull -d '{ | ||
"name": "llama3" | ||
}' | ||
|
||
# use model | ||
curl http://localhost:11434/api/generate -d '{ | ||
"model": "llama3", | ||
"prompt": "Why is the sky blue?" | ||
}' | ||
``` | ||
|
||
* To create **custom model** from [OLLAMA Modelfile](https://github.com/ollama/ollama/tree/main?tab=readme-ov-file#customize-a-prompt), a sample [models/geoassistant](models/geoassistant/README.md) is available : | ||
|
||
```bash | ||
docker compose exec ollama /bin/bash | ||
ollama create geoassistant -f /models/geoassistant/Modelfile | ||
ollama run geoassistant | ||
# Do you know the most visited museums in Paris? | ||
``` | ||
|
||
## Ressources | ||
|
||
* [ollama](https://github.com/ollama/ollama/tree/main?tab=readme-ov-file#ollama) | ||
* [hub.docker.com - ollama/ollama](https://hub.docker.com/r/ollama/ollama) | ||
* [ollama - API](https://github.com/ollama/ollama/blob/main/docs/api.md#api) | ||
* [mborne/toolbox - cuda-toolkit](https://github.com/mborne/toolbox/tree/master/cuda-toolkit#ressources) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
services: | ||
# https://hub.docker.com/r/ollama/ollama | ||
ollama: | ||
image: ollama/ollama:0.2.6 | ||
container_name: ollama | ||
ports: | ||
- 11434:11434 | ||
volumes: | ||
- ollama:/root/.ollama | ||
- ./models:/models:ro | ||
environment: | ||
#- OLLAMA_DEBUG=1 | ||
- HTTP_PROXY | ||
- HTTPS_PROXY | ||
- NO_PROXY=0.0.0.0,ollama,${NO_PROXY:-127.0.0.1,localhost} | ||
deploy: | ||
resources: | ||
reservations: | ||
devices: | ||
- driver: nvidia | ||
capabilities: ["gpu"] | ||
count: all | ||
labels: | ||
- "traefik.enable=true" | ||
# https://ollama.dev.localhost | ||
- "traefik.http.routers.ollama.rule=Host(`ollama.${DEVBOX_HOSTNAME}`)" | ||
- "traefik.http.routers.ollama.service=ollama-service@docker" | ||
- "traefik.http.services.ollama-service.loadbalancer.server.port=11434" | ||
restart: unless-stopped | ||
|
||
volumes: | ||
ollama: | ||
name: ollama | ||
|
||
networks: | ||
default: | ||
name: devbox | ||
external: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.