Skip to content

Commit 497b116

Browse files
authored
Merge branch 'ggml-org:master' into master
2 parents ac1d443 + 0b24686 commit 497b116

67 files changed

Lines changed: 5599 additions & 1569 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devops/zendnn.Dockerfile

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
ARG UBUNTU_VERSION=24.04
2+
ARG BUILD_DATE=N/A
3+
ARG APP_VERSION=N/A
4+
ARG APP_REVISION=N/A
5+
6+
FROM ubuntu:$UBUNTU_VERSION AS build
7+
8+
RUN apt-get update && \
9+
apt-get install -y gcc-13 g++-13 build-essential git cmake libssl-dev libomp-dev libnuma-dev python3 ca-certificates
10+
11+
ENV CC=gcc-13 CXX=g++-13
12+
13+
WORKDIR /app
14+
15+
COPY . .
16+
17+
RUN cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DGGML_NATIVE=OFF -DLLAMA_BUILD_TESTS=OFF -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DGGML_ZENDNN=ON && \
18+
cmake --build build -j $(nproc)
19+
20+
RUN mkdir -p /app/lib && \
21+
find build -name "*.so*" -exec cp -P {} /app/lib \;
22+
23+
RUN mkdir -p /app/full \
24+
&& cp build/bin/* /app/full \
25+
&& cp *.py /app/full \
26+
&& cp -r conversion /app/full \
27+
&& cp -r gguf-py /app/full \
28+
&& cp -r requirements /app/full \
29+
&& cp requirements.txt /app/full \
30+
&& cp .devops/tools.sh /app/full/tools.sh
31+
32+
## Base image
33+
FROM ubuntu:$UBUNTU_VERSION AS base
34+
35+
ARG BUILD_DATE=N/A
36+
ARG APP_VERSION=N/A
37+
ARG APP_REVISION=N/A
38+
ARG IMAGE_URL=https://github.com/ggml-org/llama.cpp
39+
ARG IMAGE_SOURCE=https://github.com/ggml-org/llama.cpp
40+
LABEL org.opencontainers.image.created=$BUILD_DATE \
41+
org.opencontainers.image.version=$APP_VERSION \
42+
org.opencontainers.image.revision=$APP_REVISION \
43+
org.opencontainers.image.title="llama.cpp" \
44+
org.opencontainers.image.description="LLM inference in C/C++" \
45+
org.opencontainers.image.url=$IMAGE_URL \
46+
org.opencontainers.image.source=$IMAGE_SOURCE
47+
48+
RUN apt-get update \
49+
&& apt-get install -y libgomp1 libnuma1 curl \
50+
&& apt autoremove -y \
51+
&& apt clean -y \
52+
&& rm -rf /tmp/* /var/tmp/* \
53+
&& find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \
54+
&& find /var/cache -type f -delete
55+
56+
COPY --from=build /app/lib/ /app
57+
58+
### Full
59+
FROM base AS full
60+
61+
COPY --from=build /app/full /app
62+
63+
WORKDIR /app
64+
65+
RUN apt-get update \
66+
&& apt-get install -y \
67+
git \
68+
python3 \
69+
python3-pip \
70+
python3-wheel \
71+
&& pip install --break-system-packages --upgrade setuptools \
72+
&& pip install --break-system-packages -r requirements.txt \
73+
&& apt autoremove -y \
74+
&& apt clean -y \
75+
&& rm -rf /tmp/* /var/tmp/* \
76+
&& find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \
77+
&& find /var/cache -type f -delete
78+
79+
ENTRYPOINT ["/app/tools.sh"]
80+
81+
### Light, CLI only
82+
FROM base AS light
83+
84+
COPY --from=build /app/full/llama-cli /app/full/llama-completion /app
85+
86+
WORKDIR /app
87+
88+
ENTRYPOINT [ "/app/llama-cli" ]
89+
90+
### Server, Server only
91+
FROM base AS server
92+
93+
ENV LLAMA_ARG_HOST=0.0.0.0
94+
95+
COPY --from=build /app/full/llama-server /app
96+
97+
WORKDIR /app
98+
99+
HEALTHCHECK CMD [ "curl", "-f", "http://localhost:8080/health" ]
100+
101+
ENTRYPOINT [ "/app/llama-server" ]

.github/workflows/build-android.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ env:
3232
LLAMA_ARG_LOG_TIMESTAMPS: 1
3333

3434
jobs:
35-
android:
35+
default:
3636
runs-on: ubuntu-latest
3737

3838
steps:
@@ -58,7 +58,7 @@ jobs:
5858
cd examples/llama.android
5959
./gradlew build --no-daemon
6060
61-
android-ndk:
61+
ndk:
6262
runs-on: ubuntu-latest
6363
container:
6464
image: 'ghcr.io/snapdragon-toolchain/arm64-android:v0.3'
@@ -92,7 +92,7 @@ jobs:
9292
name: llama-cpp-android-arm64-cpu
9393
path: pkg-adb/llama.cpp
9494

95-
android-arm64:
95+
arm64:
9696
runs-on: ubuntu-latest
9797

9898
env:
@@ -103,12 +103,18 @@ jobs:
103103
id: checkout
104104
uses: actions/checkout@v6
105105

106-
- name: ccache
107-
uses: ggml-org/ccache-action@v1.2.21
108-
with:
109-
key: android-arm64
110-
evict-old-files: 1d
111-
save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
106+
# note : disabled to spare some cache space (https://github.com/ggml-org/llama.cpp/pull/23789)
107+
# for some reason, the ccache does not improve the build time in this case
108+
# example:
109+
# cache off: https://github.com/ggerganov/tmp2/actions/runs/26534713799/job/78160400831
110+
# cache on: https://github.com/ggerganov/tmp2/actions/runs/26534713799/job/78224189394
111+
#
112+
#- name: ccache
113+
# uses: ggml-org/ccache-action@v1.2.21
114+
# with:
115+
# key: android-ubuntu-arm64
116+
# evict-old-files: 1d
117+
# save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
112118

113119
- name: Set up JDK
114120
uses: actions/setup-java@v5

.github/workflows/build-apple.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
- name: ccache
4949
uses: ggml-org/ccache-action@v1.2.21
5050
with:
51-
key: macos-latest-arm64
51+
key: apple-arm64
5252
evict-old-files: 1d
5353
save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
5454

@@ -84,7 +84,7 @@ jobs:
8484
- name: ccache
8585
uses: ggml-org/ccache-action@v1.2.21
8686
with:
87-
key: macos-latest-x64
87+
key: apple-x64
8888
evict-old-files: 1d
8989
save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
9090

@@ -117,10 +117,11 @@ jobs:
117117
id: checkout
118118
uses: actions/checkout@v6
119119

120+
# TODO: this likely does not do anything - if yes, remove it
120121
- name: ccache
121122
uses: ggml-org/ccache-action@v1.2.21
122123
with:
123-
key: macos-latest-ios
124+
key: apple-ios
124125
evict-old-files: 1d
125126
save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
126127

@@ -197,10 +198,11 @@ jobs:
197198
id: checkout
198199
uses: actions/checkout@v6
199200

201+
# TODO: this likely does not do anything - if yes, remove it
200202
- name: ccache
201203
uses: ggml-org/ccache-action@v1.2.21
202204
with:
203-
key: macos-latest-tvos
205+
key: apple-tvos
204206
evict-old-files: 1d
205207
save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
206208

@@ -230,6 +232,14 @@ jobs:
230232
id: checkout
231233
uses: actions/checkout@v6
232234

235+
# TODO: this likely does not do anything - if yes, remove it
236+
- name: ccache
237+
uses: ggml-org/ccache-action@v1.2.21
238+
with:
239+
key: apple-visionos
240+
evict-old-files: 1d
241+
save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
242+
233243
- name: Build
234244
id: cmake_build
235245
run: |
@@ -261,10 +271,11 @@ jobs:
261271
id: checkout
262272
uses: actions/checkout@v6
263273

274+
# TODO: this likely does not do anything - if yes, remove it
264275
- name: ccache
265276
uses: ggml-org/ccache-action@v1.2.21
266277
with:
267-
key: macos-latest-swift
278+
key: apple-swift
268279
evict-old-files: 1d
269280
save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
270281

0 commit comments

Comments
 (0)