安装llama.cpp遇到的问题

发布时间 2023-11-19 20:24:19作者: tommickey

llama.cpp 在ubuntu环境下编译:

 

1. 下载好模型文件,如 llama-2-7b-chat-hf; Mistral-7B-Instruct-v0.1/ggml-model-f16-q8_0.gguf
2. 建立conda环境 conda create -n llamacpp python=3.10
3. conda activate llamacpp
4. pip install sentencepiece gguf

 

安装好nvidia-smi, nvcc, 下载llama.cpp, 进行编译。

$ git clone https://github.com/ggerganov/llama.cpp
$ cd llama.cpp
$ make LLAMA_CUBLAS=1 LLAMA_CUDA_NVCC=/usr/local/cuda/bin/nvcc

./server -m /mnt/d/llmbak/mistral/Mistral-7B-Instruct-v0.1/ggml-model-f16-q8_0.gguf -c 8192 --port 8501 -mg 0 -ngl 40

 

问题1:

scripts/build-info.sh: 31: Syntax error: end of file unexpected (expecting "then")
make: *** [Makefile:671: common/build-info.cpp] Error 2

问题原因

出现问题的原因是.sh文件是dos格式文件,但是linux的shell需要unix格式的文件

解决方案

  • 转换文件格式
$ sudo apt-get install dos2unix
$ dos2unix <filename>
  • 随后重新运行 sh 文件