Skip to content

Commit 6c2e420

Browse files
authored
Merge branch 'ggml-org:master' into master
2 parents 593b8fa + 624207e commit 6c2e420

Some content is hidden

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

47 files changed

+619
-319
lines changed

.github/workflows/build-linux-cross.yml

Lines changed: 0 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -141,97 +141,6 @@ jobs:
141141

142142
# cmake --build build --config Release -j $(nproc)
143143

144-
ubuntu-24-ppc64el-cpu-cross:
145-
runs-on: ubuntu-24.04
146-
147-
steps:
148-
- uses: actions/checkout@v4
149-
- name: Setup PowerPC64le
150-
run: |
151-
sudo dpkg --add-architecture ppc64el
152-
153-
# Add arch-specific repositories for non-amd64 architectures
154-
cat << EOF | sudo tee /etc/apt/sources.list.d/ppc64el-ports.list
155-
deb [arch=ppc64el] http://ports.ubuntu.com/ubuntu-ports/ noble main universe
156-
deb [arch=ppc64el] http://ports.ubuntu.com/ubuntu-ports/ noble-updates main universe
157-
deb [arch=ppc64el] http://ports.ubuntu.com/ubuntu-ports/ noble-security main universe
158-
deb [arch=ppc64el] http://ports.ubuntu.com/ubuntu-ports/ noble-backports main universe
159-
EOF
160-
161-
sudo apt-get update || true ;# Prevent failure due to missing URLs.
162-
163-
sudo apt-get install -y --no-install-recommends \
164-
build-essential \
165-
gcc-14-powerpc64le-linux-gnu \
166-
g++-14-powerpc64le-linux-gnu
167-
168-
- name: Build
169-
run: |
170-
cmake -B build -DLLAMA_CURL=OFF \
171-
-DCMAKE_BUILD_TYPE=Release \
172-
-DGGML_OPENMP=OFF \
173-
-DLLAMA_BUILD_EXAMPLES=ON \
174-
-DLLAMA_BUILD_TOOLS=ON \
175-
-DLLAMA_BUILD_TESTS=OFF \
176-
-DCMAKE_SYSTEM_NAME=Linux \
177-
-DCMAKE_SYSTEM_PROCESSOR=ppc64 \
178-
-DCMAKE_C_COMPILER=powerpc64le-linux-gnu-gcc-14 \
179-
-DCMAKE_CXX_COMPILER=powerpc64le-linux-gnu-g++-14 \
180-
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
181-
-DCMAKE_FIND_ROOT_PATH=/usr/lib/powerpc64le-linux-gnu \
182-
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
183-
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
184-
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH
185-
186-
cmake --build build --config Release -j $(nproc)
187-
188-
# ubuntu-24-ppc64el-vulkan-cross:
189-
# runs-on: ubuntu-24.04
190-
191-
# steps:
192-
# - uses: actions/checkout@v4
193-
# - name: Setup PowerPC64le
194-
# run: |
195-
# sudo dpkg --add-architecture ppc64el
196-
197-
# # Add arch-specific repositories for non-amd64 architectures
198-
# cat << EOF | sudo tee /etc/apt/sources.list.d/ppc64el-ports.list
199-
# deb [arch=ppc64el] http://ports.ubuntu.com/ubuntu-ports/ noble main universe
200-
# deb [arch=ppc64el] http://ports.ubuntu.com/ubuntu-ports/ noble-updates main universe
201-
# deb [arch=ppc64el] http://ports.ubuntu.com/ubuntu-ports/ noble-security main universe
202-
# deb [arch=ppc64el] http://ports.ubuntu.com/ubuntu-ports/ noble-backports main universe
203-
# EOF
204-
205-
# sudo apt-get update || true ;# Prevent failure due to missing URLs.
206-
207-
# sudo apt-get install -y --no-install-recommends \
208-
# build-essential \
209-
# glslc \
210-
# gcc-14-powerpc64le-linux-gnu \
211-
# g++-14-powerpc64le-linux-gnu \
212-
# libvulkan-dev:ppc64el
213-
214-
# - name: Build
215-
# run: |
216-
# cmake -B build -DLLAMA_CURL=OFF \
217-
# -DCMAKE_BUILD_TYPE=Release \
218-
# -DGGML_VULKAN=ON \
219-
# -DGGML_OPENMP=OFF \
220-
# -DLLAMA_BUILD_EXAMPLES=ON \
221-
# -DLLAMA_BUILD_TOOLS=ON \
222-
# -DLLAMA_BUILD_TESTS=OFF \
223-
# -DCMAKE_SYSTEM_NAME=Linux \
224-
# -DCMAKE_SYSTEM_PROCESSOR=ppc64 \
225-
# -DCMAKE_C_COMPILER=powerpc64le-linux-gnu-gcc-14 \
226-
# -DCMAKE_CXX_COMPILER=powerpc64le-linux-gnu-g++-14 \
227-
# -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
228-
# -DCMAKE_FIND_ROOT_PATH=/usr/lib/powerpc64le-linux-gnu \
229-
# -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
230-
# -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
231-
# -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH
232-
233-
# cmake --build build --config Release -j $(nproc)
234-
235144
debian-13-loongarch64-cpu-cross:
236145
runs-on: ubuntu-24.04
237146
container: debian@sha256:653dfb9f86c3782e8369d5f7d29bb8faba1f4bff9025db46e807fa4c22903671

.github/workflows/build.yml

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ jobs:
192192
os: ubuntu-22.04
193193
- build: 'arm64'
194194
os: ubuntu-22.04-arm
195+
- build: 's390x'
196+
os: ubuntu-24.04-s390x
197+
- build: 'ppc64le'
198+
os: ubuntu-24.04-ppc64le
195199

196200
runs-on: ${{ matrix.os }}
197201

@@ -206,11 +210,28 @@ jobs:
206210
key: ubuntu-cpu-cmake
207211
evict-old-files: 1d
208212

209-
- name: Dependencies
210-
id: depends
213+
- name: Build Dependencies
214+
id: build_depends
211215
run: |
212216
sudo apt-get update
213-
sudo apt-get install build-essential libcurl4-openssl-dev
217+
sudo apt-get install -y --no-install-recommends \
218+
python3 python3-pip python3-dev \
219+
libjpeg-dev build-essential libcurl4-openssl-dev \
220+
git-lfs
221+
222+
- name: Python Dependencies
223+
id: python_depends
224+
run: |
225+
python3 -m pip install --upgrade pip
226+
pip3 install ./gguf-py
227+
228+
- name: Swap Endianness
229+
id: endianness
230+
if: ${{ matrix.build == 's390x' }}
231+
run: |
232+
for f in models/*.gguf; do
233+
echo YES | python3 gguf-py/gguf/scripts/gguf_convert_endian.py $f big
234+
done
214235
215236
- name: Build
216237
id: cmake_build
@@ -228,6 +249,7 @@ jobs:
228249
229250
- name: Test llama2c conversion
230251
id: llama2c_test
252+
if: ${{ matrix.build != 's390x' }}
231253
run: |
232254
cd build
233255
echo "Fetch tokenizer"
@@ -237,6 +259,15 @@ jobs:
237259
./bin/llama-convert-llama2c-to-ggml --copy-vocab-from-model ./tok512.bin --llama2c-model stories260K.bin --llama2c-output-model stories260K.gguf
238260
./bin/llama-cli -m stories260K.gguf -p "One day, Lily met a Shoggoth" -n 500 -c 256
239261
262+
- name: Test llama2c (s390x)
263+
id: llama2c_test_s390x
264+
if: ${{ matrix.build == 's390x' }}
265+
run: |
266+
cd build
267+
echo "Fetch llama2c big-endian model"
268+
wget https://huggingface.co/ggml-org/models/resolve/main/tinyllamas/stories260K-be.gguf
269+
./bin/llama-cli -m stories260K-be.gguf -p "One day, Lily met a Shoggoth" -n 500 -c 256
270+
240271
ubuntu-latest-cmake-sanitizer:
241272
runs-on: ubuntu-latest
242273

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,6 @@ poetry.toml
149149
/run-chat.sh
150150
.ccache/
151151

152-
# Code Workspace
152+
# IDE
153153
*.code-workspace
154-
154+
.windsurf/

.windsurf/rules/css-architecture.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

.windsurf/rules/sveltekit-architecture.md

Lines changed: 0 additions & 48 deletions
This file was deleted.

.windsurf/rules/tests.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

.windsurf/rules/typescript-architecture.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
/ggml/src/ggml-metal/ @ggerganov
6262
/ggml/src/ggml-opt.cpp @JohannesGaessler
6363
/ggml/src/ggml-quants.* @ggerganov
64+
/ggml/src/ggml-rpc/ @rgerganov
6465
/ggml/src/ggml-threading.* @ggerganov @slaren
6566
/ggml/src/ggml-vulkan/ @0cc4m
6667
/ggml/src/ggml-zdnn/ @taronaeo @Andreas-Krebbel @AlekseiNikiforovIBM
@@ -89,6 +90,7 @@
8990
/tools/mtmd/ @ngxson
9091
/tools/perplexity/ @ggerganov
9192
/tools/quantize/ @ggerganov
93+
/tools/rpc/ @rgerganov
9294
/tools/run/ @ericcurtin
9395
/tools/server/* @ngxson @ggerganov @ericcurtin # no subdir
9496
/tools/server/webui/ @allozaur

common/common.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@
5151
#include <unistd.h>
5252
#endif
5353

54+
#if defined(__linux__)
55+
#include <sys/types.h>
56+
#include <pwd.h>
57+
#endif
58+
5459
#if defined(_MSC_VER)
5560
#pragma warning(disable: 4244 4267) // possible loss of data
5661
#endif
@@ -865,8 +870,20 @@ std::string fs_get_cache_directory() {
865870
#if defined(__linux__) || defined(__FreeBSD__) || defined(_AIX) || defined(__OpenBSD__)
866871
if (std::getenv("XDG_CACHE_HOME")) {
867872
cache_directory = std::getenv("XDG_CACHE_HOME");
868-
} else {
873+
} else if (std::getenv("HOME")) {
869874
cache_directory = std::getenv("HOME") + std::string("/.cache/");
875+
} else {
876+
#if defined(__linux__)
877+
/* no $HOME is defined, fallback to getpwuid */
878+
struct passwd *pw = getpwuid(getuid());
879+
if ((!pw) || (!pw->pw_dir)) {
880+
throw std::runtime_error("Failed to find $HOME directory");
881+
}
882+
883+
cache_directory = std::string(pw->pw_dir) + std::string("/.cache/");
884+
#else /* defined(__linux__) */
885+
throw std::runtime_error("Failed to find $HOME directory");
886+
#endif /* defined(__linux__) */
870887
}
871888
#elif defined(__APPLE__)
872889
cache_directory = std::getenv("HOME") + std::string("/Library/Caches/");

examples/eval-callback/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ target_link_libraries(${TARGET} PRIVATE common llama ${CMAKE_THREAD_LIBS_INIT})
55
target_compile_features(${TARGET} PRIVATE cxx_std_17)
66

77
set(TEST_TARGET test-eval-callback)
8-
add_test(NAME ${TEST_TARGET}
9-
COMMAND llama-eval-callback --hf-repo ggml-org/models --hf-file tinyllamas/stories260K.gguf --model stories260K.gguf --prompt hello --seed 42 -ngl 0)
8+
if(NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "s390x")
9+
add_test(NAME ${TEST_TARGET}
10+
COMMAND llama-eval-callback --hf-repo ggml-org/models --hf-file tinyllamas/stories260K.gguf --model stories260K.gguf --prompt hello --seed 42 -ngl 0)
11+
else()
12+
add_test(NAME ${TEST_TARGET}
13+
COMMAND llama-eval-callback --hf-repo ggml-org/models --hf-file tinyllamas/stories260K-be.gguf --model stories260K-be.gguf --prompt hello --seed 42 -ngl 0)
14+
endif()
1015
set_property(TEST ${TEST_TARGET} PROPERTY LABELS eval-callback curl)

0 commit comments

Comments
 (0)