forked from ggerganov/llama.cpp
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update llama.cpp to latest
- Loading branch information
Showing
220 changed files
with
105,247 additions
and
8,433 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
ARG UBUNTU_VERSION=jammy | ||
|
||
FROM ubuntu:$UBUNTU_VERSION as build | ||
|
||
# Install build tools | ||
RUN apt update && apt install -y git build-essential cmake wget | ||
|
||
# Install Vulkan SDK | ||
RUN wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | apt-key add - && \ | ||
wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list && \ | ||
apt update -y && \ | ||
apt-get install -y vulkan-sdk | ||
|
||
# Build it | ||
WORKDIR /app | ||
COPY . . | ||
RUN mkdir build && \ | ||
cd build && \ | ||
cmake .. -DLLAMA_VULKAN=1 && \ | ||
cmake --build . --config Release --target main | ||
|
||
# Clean up | ||
WORKDIR / | ||
RUN cp /app/build/bin/main /main && \ | ||
rm -rf /app | ||
|
||
ENV LC_ALL=C.utf8 | ||
|
||
ENTRYPOINT [ "/main" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
lib, | ||
dockerTools, | ||
buildEnv, | ||
llama-cpp, | ||
interactive ? true, | ||
coreutils, | ||
}: | ||
|
||
# A tar that can be fed into `docker load`: | ||
# | ||
# $ nix build .#llamaPackages.docker | ||
# $ docker load < result | ||
|
||
# For details and variations cf. | ||
# - https://nixos.org/manual/nixpkgs/unstable/#ssec-pkgs-dockerTools-buildLayeredImage | ||
# - https://discourse.nixos.org/t/a-faster-dockertools-buildimage-prototype/16922 | ||
# - https://nixery.dev/ | ||
|
||
# Approximate (compressed) sizes, at the time of writing, are: | ||
# | ||
# .#llamaPackages.docker: 125M; | ||
# .#llamaPackagesCuda.docker: 537M; | ||
# .#legacyPackages.aarch64-linux.llamaPackagesXavier.docker: 415M. | ||
|
||
dockerTools.buildLayeredImage { | ||
name = llama-cpp.pname; | ||
tag = "latest"; | ||
|
||
contents = | ||
[ llama-cpp ] | ||
++ lib.optionals interactive [ | ||
coreutils | ||
dockerTools.binSh | ||
dockerTools.caCertificates | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
lib, | ||
singularity-tools, | ||
llama-cpp, | ||
bashInteractive, | ||
interactive ? false, | ||
}: | ||
|
||
let | ||
optionalInt = cond: x: if cond then x else 0; | ||
in | ||
singularity-tools.buildImage rec { | ||
inherit (llama-cpp) name; | ||
contents = [ llama-cpp ] ++ lib.optionals interactive [ bashInteractive ]; | ||
|
||
# These are excessive (but safe) for most variants. Building singularity | ||
# images requires superuser privileges, so we build them inside a VM in a | ||
# writable image of pre-determined size. | ||
# | ||
# ROCm is currently affected by https://github.com/NixOS/nixpkgs/issues/276846 | ||
# | ||
# Expected image sizes: | ||
# - cpu/blas: 150M, | ||
# - cuda, all gencodes: 560M, | ||
diskSize = 4096 + optionalInt llama-cpp.useRocm 16384; | ||
memSize = diskSize; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
ARG UBUNTU_VERSION=22.04 | ||
# This needs to generally match the container host's environment. | ||
ARG CUDA_VERSION=11.7.1 | ||
# Target the CUDA build image | ||
ARG BASE_CUDA_DEV_CONTAINER=nvidia/cuda:${CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION} | ||
# Target the CUDA runtime image | ||
ARG BASE_CUDA_RUN_CONTAINER=nvidia/cuda:${CUDA_VERSION}-runtime-ubuntu${UBUNTU_VERSION} | ||
|
||
FROM ${BASE_CUDA_DEV_CONTAINER} as build | ||
|
||
# Unless otherwise specified, we make a fat build. | ||
ARG CUDA_DOCKER_ARCH=all | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y build-essential git | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
# Set nvcc architecture | ||
ENV CUDA_DOCKER_ARCH=${CUDA_DOCKER_ARCH} | ||
# Enable cuBLAS | ||
ENV LLAMA_CUBLAS=1 | ||
|
||
RUN make | ||
|
||
FROM ${BASE_CUDA_RUN_CONTAINER} as runtime | ||
|
||
COPY --from=build /app/server /server | ||
|
||
ENTRYPOINT [ "/server" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
ARG ONEAPI_VERSION=2024.0.1-devel-ubuntu22.04 | ||
|
||
FROM intel/oneapi-basekit:$ONEAPI_VERSION as build | ||
|
||
ARG LLAMA_SYCL_F16=OFF | ||
RUN apt-get update && \ | ||
apt-get install -y git | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
RUN mkdir build && \ | ||
cd build && \ | ||
if [ "${LLAMA_SYCL_F16}" = "ON" ]; then \ | ||
echo "LLAMA_SYCL_F16 is set" && \ | ||
export OPT_SYCL_F16="-DLLAMA_SYCL_F16=ON"; \ | ||
fi && \ | ||
cmake .. -DLLAMA_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx ${OPT_SYCL_F16} && \ | ||
cmake --build . --config Release --target server | ||
|
||
FROM intel/oneapi-basekit:$ONEAPI_VERSION as runtime | ||
|
||
COPY --from=build /app/build/bin/server /server | ||
|
||
ENV LC_ALL=C.utf8 | ||
|
||
ENTRYPOINT [ "/server" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
ARG UBUNTU_VERSION=22.04 | ||
|
||
# This needs to generally match the container host's environment. | ||
ARG ROCM_VERSION=5.6 | ||
|
||
# Target the CUDA build image | ||
ARG BASE_ROCM_DEV_CONTAINER=rocm/dev-ubuntu-${UBUNTU_VERSION}:${ROCM_VERSION}-complete | ||
|
||
FROM ${BASE_ROCM_DEV_CONTAINER} as build | ||
|
||
# Unless otherwise specified, we make a fat build. | ||
# List from https://github.com/ggerganov/llama.cpp/pull/1087#issuecomment-1682807878 | ||
# This is mostly tied to rocBLAS supported archs. | ||
ARG ROCM_DOCKER_ARCH=\ | ||
gfx803 \ | ||
gfx900 \ | ||
gfx906 \ | ||
gfx908 \ | ||
gfx90a \ | ||
gfx1010 \ | ||
gfx1030 \ | ||
gfx1100 \ | ||
gfx1101 \ | ||
gfx1102 | ||
|
||
COPY requirements.txt requirements.txt | ||
COPY requirements requirements | ||
|
||
RUN pip install --upgrade pip setuptools wheel \ | ||
&& pip install -r requirements.txt | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
# Set nvcc architecture | ||
ENV GPU_TARGETS=${ROCM_DOCKER_ARCH} | ||
# Enable ROCm | ||
ENV LLAMA_HIPBLAS=1 | ||
ENV CC=/opt/rocm/llvm/bin/clang | ||
ENV CXX=/opt/rocm/llvm/bin/clang++ | ||
|
||
RUN make | ||
|
||
ENTRYPOINT [ "/app/server" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
ARG UBUNTU_VERSION=jammy | ||
|
||
FROM ubuntu:$UBUNTU_VERSION as build | ||
|
||
# Install build tools | ||
RUN apt update && apt install -y git build-essential cmake wget | ||
|
||
# Install Vulkan SDK | ||
RUN wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | apt-key add - && \ | ||
wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list && \ | ||
apt update -y && \ | ||
apt-get install -y vulkan-sdk | ||
|
||
# Build it | ||
WORKDIR /app | ||
COPY . . | ||
RUN mkdir build && \ | ||
cd build && \ | ||
cmake .. -DLLAMA_VULKAN=1 && \ | ||
cmake --build . --config Release --target server | ||
|
||
# Clean up | ||
WORKDIR / | ||
RUN cp /app/build/bin/server /server && \ | ||
rm -rf /app | ||
|
||
ENV LC_ALL=C.utf8 | ||
|
||
ENTRYPOINT [ "/server" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
ARG UBUNTU_VERSION=22.04 | ||
|
||
FROM ubuntu:$UBUNTU_VERSION as build | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y build-essential git | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
RUN make | ||
|
||
FROM ubuntu:$UBUNTU_VERSION as runtime | ||
|
||
COPY --from=build /app/server /server | ||
|
||
ENV LC_ALL=C.utf8 | ||
|
||
ENTRYPOINT [ "/server" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"Exclude": ["^\\.gitmodules$"], | ||
"Disable": { | ||
"IndentSize": true | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
[flake8] | ||
max-line-length = 125 | ||
ignore = W503 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.