Skip to content

Commit 8fb0914

Browse files
@FIR-1763: First version of merge
1 parent 18a8aad commit 8fb0914

1,927 files changed

Lines changed: 567012 additions & 156869 deletions

File tree

Some content is hidden

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

.devops/cann.Dockerfile

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,17 @@
33
# ==============================================================================
44

55
# Define the CANN base image for easier version updates later
6-
ARG CANN_BASE_IMAGE=quay.io/ascend/cann:8.1.rc1-910b-openeuler22.03-py3.10
6+
ARG CHIP_TYPE=910b
7+
ARG CANN_BASE_IMAGE=quay.io/ascend/cann:8.5.0-${CHIP_TYPE}-openeuler24.03-py3.11
78

89
# ==============================================================================
910
# BUILD STAGE
1011
# Compile all binary files and libraries
1112
# ==============================================================================
1213
FROM ${CANN_BASE_IMAGE} AS build
1314

14-
# Define the Ascend chip model for compilation. Default is Ascend910B3
15-
ARG ASCEND_SOC_TYPE=Ascend910B3
16-
1715
# -- Install build dependencies --
18-
RUN yum install -y gcc g++ cmake make git libcurl-devel python3 python3-pip && \
16+
RUN yum install -y gcc g++ cmake make git openssl-devel python3 python3-pip && \
1917
yum clean all && \
2018
rm -rf /var/cache/yum
2119

@@ -36,20 +34,22 @@ ENV LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/runtime/lib64/stub:$LD_LIBRARY_PATH
3634
# For brevity, only core variables are listed here. You can paste the original ENV list here.
3735

3836
# -- Build llama.cpp --
39-
# Use the passed ASCEND_SOC_TYPE argument and add general build options
37+
# Use the passed CHIP_TYPE argument and add general build options
38+
ARG CHIP_TYPE
4039
RUN source /usr/local/Ascend/ascend-toolkit/set_env.sh --force \
4140
&& \
4241
cmake -B build \
4342
-DGGML_CANN=ON \
4443
-DCMAKE_BUILD_TYPE=Release \
45-
-DSOC_TYPE=${ASCEND_SOC_TYPE} \
44+
-DSOC_TYPE=ascend${CHIP_TYPE} \
45+
-DUSE_ACL_GRAPH=ON \
4646
. && \
4747
cmake --build build --config Release -j$(nproc)
4848

4949
# -- Organize build artifacts for copying in later stages --
5050
# Create a lib directory to store all .so files
5151
RUN mkdir -p /app/lib && \
52-
find build -name "*.so" -exec cp {} /app/lib \;
52+
find build -name "*.so*" -exec cp -P {} /app/lib \;
5353

5454
# Create a full directory to store all executables and Python scripts
5555
RUN mkdir -p /app/full && \
@@ -108,11 +108,11 @@ ENTRYPOINT ["/app/tools.sh"]
108108
# ENTRYPOINT ["/app/llama-server"]
109109

110110
### Target: light
111-
# Lightweight image containing only llama-cli
111+
# Lightweight image containing only llama-cli and llama-completion
112112
# ==============================================================================
113113
FROM base AS light
114114

115-
COPY --from=build /app/full/llama-cli /app
115+
COPY --from=build /app/full/llama-cli /app/full/llama-completion /app
116116

117117
ENTRYPOINT [ "/app/llama-cli" ]
118118

.devops/cpu.Dockerfile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
ARG UBUNTU_VERSION=22.04
1+
ARG UBUNTU_VERSION=24.04
22

33
FROM ubuntu:$UBUNTU_VERSION AS build
44

55
ARG TARGETARCH
66

77
RUN apt-get update && \
8-
apt-get install -y build-essential git cmake libcurl4-openssl-dev
8+
apt-get install -y gcc-14 g++-14 build-essential git cmake libssl-dev
9+
10+
ENV CC=gcc-14 CXX=g++-14
911

1012
WORKDIR /app
1113

@@ -20,7 +22,7 @@ RUN if [ "$TARGETARCH" = "amd64" ] || [ "$TARGETARCH" = "arm64" ]; then \
2022
cmake --build build -j $(nproc)
2123

2224
RUN mkdir -p /app/lib && \
23-
find build -name "*.so" -exec cp {} /app/lib \;
25+
find build -name "*.so*" -exec cp -P {} /app/lib \;
2426

2527
RUN mkdir -p /app/full \
2628
&& cp build/bin/* /app/full \
@@ -34,7 +36,7 @@ RUN mkdir -p /app/full \
3436
FROM ubuntu:$UBUNTU_VERSION AS base
3537

3638
RUN apt-get update \
37-
&& apt-get install -y libgomp1 curl\
39+
&& apt-get install -y libgomp1 curl \
3840
&& apt autoremove -y \
3941
&& apt clean -y \
4042
&& rm -rf /tmp/* /var/tmp/* \
@@ -55,8 +57,9 @@ RUN apt-get update \
5557
git \
5658
python3 \
5759
python3-pip \
58-
&& pip install --upgrade pip setuptools wheel \
59-
&& pip install -r requirements.txt \
60+
python3-wheel \
61+
&& pip install --break-system-packages --upgrade setuptools \
62+
&& pip install --break-system-packages -r requirements.txt \
6063
&& apt autoremove -y \
6164
&& apt clean -y \
6265
&& rm -rf /tmp/* /var/tmp/* \
@@ -68,7 +71,7 @@ ENTRYPOINT ["/app/tools.sh"]
6871
### Light, CLI only
6972
FROM base AS light
7073

71-
COPY --from=build /app/full/llama-cli /app
74+
COPY --from=build /app/full/llama-cli /app/full/llama-completion /app
7275

7376
WORKDIR /app
7477

.devops/cuda.Dockerfile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
ARG UBUNTU_VERSION=22.04
1+
ARG UBUNTU_VERSION=24.04
22
# This needs to generally match the container host's environment.
3-
ARG CUDA_VERSION=12.4.0
3+
ARG CUDA_VERSION=12.8.1
44
# Target the CUDA build image
55
ARG BASE_CUDA_DEV_CONTAINER=nvidia/cuda:${CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION}
66

@@ -12,7 +12,9 @@ FROM ${BASE_CUDA_DEV_CONTAINER} AS build
1212
ARG CUDA_DOCKER_ARCH=default
1313

1414
RUN apt-get update && \
15-
apt-get install -y build-essential cmake python3 python3-pip git libcurl4-openssl-dev libgomp1
15+
apt-get install -y gcc-14 g++-14 build-essential cmake python3 python3-pip git libssl-dev libgomp1
16+
17+
ENV CC=gcc-14 CXX=g++-14 CUDAHOSTCXX=g++-14
1618

1719
WORKDIR /app
1820

@@ -25,7 +27,7 @@ RUN if [ "${CUDA_DOCKER_ARCH}" != "default" ]; then \
2527
cmake --build build --config Release -j$(nproc)
2628

2729
RUN mkdir -p /app/lib && \
28-
find build -name "*.so" -exec cp {} /app/lib \;
30+
find build -name "*.so*" -exec cp -P {} /app/lib \;
2931

3032
RUN mkdir -p /app/full \
3133
&& cp build/bin/* /app/full \
@@ -39,7 +41,7 @@ RUN mkdir -p /app/full \
3941
FROM ${BASE_CUDA_RUN_CONTAINER} AS base
4042

4143
RUN apt-get update \
42-
&& apt-get install -y libgomp1 curl\
44+
&& apt-get install -y libgomp1 curl \
4345
&& apt autoremove -y \
4446
&& apt clean -y \
4547
&& rm -rf /tmp/* /var/tmp/* \
@@ -60,7 +62,8 @@ RUN apt-get update \
6062
git \
6163
python3 \
6264
python3-pip \
63-
&& pip install --upgrade pip setuptools wheel \
65+
python3-wheel \
66+
&& pip install --break-system-packages --upgrade setuptools \
6467
&& pip install --break-system-packages -r requirements.txt \
6568
&& apt autoremove -y \
6669
&& apt clean -y \
@@ -74,7 +77,7 @@ ENTRYPOINT ["/app/tools.sh"]
7477
### Light, CLI only
7578
FROM base AS light
7679

77-
COPY --from=build /app/full/llama-cli /app
80+
COPY --from=build /app/full/llama-cli /app/full/llama-completion /app
7881

7982
WORKDIR /app
8083

.devops/intel.Dockerfile

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
ARG ONEAPI_VERSION=2025.2.2-0-devel-ubuntu24.04
1+
ARG ONEAPI_VERSION=2025.3.3-0-devel-ubuntu24.04
22

33
## Build Image
44

55
FROM intel/deep-learning-essentials:$ONEAPI_VERSION AS build
66

77
ARG GGML_SYCL_F16=OFF
88
RUN apt-get update && \
9-
apt-get install -y git libcurl4-openssl-dev
9+
apt-get install -y git libssl-dev
1010

1111
WORKDIR /app
1212

@@ -21,7 +21,7 @@ RUN if [ "${GGML_SYCL_F16}" = "ON" ]; then \
2121
cmake --build build --config Release -j$(nproc)
2222

2323
RUN mkdir -p /app/lib && \
24-
find build -name "*.so" -exec cp {} /app/lib \;
24+
find build -name "*.so*" -exec cp -P {} /app/lib \;
2525

2626
RUN mkdir -p /app/full \
2727
&& cp build/bin/* /app/full \
@@ -33,8 +33,25 @@ RUN mkdir -p /app/full \
3333

3434
FROM intel/deep-learning-essentials:$ONEAPI_VERSION AS base
3535

36+
ARG IGC_VERSION=v2.30.1
37+
ARG IGC_VERSION_FULL=2_2.30.1+20950
38+
ARG COMPUTE_RUNTIME_VERSION=26.09.37435.1
39+
ARG COMPUTE_RUNTIME_VERSION_FULL=26.09.37435.1-0
40+
ARG IGDGMM_VERSION=22.9.0
41+
RUN mkdir /tmp/neo/ && cd /tmp/neo/ \
42+
&& wget https://github.com/intel/intel-graphics-compiler/releases/download/$IGC_VERSION/intel-igc-core-${IGC_VERSION_FULL}_amd64.deb \
43+
&& wget https://github.com/intel/intel-graphics-compiler/releases/download/$IGC_VERSION/intel-igc-opencl-${IGC_VERSION_FULL}_amd64.deb \
44+
&& wget https://github.com/intel/compute-runtime/releases/download/$COMPUTE_RUNTIME_VERSION/intel-ocloc-dbgsym_${COMPUTE_RUNTIME_VERSION_FULL}_amd64.ddeb \
45+
&& wget https://github.com/intel/compute-runtime/releases/download/$COMPUTE_RUNTIME_VERSION/intel-ocloc_${COMPUTE_RUNTIME_VERSION_FULL}_amd64.deb \
46+
&& wget https://github.com/intel/compute-runtime/releases/download/$COMPUTE_RUNTIME_VERSION/intel-opencl-icd-dbgsym_${COMPUTE_RUNTIME_VERSION_FULL}_amd64.ddeb \
47+
&& wget https://github.com/intel/compute-runtime/releases/download/$COMPUTE_RUNTIME_VERSION/intel-opencl-icd_${COMPUTE_RUNTIME_VERSION_FULL}_amd64.deb \
48+
&& wget https://github.com/intel/compute-runtime/releases/download/$COMPUTE_RUNTIME_VERSION/libigdgmm12_${IGDGMM_VERSION}_amd64.deb \
49+
&& wget https://github.com/intel/compute-runtime/releases/download/$COMPUTE_RUNTIME_VERSION/libze-intel-gpu1-dbgsym_${COMPUTE_RUNTIME_VERSION_FULL}_amd64.ddeb \
50+
&& wget https://github.com/intel/compute-runtime/releases/download/$COMPUTE_RUNTIME_VERSION/libze-intel-gpu1_${COMPUTE_RUNTIME_VERSION_FULL}_amd64.deb \
51+
&& dpkg --install *.deb
52+
3653
RUN apt-get update \
37-
&& apt-get install -y libgomp1 curl\
54+
&& apt-get install -y libgomp1 curl \
3855
&& apt autoremove -y \
3956
&& apt clean -y \
4057
&& rm -rf /tmp/* /var/tmp/* \
@@ -73,7 +90,7 @@ ENTRYPOINT ["/app/tools.sh"]
7390
FROM base AS light
7491

7592
COPY --from=build /app/lib/ /app
76-
COPY --from=build /app/full/llama-cli /app
93+
COPY --from=build /app/full/llama-cli /app/full/llama-completion /app
7794

7895
WORKDIR /app
7996

.devops/llama-cli-cann.Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
ARG ASCEND_VERSION=8.1.RC1.alpha001-910b-openeuler22.03-py3.10
1+
ARG ASCEND_VERSION=8.5.0-910b-openeuler22.03-py3.10
22

33
FROM ascendai/cann:$ASCEND_VERSION AS build
44

55
WORKDIR /app
66

77
COPY . .
88

9-
RUN yum install -y gcc g++ cmake make libcurl-devel
9+
RUN yum install -y gcc g++ cmake make openssl-devel
1010
ENV ASCEND_TOOLKIT_HOME=/usr/local/Ascend/ascend-toolkit/latest
1111
ENV LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/lib64:$LIBRARY_PATH
1212
ENV LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/lib64:${ASCEND_TOOLKIT_HOME}/lib64/plugin/opskernel:${ASCEND_TOOLKIT_HOME}/lib64/plugin/nnengine:${ASCEND_TOOLKIT_HOME}/opp/built-in/op_impl/ai_core/tbe/op_tiling:${LD_LIBRARY_PATH}
@@ -23,11 +23,12 @@ ENV LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/runtime/lib64/stub:$LD_LIBRARY_PATH
2323
RUN echo "Building with static libs" && \
2424
source /usr/local/Ascend/ascend-toolkit/set_env.sh --force && \
2525
cmake -B build -DGGML_NATIVE=OFF -DGGML_CANN=ON -DBUILD_SHARED_LIBS=OFF -DLLAMA_BUILD_TESTS=OFF && \
26-
cmake --build build --config Release --target llama-cli
26+
cmake --build build --config Release --target llama-cli && \
27+
cmake --build build --config Release --target llama-completion
2728

2829
# TODO: use image with NNRT
2930
FROM ascendai/cann:$ASCEND_VERSION AS runtime
30-
COPY --from=build /app/build/bin/llama-cli /llama-cli
31+
COPY --from=build /app/build/bin/llama-cli /app/build/bin/llama-completion /
3132

3233
ENV LC_ALL=C.utf8
3334

.devops/llama-cpp-cuda.srpm.spec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ make -j GGML_CUDA=1
3737
%install
3838
mkdir -p %{buildroot}%{_bindir}/
3939
cp -p llama-cli %{buildroot}%{_bindir}/llama-cuda-cli
40+
cp -p llama-completion %{buildroot}%{_bindir}/llama-cuda-completion
4041
cp -p llama-server %{buildroot}%{_bindir}/llama-cuda-server
4142
cp -p llama-simple %{buildroot}%{_bindir}/llama-cuda-simple
4243

@@ -68,6 +69,7 @@ rm -rf %{_builddir}/*
6869

6970
%files
7071
%{_bindir}/llama-cuda-cli
72+
%{_bindir}/llama-cuda-completion
7173
%{_bindir}/llama-cuda-server
7274
%{_bindir}/llama-cuda-simple
7375
/usr/lib/systemd/system/llamacuda.service

.devops/llama-cpp.srpm.spec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ make -j
3939
%install
4040
mkdir -p %{buildroot}%{_bindir}/
4141
cp -p llama-cli %{buildroot}%{_bindir}/llama-cli
42+
cp -p llama-completion %{buildroot}%{_bindir}/llama-completion
4243
cp -p llama-server %{buildroot}%{_bindir}/llama-server
4344
cp -p llama-simple %{buildroot}%{_bindir}/llama-simple
4445

@@ -70,6 +71,7 @@ rm -rf %{_builddir}/*
7071

7172
%files
7273
%{_bindir}/llama-cli
74+
%{_bindir}/llama-completion
7375
%{_bindir}/llama-server
7476
%{_bindir}/llama-simple
7577
/usr/lib/systemd/system/llama.service

.devops/musa.Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ RUN apt-get update && \
1818
python3 \
1919
python3-pip \
2020
git \
21-
libcurl4-openssl-dev \
21+
libssl-dev \
2222
libgomp1
2323

2424
WORKDIR /app
@@ -32,7 +32,7 @@ RUN if [ "${MUSA_DOCKER_ARCH}" != "default" ]; then \
3232
cmake --build build --config Release -j$(nproc)
3333

3434
RUN mkdir -p /app/lib && \
35-
find build -name "*.so" -exec cp {} /app/lib \;
35+
find build -name "*.so*" -exec cp -P {} /app/lib \;
3636

3737
RUN mkdir -p /app/full \
3838
&& cp build/bin/* /app/full \
@@ -46,7 +46,7 @@ RUN mkdir -p /app/full \
4646
FROM ${BASE_MUSA_RUN_CONTAINER} AS base
4747

4848
RUN apt-get update \
49-
&& apt-get install -y libgomp1 curl\
49+
&& apt-get install -y libgomp1 curl \
5050
&& apt autoremove -y \
5151
&& apt clean -y \
5252
&& rm -rf /tmp/* /var/tmp/* \
@@ -81,7 +81,7 @@ ENTRYPOINT ["/app/tools.sh"]
8181
### Light, CLI only
8282
FROM base AS light
8383

84-
COPY --from=build /app/full/llama-cli /app
84+
COPY --from=build /app/full/llama-cli /app/full/llama-completion /app
8585

8686
WORKDIR /app
8787

.devops/nix/nixpkgs-instances.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# the module `{ pkgs ... }: { /* config */ }` implicitly uses
55
# `_module.args.pkgs` (defined in this case by flake-parts).
66
perSystem =
7-
{ system, ... }:
7+
{ lib, system, ... }:
88
{
99
_module.args = {
1010
# Note: bringing up https://zimbatm.com/notes/1000-instances-of-nixpkgs
@@ -33,7 +33,7 @@
3333
"CUDA EULA"
3434
"cuDNN EULA"
3535
]
36-
) (p.meta.licenses or [ p.meta.license ]);
36+
) (p.meta.licenses or (lib.toList p.meta.license));
3737
};
3838
# Ensure dependencies use ROCm consistently
3939
pkgsRocm = import inputs.nixpkgs {

.devops/nix/package-gguf-py.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
llamaVersion,
44
numpy,
55
tqdm,
6+
requests,
67
sentencepiece,
78
pyyaml,
89
poetry-core,
@@ -20,6 +21,7 @@ buildPythonPackage {
2021
tqdm
2122
sentencepiece
2223
pyyaml
24+
requests
2325
];
2426
src = lib.cleanSource ../../gguf-py;
2527
pythonImportsCheck = [

0 commit comments

Comments
 (0)