cocktailpeanut / dalai

The simplest way to run LLaMA on your local machine
https://cocktailpeanut.github.io/dalai
13.09k stars 1.42k forks source link

Error on docker compose run #311

Open klauswr opened 1 year ago

klauswr commented 1 year ago

Following the instructions to use docker compose, I get several error(s) on docker compose run:

full console output:

A:\git\dalai>docker compose run dalai npx dalai alpaca install 7B
[+] Running 1/0
 - Network dalai_default  Created                                                                                  0.1s
mkdir /root/dalai
{ method: 'install', callparams: [ '7B' ] }
2 [Error: EXDEV: cross-device link not permitted, rename '/root/dalai/alpaca/models' -> '/root/dalai/tmp/models'] {
  errno: -18,
  code: 'EXDEV',
  syscall: 'rename',
  path: '/root/dalai/alpaca/models',
  dest: '/root/dalai/tmp/models'
}
3 [Error: EBUSY: resource busy or locked, rmdir '/root/dalai/alpaca'] {
  errno: -16,
  code: 'EBUSY',
  syscall: 'rmdir',
  path: '/root/dalai/alpaca'
}
mkdir /root/dalai/alpaca
try fetching /root/dalai/alpaca https://github.com/ItsPi3141/alpaca.cpp
[E] Pull TypeError: Cannot read properties of null (reading 'split')
    at new GitConfig (/root/dalai/node_modules/isomorphic-git/index.cjs:1604:30)
    at GitConfig.from (/root/dalai/node_modules/isomorphic-git/index.cjs:1627:12)
    at GitConfigManager.get (/root/dalai/node_modules/isomorphic-git/index.cjs:1750:22)
    at async _getConfig (/root/dalai/node_modules/isomorphic-git/index.cjs:5397:18)
    at async normalizeAuthorObject (/root/dalai/node_modules/isomorphic-git/index.cjs:5407:19)
    at async Object.pull (/root/dalai/node_modules/isomorphic-git/index.cjs:11682:20)
    at async Dalai.add (/root/dalai/node_modules/dalai/index.js:394:7)
    at async Dalai.install (/root/dalai/node_modules/dalai/index.js:346:5) {
  caller: 'git.pull'
}
try cloning /root/dalai/alpaca https://github.com/ItsPi3141/alpaca.cpp
next alpaca [AsyncFunction: make]
exec: make in /root/dalai/alpaca
make
exit
root@9f3e4e2910cb:~/dalai/alpaca# make
I llama.cpp build info:
I UNAME_S:  Linux
I UNAME_P:  unknown
I UNAME_M:  x86_64
I CFLAGS:   -I.              -O3 -DNDEBUG -std=c11   -fPIC -pthread -mavx -mavx2 -mfma -mf16c -msse3
I CXXFLAGS: -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC -pthread
I LDFLAGS:
I CC:       cc (Debian 8.3.0-6) 8.3.0
I CXX:      g++ (Debian 8.3.0-6) 8.3.0

cc  -I.              -O3 -DNDEBUG -std=c11   -fPIC -pthread -mavx -mavx2 -mfma -mf16c -msse3   -c ggml.c -o ggml.o
g++ -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC -pthread -c utils.cpp -o utils.o
g++ -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC -pthread main.cpp ggml.o utils.o -o main
./main -h
usage: ./main [options]

options:
  -h, --help            show this help message and exit
  -i, --interactive     run in interactive mode
  --interactive-start   run in interactive mode and poll user input at startup
  -r PROMPT, --reverse-prompt PROMPT
                        in interactive mode, poll user input upon seeing PROMPT
  --color               colorise output to distinguish prompt and user input from generations
  -s SEED, --seed SEED  RNG seed (default: -1)
  -t N, --threads N     number of threads to use during computation (default: 4)
  -p PROMPT, --prompt PROMPT
                        prompt to start generation with (default: random)
  -f FNAME, --file FNAME
                        prompt file to start generation.
  -n N, --n_predict N   number of tokens to predict (default: 128)
  --top_k N             top-k sampling (default: 40)
  --top_p N             top-p sampling (default: 0.9)
  --repeat_last_n N     last n tokens to consider for penalize (default: 64)
  --repeat_penalty N    penalize repeat sequence of tokens (default: 1.3)
  -c N, --ctx_size N    size of the prompt context (default: 2048)
  --temp N              temperature (default: 0.1)
  -b N, --batch_size N  batch size for prompt processing (default: 8)
  -m FNAME, --model FNAME
                        model path (default: ggml-alpaca-7b-q4.bin)

g++ -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC -pthread quantize.cpp ggml.o utils.o -o quantize
root@9f3e4e2910cb:~/dalai/alpaca# exit
exit
4 [Error: EXDEV: cross-device link not permitted, rename '/root/dalai/tmp/models' -> '/root/dalai/alpaca/models'] {
  errno: -18,
  code: 'EXDEV',
  syscall: 'rename',
  path: '/root/dalai/tmp/models',
  dest: '/root/dalai/alpaca/models'
}
alpaca.add [ '7B' ]
dir /root/dalai/alpaca/models/7B
downloading torrent
ggml-model-q4_0.bin 100%[==================================================================================>] done

A:\git\dalai>docker compose up -d
[+] Running 1/1
 - Container dalai-dalai-1  Started
pierrbt commented 1 year ago

I've got the same error, Debian 11 on amd64.

camigira commented 1 year ago

I've got a similar warning and not 100% sure how to fix it but not really concerned at this point as I got it running anyway... I think the warning is just Node.js complaining about different file systems (host vs container), in my case:

Host (my machine): uname -m -> arm64 Container: uname -m -> aarch64

if you double-check, a new folder ./models has been created in your cloned repo and this has been mapped to your container.

You can check by running: ls models/alpaca in your machine and then compare with the running container:

  1. docker ps to get the Container _ID
  2. docker exec -it Cntainer_ID_Here /bin/bash
  3. ls alpaca/
  4. You should be able to see the model also here: ls alpaca/models/7B/

image

image

camigira commented 1 year ago

here my 2 cents to hopefully make it easier to start/stop: https://github.com/cocktailpeanut/dalai/pull/317

fabianhick commented 1 year ago

It might be the case, that your system is SELinux enabled. For me adding the :Z option to the volume mounts in the docker-compose.yml did the trick. For more details, see here: https://docs.docker.com/storage/bind-mounts/#configure-the-selinux-label

ppxl commented 1 year ago

The same happened to me too (using the docker-compose commands). I also wanted to add that while the model files seem to be build, the UI does start but after giving a prompt no answer is given at all.

mkdir /root/dalai
{ method: 'install', callparams: [ '7B' ] }
2 [Error: EXDEV: cross-device link not permitted, rename '/root/dalai/alpaca/models' -> '/root/dalai/tmp/models'] {
  errno: -18,
  code: 'EXDEV',
  syscall: 'rename',
  path: '/root/dalai/alpaca/models',
  dest: '/root/dalai/tmp/models'
}
3 [Error: EBUSY: resource busy or locked, rmdir '/root/dalai/alpaca'] {
  errno: -16,
  code: 'EBUSY',
  syscall: 'rmdir',
  path: '/root/dalai/alpaca'
}
mkdir /root/dalai/alpaca
try fetching /root/dalai/alpaca https://github.com/ItsPi3141/alpaca.cpp
[E] Pull TypeError: Cannot read properties of null (reading 'split')
    at new GitConfig (/root/dalai/node_modules/isomorphic-git/index.cjs:1610:30)
    at GitConfig.from (/root/dalai/node_modules/isomorphic-git/index.cjs:1633:12)
    at GitConfigManager.get (/root/dalai/node_modules/isomorphic-git/index.cjs:1756:22)
    at async _getConfig (/root/dalai/node_modules/isomorphic-git/index.cjs:5467:18)
    at async normalizeAuthorObject (/root/dalai/node_modules/isomorphic-git/index.cjs:5477:19)
    at async Object.pull (/root/dalai/node_modules/isomorphic-git/index.cjs:11761:20)
    at async Dalai.add (/root/dalai/node_modules/dalai/index.js:394:7)
    at async Dalai.install (/root/dalai/node_modules/dalai/index.js:346:5) {
  caller: 'git.pull'
}
...snip...
g++ -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC -pthread main.cpp ggml.o utils.o -o main 
./main -h
usage: ./main [options]

options:
  -h, --help            show this help message and exit
  -i, --interactive     run in interactive mode
  --interactive-start   run in interactive mode and poll user input at startup
...snip...
root@ac1e8ff673d2:~/dalai/alpaca# exit
exit
4 [Error: EXDEV: cross-device link not permitted, rename '/root/dalai/tmp/models' -> '/root/dalai/alpaca/models'] {
  errno: -18,
  code: 'EXDEV',
  syscall: 'rename',
  path: '/root/dalai/tmp/models',
  dest: '/root/dalai/alpaca/models'
}
...snip...
ggml-model-q4_0.bin 100%[==================================================================================>] done   

I have no clue how to properly debug this, though. Executing the main binary inside the containe with the model file parameter leads to an error:

root@041e7cca0fb1:~/dalai/alpaca# ./main -m models/7B/ggml-model-q4_0.bin -p "hello"
main: seed = 1690266891
llama_model_load: loading model from 'models/7B/ggml-model-q4_0.bin' - please wait ...
llama_model_load: invalid model file 'models/7B/ggml-model-q4_0.bin' (bad magic)
main: failed to load model from 'models/7B/ggml-model-q4_0.bin'