Llama-cpp-python с металлическим ускорением на кремнии Apple не работаетPython

Программы на Python
Anonymous
Llama-cpp-python с металлическим ускорением на кремнии Apple не работает

Сообщение Anonymous »

Я следую инструкциям из официальной документации по установке llama-cpp с поддержкой графического процессора на Apple Silicon Mac.
Вот мой файл Docker:

Код: Выделить всё

FROM python:3.11-slim

WORKDIR /code

RUN pip uninstall llama-cpp-python -y

ENV CMAKE_ARGS="-DLLAMA_METAL=on" FORCE_CMAKE=1

RUN pip install -U llama-cpp-python --no-cache-dir

RUN pip install 'llama-cpp-python[server]'

COPY ./requirements.txt /code/requirements.txt

RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

COPY .  .

EXPOSE 8000

CMD ["panel", "serve", "--port", "8000", "chat.py", "--address", "0.0.0.0", "--allow-websocket-origin", "*"]
Я получаю следующую ошибку:

Код: Выделить всё

[+] Building 6.1s (9/13)                                                               docker:desktop-linux
=> [internal] load build definition from Dockerfile                                                   0.0s
=> => transferring dockerfile: 508B                                                                   0.0s
=> [internal] load metadata for docker.io/library/python:3.11-slim                                    0.9s
=> [auth] library/python:pull token for registry-1.docker.io                                          0.0s
=> [internal] load .dockerignore                                                                      0.0s
=> => transferring context: 2B                                                                        0.0s
=> [1/8] FROM docker.io/library/python:3.11-slim@sha256:90f8795536170fd08236d2ceb74fe7065dbf74f738d8  0.0s
=> => resolve docker.io/library/python:3.11-slim@sha256:90f8795536170fd08236d2ceb74fe7065dbf74f738d8  0.0s
=> [internal] load build context                                                                      0.0s
=> => transferring context: 2.19kB                                                                    0.0s
=> CACHED [2/8] WORKDIR /code                                                                         0.0s
=> CACHED [3/8] RUN pip uninstall llama-cpp-python -y                                                 0.0s
=> ERROR [4/8] RUN pip install -U llama-cpp-python --no-cache-dir                                     5.2s
------
>  [4/8] RUN pip install -U llama-cpp-python --no-cache-dir:
0.410 Collecting llama-cpp-python
0.516   Downloading llama_cpp_python-0.2.57.tar.gz (36.9 MB)
1.023      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 36.9/36.9 MB 99.0 MB/s eta 0:00:00
1.325   Installing build dependencies: started
2.285   Installing build dependencies: finished with status 'done'
2.285   Getting requirements to build wheel: started
2.336   Getting requirements to build wheel: finished with status 'done'
2.340   Installing backend dependencies: started
3.863   Installing backend dependencies: finished with status 'done'
3.864   Preparing metadata (pyproject.toml): started
3.955   Preparing metadata (pyproject.toml): finished with status 'done'
3.996 Collecting typing-extensions>=4.5.0 (from llama-cpp-python)
4.014   Downloading typing_extensions-4.10.0-py3-none-any.whl.metadata (3.0 kB)
4.181 Collecting numpy>=1.20.0 (from llama-cpp-python)
4.201   Downloading numpy-1.26.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.metadata (62 kB)
4.202      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.3/62.3 kB 96.9 MB/s eta 0:00:00
4.242 Collecting diskcache>=5.6.1 (from llama-cpp-python)
4.261   Downloading diskcache-5.6.3-py3-none-any.whl.metadata (20 kB)
4.298 Collecting jinja2>=2.11.3 (from llama-cpp-python)
4.317   Downloading Jinja2-3.1.3-py3-none-any.whl.metadata (3.3 kB)
4.372 Collecting MarkupSafe>=2.0 (from jinja2>=2.11.3->llama-cpp-python)
4.393   Downloading MarkupSafe-2.1.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.metadata (3.0 kB)
4.416 Downloading diskcache-5.6.3-py3-none-any.whl (45 kB)
4.418    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 45.5/45.5 kB 412.0 MB/s eta 0:00:00
4.440 Downloading Jinja2-3.1.3-py3-none-any.whl (133 kB)
4.444    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.2/133.2 kB 63.9 MB/s eta 0:00:00
4.472 Downloading numpy-1.26.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (14.2 MB)
4.627    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 14.2/14.2 MB 94.7 MB/s eta 0:00:00
4.648 Downloading typing_extensions-4.10.0-py3-none-any.whl (33 kB)
4.671 Downloading MarkupSafe-2.1.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (29 kB)
4.713 Building wheels for collected packages: llama-cpp-python
4.714   Building wheel for llama-cpp-python (pyproject.toml): started
4.910   Building wheel for llama-cpp-python (pyproject.toml): finished with status 'error'
4.912   error: subprocess-exited-with-error
4.912
4.912   × Building wheel for llama-cpp-python (pyproject.toml) did not run successfully.
4.912   │ exit code: 1
4.912   ╰─> [24 lines of output]
4.912       *** scikit-build-core 0.8.2 using CMake 3.29.0 (wheel)
4.912       *** Configuring CMake...
4.912       loading initial cache file /tmp/tmpk4ft3wii/build/CMakeInit.txt
4.912       -- The C compiler identification is unknown
4.912       -- The CXX compiler identification is unknown
4.912       CMake Error at CMakeLists.txt:3 (project):
4.912         No CMAKE_C_COMPILER could be found.
4.912
4.912         Tell CMake where to find the compiler by setting either the environment
4.912         variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
4.912         the compiler, or to the compiler name if it is in the PATH.
4.912
4.912
4.912       CMake Error at CMakeLists.txt:3 (project):
4.912         No CMAKE_CXX_COMPILER could be found.
4.912
4.912         Tell CMake where to find the compiler by setting either the environment
4.912         variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
4.912         to the compiler, or to the compiler name if it is in the PATH.
4.912
4.912
4.912       -- Configuring incomplete, errors occurred!
4.912
4.912       *** CMake configuration failed
4.912       [end of output]
4.912
4.912   note: This error originates from a subprocess, and is likely not a problem with pip.
4.913   ERROR: Failed building wheel for llama-cpp-python
4.913 Failed to build llama-cpp-python
4.913 ERROR: Could not build wheels for llama-cpp-python, which is required to install pyproject.toml-based projects
------
Dockerfile:9
--------------------
7 |     ENV CMAKE_ARGS="-DLLAMA_METAL=on" FORCE_CMAKE=1
8 |
9 | >>>  RUN pip install -U llama-cpp-python --no-cache-dir
10 |
11 |     RUN pip install 'llama-cpp-python[server]'
--------------------
ERROR: failed to solve: process "/bin/sh -c pip install -U llama-cpp-python --no-cache-dir" did not complete successfully: exit code: 1
Я пробовал разные варианты Dockerfile, но всегда выдает ошибку в одной и той же строке, т. е. RUN pip install -U llama-cpp-python.
Почему? И как это исправить?

Подробнее здесь: https://stackoverflow.com/questions/782 ... on-failing

Вернуться в «Python»