dalai icon indicating copy to clipboard operation
dalai copied to clipboard

🚀 Dockerize dalai

Open bernatvadell opened this issue 1 year ago • 4 comments

I've been playing around with this repository and dockerized the app.

During the process I have refactored a few things. Always respecting the original values to avoid breaking-changes.

If you are interested in maintaining support for this feature, I would recommend publishing the image on dockerhub.

I've also included a docker-compose to ease initial startup and a script in the package.json

The only requirement is to have Docker Engine (or Docker Desktop) installed.

and execute yarn run:docker or npm run run:docker

if the image were published in dockerhub it would be as simple as running:

basic: docker run -p 3000:3000 cocktailpeanut/dalai

specifing model: docker run -p 3000:3000 -e LLAMA_MODEL=7B cocktailpeanut/dalai

mapping volume models to persist: docker run -p 3000:3000 -v models:/home/dalai/models cocktailpeanut/dalai

bernatvadell avatar Mar 14 '23 12:03 bernatvadell

This is awesome! Will have to try this out!

waffletower avatar Mar 15 '23 01:03 waffletower

Good work on this. It worked great, minus some small issues. The models directory still ended up owned by root, hence not writable. As well, the container needed to be rerun a few times before the model properly converted. Otherwise great though! 👍 👍

adampankow avatar Mar 15 '23 14:03 adampankow

great work @bernatvadell!

I'm using Docker Desktop on windows and the final step was crashing for me. it seems like ./dalai has some weird newline that gives

/bin/bash^M: bad interpreter: No such file or directory

clearing it with sed -i -e 's/\r$//' ./dalai did the trick. I suggest you update the file in this PR.

kaminskypavel avatar Mar 16 '23 19:03 kaminskypavel

Interesting, this failed to build for me. Error:

Step 23/26 : RUN yarn install
 ---> Running in dda9e9bf1e29
yarn install v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
error Could not write file "/home/dalai/app/yarn-error.log": "EACCES: permission denied, open '/home/dalai/app/yarn-error.log'"
error An unexpected error occurred: "EACCES: permission denied, mkdir '/home/dalai/app/node_modules'".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
The command '/bin/sh -c yarn install' returned a non-zero code: 1

Fixed locally by adding a chown above the workdir, eg:

RUN mkdir /home/dalai/app && chown -R dalai:dalai /home/dalai/app
WORKDIR /home/dalai/app

leeola avatar Mar 17 '23 23:03 leeola

It would be really nice if the instructions for running this could also work on Fedora, which uses Podman. Compatibility of the container image should not be a problem, but the current directions rely on Docker Compose, which is not well supported by Podman.

evanjrowley avatar Mar 26 '23 18:03 evanjrowley