From 4f4c3cf2c4abccbc05026fb978b37557d228f5b4 Mon Sep 17 00:00:00 2001 From: Richard Palethorpe Date: Tue, 16 Apr 2024 16:27:57 +0100 Subject: [PATCH] Add Elia TUI Add an Elia container and a probably incorrect example with it in --- containers/elia/Dockerfile | 7 +-- examples/elia-tui.yaml | 89 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+), 3 deletions(-) create mode 100644 examples/elia-tui.yaml diff --git a/containers/elia/Dockerfile b/containers/elia/Dockerfile index 09d7f19..9c3b14a 100644 --- a/containers/elia/Dockerfile +++ b/containers/elia/Dockerfile @@ -1,9 +1,10 @@ FROM ubuntu:latest RUN apt update -y -RUN apt install pipx -y -RUN pipx ensurepath -y -RUN pipx install git+https://github.com/darrenburns/elia -y +RUN apt install -y --no-install-recommends pipx git-core +RUN pipx ensurepath +RUN pipx install git+https://github.com/darrenburns/elia ENV OPENAI_API_KEY=none +ENV PATH=$PATH:/root/.local/bin CMD ["elia"] diff --git a/examples/elia-tui.yaml b/examples/elia-tui.yaml new file mode 100644 index 0000000..cb04483 --- /dev/null +++ b/examples/elia-tui.yaml @@ -0,0 +1,89 @@ +apiVersion: premlabs.io/v1alpha1 +kind: AIModelMap +metadata: + name: phi-2-chat +spec: + localai: + - variant: base + uri: "l3utterfly/phi-2-layla-v1-chatml-gguf" + # The LocalAI model description. Note that the model is called gpt-4-turbo because Elia has the models hardcoded at the time of writting + engineConfigFile: | + name: gpt-4-turbo + mmap: true + parameters: + model: huggingface://l3utterfly/phi-2-layla-v1-chatml-gguf/phi-2-layla-v1-chatml-Q8_0.gguf + + template: + chat_message: | + <|im_start|>{{if eq .RoleName "assistant"}}assistant{{else if eq .RoleName "system"}}system{{else if eq .RoleName "user"}}user{{end}} + {{if .Content}}{{.Content}}{{end}} + <|im_end|> + chat: | + {{.Input}} + <|im_start|>assistant + completion: | + {{.Input}} + context_size: 4096 + f16: true + stopwords: + - <|im_end|> + - + usage: | + curl http://localhost:8080/v1/chat/completions -H "Content-Type: application/json" -d '{ + "model": "gpt-4-turbo", + "messages": [{"role": "user", "content": "How are you doing?", "temperature": 0.1}] + }' +--- +apiVersion: premlabs.io/v1alpha1 +kind: AIDeployment +metadata: + name: phi-2-chat + namespace: default +spec: + engine: + name: "localai" + options: + imageTag: v2.12.4-cublas-cuda12-ffmpeg + endpoint: + - port: 8080 + domain: "phi-2-chat.127.0.0.1.nip.io" + models: + - modelMapRef: + name: phi-2-chat + deployment: + accelerator: + interface: "CUDA" + minVersion: + major: 7 + resources: + requests: + cpu: 4 + memory: 8Gi + limits: + cpu: 32 + memory: "16Gi" +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: elia +spec: + replicas: 1 + selector: + matchLabels: + app: elia + template: + metadata: + labels: + app: elia + spec: + containers: + - name: elia + image: premai/elia + env: + - name: OPENAI_API_BASE + value: "http://phi-2-chat:8080" + ports: + - containerPort: 3000 + stdin: true + tty: true