Spaces:
Build error
Build error
support for ctransformers
Browse files
.github/workflows/build-ggml-cpp-wheel.yml
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Build wheel in Docker
|
2 |
+
|
3 |
+
on:
|
4 |
+
push:
|
5 |
+
tags:
|
6 |
+
- '*-ggml' # Will match tags ending with -ggml
|
7 |
+
release:
|
8 |
+
types: [published]
|
9 |
+
|
10 |
+
jobs:
|
11 |
+
build:
|
12 |
+
runs-on: self-hosted
|
13 |
+
permissions:
|
14 |
+
contents: write
|
15 |
+
steps:
|
16 |
+
- name: Checkout code
|
17 |
+
uses: actions/checkout@v2
|
18 |
+
|
19 |
+
- name: Extract version from tag
|
20 |
+
id: get_version
|
21 |
+
run: echo "::set-output name=version::${GITHUB_REF#refs/tags/}"
|
22 |
+
|
23 |
+
- name: Separate version and suffix
|
24 |
+
id: separate
|
25 |
+
run: |
|
26 |
+
VERSION=$(echo ${{ steps.get_version.outputs.version }} | rev | cut -d'-' -f2- | rev)
|
27 |
+
echo "::set-output name=prefix::$VERSION"
|
28 |
+
|
29 |
+
- name: Build Docker image
|
30 |
+
run: docker build . -t artifact-builder -f Dockerfile-llama-cpp-wheel
|
31 |
+
|
32 |
+
- name: Build Docker image
|
33 |
+
run: docker build . -t artifact-builder --build-arg LLAMA_CPP_VERSION=${{ steps.separate.outputs.prefix }} -f Dockerfile-llama-cpp-wheel
|
34 |
+
|
35 |
+
- name: Copy GPU artifact from Docker container
|
36 |
+
run: |
|
37 |
+
docker cp my-artifact-builder:/build/dists/llama_cpp_python-gpu-${{ steps.separate.outputs.prefix }}-cp38-cp38-linux_x86_64.whl ./llama_cpp_python-gpu-0.1.53-cp38-cp38-linux_x86_64.whl
|
38 |
+
|
39 |
+
- name: Upload artifacts
|
40 |
+
uses: actions/upload-artifact@v3
|
41 |
+
with:
|
42 |
+
name: wheels
|
43 |
+
path: |
|
44 |
+
*.whl
|
45 |
+
|
46 |
+
release:
|
47 |
+
needs: build
|
48 |
+
runs-on: self-hosted
|
49 |
+
if: github.event_name == 'release'
|
50 |
+
permissions:
|
51 |
+
contents: write
|
52 |
+
steps:
|
53 |
+
- name: Checkout code
|
54 |
+
uses: actions/checkout@v2
|
55 |
+
|
56 |
+
- name: Download artifacts
|
57 |
+
uses: actions/download-artifact@v3
|
58 |
+
with:
|
59 |
+
name: wheels
|
60 |
+
|
61 |
+
- name: Release
|
62 |
+
uses: softprops/action-gh-release@v1
|
63 |
+
with:
|
64 |
+
files: |
|
65 |
+
*.whl
|
66 |
+
token: ${{ secrets.GITHUB_TOKEN }}
|
.github/workflows/build-llama-cpp-wheel.yml
CHANGED
@@ -2,10 +2,8 @@ name: Build wheel in Docker
|
|
2 |
|
3 |
on:
|
4 |
push:
|
5 |
-
|
6 |
-
-
|
7 |
-
paths:
|
8 |
-
- 'Dockerfile-llama-cpp-wheel'
|
9 |
release:
|
10 |
types: [published]
|
11 |
|
@@ -18,16 +16,25 @@ jobs:
|
|
18 |
- name: Checkout code
|
19 |
uses: actions/checkout@v2
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
- name: Build Docker image
|
22 |
run: docker build . -t artifact-builder -f Dockerfile-llama-cpp-wheel
|
23 |
|
24 |
-
- name:
|
25 |
-
run: docker
|
26 |
|
27 |
-
- name: Copy GPU
|
28 |
run: |
|
29 |
-
docker cp my-artifact-builder:/build/dists/llama_cpp_python-gpu
|
30 |
-
docker cp my-artifact-builder:/build/dists/llama_cpp_python-cpu-0.1.53-cp38-cp38-linux_x86_64.whl ./llama_cpp_python-cpu-0.1.53-cp38-cp38-linux_x86_64.whl
|
31 |
|
32 |
- name: Upload artifacts
|
33 |
uses: actions/upload-artifact@v3
|
|
|
2 |
|
3 |
on:
|
4 |
push:
|
5 |
+
tags:
|
6 |
+
- '*-llama' # Will match tags ending with -llama
|
|
|
|
|
7 |
release:
|
8 |
types: [published]
|
9 |
|
|
|
16 |
- name: Checkout code
|
17 |
uses: actions/checkout@v2
|
18 |
|
19 |
+
- name: Extract version from tag
|
20 |
+
id: get_version
|
21 |
+
run: echo "::set-output name=version::${GITHUB_REF#refs/tags/}"
|
22 |
+
|
23 |
+
- name: Separate version and suffix
|
24 |
+
id: separate
|
25 |
+
run: |
|
26 |
+
VERSION=$(echo ${{ steps.get_version.outputs.version }} | rev | cut -d'-' -f2- | rev)
|
27 |
+
echo "::set-output name=prefix::$VERSION"
|
28 |
+
|
29 |
- name: Build Docker image
|
30 |
run: docker build . -t artifact-builder -f Dockerfile-llama-cpp-wheel
|
31 |
|
32 |
+
- name: Build Docker image
|
33 |
+
run: docker build . -t artifact-builder --build-arg LLAMA_CPP_VERSION=${{ steps.separate.outputs.prefix }} -f Dockerfile-llama-cpp-wheel
|
34 |
|
35 |
+
- name: Copy GPU artifact from Docker container
|
36 |
run: |
|
37 |
+
docker cp my-artifact-builder:/build/dists/llama_cpp_python-gpu-${{ steps.separate.outputs.prefix }}-cp38-cp38-linux_x86_64.whl ./llama_cpp_python-gpu-0.1.53-cp38-cp38-linux_x86_64.whl
|
|
|
38 |
|
39 |
- name: Upload artifacts
|
40 |
uses: actions/upload-artifact@v3
|
Dockerfile-ggml-cpp-wheel
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM nvidia/cuda:11.3.1-cudnn8-devel-ubuntu18.04
|
2 |
+
|
3 |
+
ARG CTRANSFORMERS_VERSION="0.2.5"
|
4 |
+
ARG CMAKE_VERSION=3.26
|
5 |
+
ARG CMAKE_VERSION_PATCH=3.26.3
|
6 |
+
ARG CMAKE_OS=linux
|
7 |
+
ARG DEBIAN_FRONTEND=noninteractive
|
8 |
+
ENV TZ=UTC
|
9 |
+
|
10 |
+
RUN apt-get update && \
|
11 |
+
apt-get install --no-install-recommends -y \
|
12 |
+
curl git vim build-essential software-properties-common python3 python3-pip python3-dev python3-venv \
|
13 |
+
libffi-dev libncurses5-dev zlib1g zlib1g-dev libreadline-dev libbz2-dev libsqlite3-dev libssl-dev \
|
14 |
+
libblas-dev liblapack-dev cmake && \
|
15 |
+
add-apt-repository ppa:ubuntu-toolchain-r/test && \
|
16 |
+
apt-get update && \
|
17 |
+
apt install --no-install-recommends -y gcc-10 g++-10 && \
|
18 |
+
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10 && \
|
19 |
+
rm -rf /var/lib/apt/lists/* && \
|
20 |
+
pip3 install scikit-build
|
21 |
+
RUN curl -L https://cmake.org/files/v$CMAKE_VERSION/cmake-$CMAKE_VERSION_PATCH-$CMAKE_OS-x86_64.sh -o /tmp/cmake-$CMAKE_VERSION_PATCH-$CMAKE_OS-x86_64.sh && \
|
22 |
+
mkdir /opt/cmake && \
|
23 |
+
sh /tmp/cmake-$CMAKE_VERSION_PATCH-$CMAKE_OS-x86_64.sh --skip-license --prefix=/opt/cmake && \
|
24 |
+
ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
|
25 |
+
|
26 |
+
RUN useradd -m -u 1000 appuser
|
27 |
+
|
28 |
+
WORKDIR /build
|
29 |
+
RUN chown appuser:appuser /build
|
30 |
+
USER appuser
|
31 |
+
|
32 |
+
ENV HOME /home/appuser
|
33 |
+
ENV PYENV_ROOT $HOME/.pyenv
|
34 |
+
ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
|
35 |
+
|
36 |
+
RUN git clone --depth 1 --branch v$CTRANSFORMERS_VERSION https://github.com/marella/ctransformers.git /build/ctransformers
|
37 |
+
RUN curl https://pyenv.run | bash
|
38 |
+
|
39 |
+
RUN pyenv install 3.8.9 && \
|
40 |
+
pyenv global 3.8.9 && \
|
41 |
+
pyenv rehash && \
|
42 |
+
pip install --no-cache-dir --upgrade pip==22.3.1 setuptools wheel && \
|
43 |
+
pip install --no-cache-dir datasets "huggingface-hub>=0.12.1" "protobuf<4" "click<8.1" "scikit-build" && \
|
44 |
+
CT_CUBLAS=1 python3 setup.py bdist_wheel && \
|
45 |
+
mkdir /build/dists/ && \
|
46 |
+
ls -l /build/dists/
|
Dockerfile-llama-cpp-wheel
CHANGED
@@ -11,7 +11,7 @@ RUN apt-get update && \
|
|
11 |
apt-get install --no-install-recommends -y \
|
12 |
curl git vim build-essential software-properties-common python3 python3-pip python3-dev python3-venv \
|
13 |
libffi-dev libncurses5-dev zlib1g zlib1g-dev libreadline-dev libbz2-dev libsqlite3-dev libssl-dev \
|
14 |
-
libblas-dev liblapack-dev
|
15 |
add-apt-repository ppa:ubuntu-toolchain-r/test && \
|
16 |
apt-get update && \
|
17 |
apt install --no-install-recommends -y gcc-10 g++-10 && \
|
@@ -42,9 +42,9 @@ RUN pyenv install 3.8.9 && \
|
|
42 |
pyenv rehash && \
|
43 |
pip install --no-cache-dir --upgrade pip==22.3.1 setuptools wheel && \
|
44 |
pip install --no-cache-dir datasets "huggingface-hub>=0.12.1" "protobuf<4" "click<8.1" "scikit-build" && \
|
45 |
-
CMAKE_ARGS="-DLLAMA_CUBLAS=on
|
46 |
mkdir /build/dists/ && \
|
47 |
cp dist/llama_cpp_python-${LLAMA_CPP_VERSION}-cp38-cp38-linux_x86_64.whl dists/llama_cpp_python-gpu-${LLAMA_CPP_VERSION}-cp38-cp38-linux_x86_64.whl && \
|
48 |
-
CMAKE_ARGS="-DLLAMA_CUBLAS=off
|
49 |
cp dist/llama_cpp_python-${LLAMA_CPP_VERSION}-cp38-cp38-linux_x86_64.whl dists/llama_cpp_python-cpu-${LLAMA_CPP_VERSION}-cp38-cp38-linux_x86_64.whl && \
|
50 |
ls -l /build/dists/
|
|
|
11 |
apt-get install --no-install-recommends -y \
|
12 |
curl git vim build-essential software-properties-common python3 python3-pip python3-dev python3-venv \
|
13 |
libffi-dev libncurses5-dev zlib1g zlib1g-dev libreadline-dev libbz2-dev libsqlite3-dev libssl-dev \
|
14 |
+
libblas-dev liblapack-dev cmake && \
|
15 |
add-apt-repository ppa:ubuntu-toolchain-r/test && \
|
16 |
apt-get update && \
|
17 |
apt install --no-install-recommends -y gcc-10 g++-10 && \
|
|
|
42 |
pyenv rehash && \
|
43 |
pip install --no-cache-dir --upgrade pip==22.3.1 setuptools wheel && \
|
44 |
pip install --no-cache-dir datasets "huggingface-hub>=0.12.1" "protobuf<4" "click<8.1" "scikit-build" && \
|
45 |
+
CMAKE_ARGS="-DLLAMA_CUBLAS=on" FORCE_CMAKE=1 python3 setup.py bdist_wheel && \
|
46 |
mkdir /build/dists/ && \
|
47 |
cp dist/llama_cpp_python-${LLAMA_CPP_VERSION}-cp38-cp38-linux_x86_64.whl dists/llama_cpp_python-gpu-${LLAMA_CPP_VERSION}-cp38-cp38-linux_x86_64.whl && \
|
48 |
+
CMAKE_ARGS="-DLLAMA_CUBLAS=off" FORCE_CMAKE=1 python3 setup.py bdist_wheel && \
|
49 |
cp dist/llama_cpp_python-${LLAMA_CPP_VERSION}-cp38-cp38-linux_x86_64.whl dists/llama_cpp_python-cpu-${LLAMA_CPP_VERSION}-cp38-cp38-linux_x86_64.whl && \
|
50 |
ls -l /build/dists/
|