Skip to content

Instantly share code, notes, and snippets.

@metrafonic
Last active March 23, 2023 01:20
Show Gist options
  • Save metrafonic/8402d96a1348208d5857a357e2b77ad7 to your computer and use it in GitHub Desktop.
Save metrafonic/8402d96a1348208d5857a357e2b77ad7 to your computer and use it in GitHub Desktop.
Dalai Docker

Dalai in docker

This docker image will ensure that the models are outside of the image, to reduce its size etc

Running in docker

Create Dockerfile and docker-compose.yml from provided files

Download models and start web server

docker compose build
docker compose run dalai npx dalai alpaca install 7B
docker compose up -d
version: '3.7'
services:
dalai:
build: .
image: metrafonic/dalai
ports:
- 3000:3000
volumes:
- ./models/alpaca:/root/dalai/alpaca
- ./models/llama:/root/dalai/llama
FROM python:3.10-slim-buster
# The dalai server runs on port 3000
EXPOSE 3000
# Install dependencies
RUN apt-get update \
&& apt-get install -y \
build-essential \
curl \
g++ \
git \
make \
python3-venv \
software-properties-common
# Add NodeSource PPA to get Node.js 18.x
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
# Install Node.js 18.x
RUN apt-get update \
&& apt-get install -y nodejs
WORKDIR /root/dalai
# Install dalai and its dependencies
RUN npm install [email protected]
RUN npx dalai alpaca setup
# Run the dalai server
CMD [ "npx", "dalai", "serve" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment