Skip to content

Commit 0f417cf

Browse files
authored
Merge pull request #4 from NexaAI/remilia/update_remote
Remilia/update remote
2 parents a0cac80 + 34b99d0 commit 0f417cf

Some content is hidden

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

85 files changed

+5752
-1863
lines changed

.clang-format

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ AllowShortIfStatementsOnASingleLine: Never
2222
AllowShortLambdasOnASingleLine: Inline
2323
AllowShortLoopsOnASingleLine: false
2424
AlwaysBreakBeforeMultilineStrings: true
25-
BinPackArguments: true
26-
BinPackParameters: true # OnePerLine
25+
BinPackArguments: false
26+
BinPackParameters: false # OnePerLine
2727
BitFieldColonSpacing: Both
2828
BreakBeforeBraces: Custom # Attach
2929
BraceWrapping:
@@ -70,15 +70,18 @@ ExperimentalAutoDetectBinPacking: false
7070
FixNamespaceComments: true
7171
IncludeBlocks: Regroup
7272
IncludeCategories:
73-
- Regex: '^<.*\.h>'
73+
- Regex: '".*"'
7474
Priority: 1
7575
SortPriority: 0
76-
- Regex: '^<.*'
76+
- Regex: '^<.*\.h>'
7777
Priority: 2
7878
SortPriority: 0
79-
- Regex: '.*'
79+
- Regex: '^<.*'
8080
Priority: 3
8181
SortPriority: 0
82+
- Regex: '.*'
83+
Priority: 4
84+
SortPriority: 0
8285
IncludeIsMainRegex: '([-_](test|unittest))?$'
8386
IncludeIsMainSourceRegex: ''
8487
IndentAccessModifiers: false

.devops/nix/package.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ let
4747
inherit (lib)
4848
cmakeBool
4949
cmakeFeature
50+
optionalAttrs
5051
optionals
5152
strings
5253
;
@@ -197,7 +198,7 @@ effectiveStdenv.mkDerivation (finalAttrs: {
197198
];
198199

199200
# Environment variables needed for ROCm
200-
env = optionals useRocm {
201+
env = optionalAttrs useRocm {
201202
ROCM_PATH = "${rocmPackages.clr}";
202203
HIP_DEVICE_LIB_PATH = "${rocmPackages.rocm-device-libs}/amdgcn/bitcode";
203204
};

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

Lines changed: 138 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -48,98 +48,98 @@ jobs:
4848
4949
cmake --build build --config Release -j $(nproc)
5050
51-
ubuntu-24-riscv64-vulkan-cross:
52-
runs-on: ubuntu-24.04
53-
54-
steps:
55-
- uses: actions/checkout@v4
56-
- name: Setup Riscv
57-
run: |
58-
sudo dpkg --add-architecture riscv64
59-
60-
# Add arch-specific repositories for non-amd64 architectures
61-
cat << EOF | sudo tee /etc/apt/sources.list.d/riscv64-ports.list
62-
deb [arch=riscv64] http://ports.ubuntu.com/ubuntu-ports/ noble main universe
63-
deb [arch=riscv64] http://ports.ubuntu.com/ubuntu-ports/ noble-updates main universe
64-
deb [arch=riscv64] http://ports.ubuntu.com/ubuntu-ports/ noble-security main universe
65-
deb [arch=riscv64] http://ports.ubuntu.com/ubuntu-ports/ noble-backports main universe
66-
EOF
67-
68-
sudo apt-get update || true ;# Prevent failure due to missing URLs.
69-
70-
sudo apt-get install -y --no-install-recommends \
71-
build-essential \
72-
glslc \
73-
gcc-14-riscv64-linux-gnu \
74-
g++-14-riscv64-linux-gnu \
75-
libvulkan-dev:riscv64
76-
77-
- name: Build
78-
run: |
79-
cmake -B build -DLLAMA_CURL=OFF \
80-
-DCMAKE_BUILD_TYPE=Release \
81-
-DGGML_VULKAN=ON \
82-
-DGGML_OPENMP=OFF \
83-
-DLLAMA_BUILD_EXAMPLES=ON \
84-
-DLLAMA_BUILD_TOOLS=ON \
85-
-DLLAMA_BUILD_TESTS=OFF \
86-
-DCMAKE_SYSTEM_NAME=Linux \
87-
-DCMAKE_SYSTEM_PROCESSOR=riscv64 \
88-
-DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
89-
-DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14 \
90-
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
91-
-DCMAKE_FIND_ROOT_PATH=/usr/lib/riscv64-linux-gnu \
92-
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
93-
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
94-
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH
95-
96-
cmake --build build --config Release -j $(nproc)
97-
98-
ubuntu-24-arm64-vulkan-cross:
99-
runs-on: ubuntu-24.04
100-
101-
steps:
102-
- uses: actions/checkout@v4
103-
- name: Setup Arm64
104-
run: |
105-
sudo dpkg --add-architecture arm64
106-
107-
# Add arch-specific repositories for non-amd64 architectures
108-
cat << EOF | sudo tee /etc/apt/sources.list.d/arm64-ports.list
109-
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ noble main universe
110-
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ noble-updates main universe
111-
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ noble-security main universe
112-
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ noble-backports main universe
113-
EOF
114-
115-
sudo apt-get update || true ;# Prevent failure due to missing URLs.
116-
117-
sudo apt-get install -y --no-install-recommends \
118-
build-essential \
119-
glslc \
120-
crossbuild-essential-arm64 \
121-
libvulkan-dev:arm64
122-
123-
- name: Build
124-
run: |
125-
cmake -B build -DLLAMA_CURL=OFF \
126-
-DCMAKE_BUILD_TYPE=Release \
127-
-DGGML_VULKAN=ON \
128-
-DGGML_OPENMP=OFF \
129-
-DLLAMA_BUILD_EXAMPLES=ON \
130-
-DLLAMA_BUILD_TOOLS=ON \
131-
-DLLAMA_BUILD_TESTS=OFF \
132-
-DCMAKE_SYSTEM_NAME=Linux \
133-
-DCMAKE_SYSTEM_PROCESSOR=aarch64 \
134-
-DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \
135-
-DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \
136-
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
137-
-DCMAKE_FIND_ROOT_PATH=/usr/lib/aarch64-linux-gnu \
138-
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
139-
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
140-
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH
141-
142-
cmake --build build --config Release -j $(nproc)
51+
# ubuntu-24-riscv64-vulkan-cross:
52+
# runs-on: ubuntu-24.04
53+
54+
# steps:
55+
# - uses: actions/checkout@v4
56+
# - name: Setup Riscv
57+
# run: |
58+
# sudo dpkg --add-architecture riscv64
59+
60+
# # Add arch-specific repositories for non-amd64 architectures
61+
# cat << EOF | sudo tee /etc/apt/sources.list.d/riscv64-ports.list
62+
# deb [arch=riscv64] http://ports.ubuntu.com/ubuntu-ports/ noble main universe
63+
# deb [arch=riscv64] http://ports.ubuntu.com/ubuntu-ports/ noble-updates main universe
64+
# deb [arch=riscv64] http://ports.ubuntu.com/ubuntu-ports/ noble-security main universe
65+
# deb [arch=riscv64] http://ports.ubuntu.com/ubuntu-ports/ noble-backports main universe
66+
# EOF
67+
68+
# sudo apt-get update || true ;# Prevent failure due to missing URLs.
69+
70+
# sudo apt-get install -y --no-install-recommends \
71+
# build-essential \
72+
# glslc \
73+
# gcc-14-riscv64-linux-gnu \
74+
# g++-14-riscv64-linux-gnu \
75+
# libvulkan-dev:riscv64
76+
77+
# - name: Build
78+
# run: |
79+
# cmake -B build -DLLAMA_CURL=OFF \
80+
# -DCMAKE_BUILD_TYPE=Release \
81+
# -DGGML_VULKAN=ON \
82+
# -DGGML_OPENMP=OFF \
83+
# -DLLAMA_BUILD_EXAMPLES=ON \
84+
# -DLLAMA_BUILD_TOOLS=ON \
85+
# -DLLAMA_BUILD_TESTS=OFF \
86+
# -DCMAKE_SYSTEM_NAME=Linux \
87+
# -DCMAKE_SYSTEM_PROCESSOR=riscv64 \
88+
# -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
89+
# -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14 \
90+
# -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
91+
# -DCMAKE_FIND_ROOT_PATH=/usr/lib/riscv64-linux-gnu \
92+
# -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
93+
# -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
94+
# -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH
95+
96+
# cmake --build build --config Release -j $(nproc)
97+
98+
# ubuntu-24-arm64-vulkan-cross:
99+
# runs-on: ubuntu-24.04
100+
101+
# steps:
102+
# - uses: actions/checkout@v4
103+
# - name: Setup Arm64
104+
# run: |
105+
# sudo dpkg --add-architecture arm64
106+
107+
# # Add arch-specific repositories for non-amd64 architectures
108+
# cat << EOF | sudo tee /etc/apt/sources.list.d/arm64-ports.list
109+
# deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ noble main universe
110+
# deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ noble-updates main universe
111+
# deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ noble-security main universe
112+
# deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ noble-backports main universe
113+
# EOF
114+
115+
# sudo apt-get update || true ;# Prevent failure due to missing URLs.
116+
117+
# sudo apt-get install -y --no-install-recommends \
118+
# build-essential \
119+
# glslc \
120+
# crossbuild-essential-arm64 \
121+
# libvulkan-dev:arm64
122+
123+
# - name: Build
124+
# run: |
125+
# cmake -B build -DLLAMA_CURL=OFF \
126+
# -DCMAKE_BUILD_TYPE=Release \
127+
# -DGGML_VULKAN=ON \
128+
# -DGGML_OPENMP=OFF \
129+
# -DLLAMA_BUILD_EXAMPLES=ON \
130+
# -DLLAMA_BUILD_TOOLS=ON \
131+
# -DLLAMA_BUILD_TESTS=OFF \
132+
# -DCMAKE_SYSTEM_NAME=Linux \
133+
# -DCMAKE_SYSTEM_PROCESSOR=aarch64 \
134+
# -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \
135+
# -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \
136+
# -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
137+
# -DCMAKE_FIND_ROOT_PATH=/usr/lib/aarch64-linux-gnu \
138+
# -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
139+
# -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
140+
# -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH
141+
142+
# cmake --build build --config Release -j $(nproc)
143143

144144
ubuntu-24-ppc64el-cpu-cross:
145145
runs-on: ubuntu-24.04
@@ -185,52 +185,52 @@ jobs:
185185
186186
cmake --build build --config Release -j $(nproc)
187187
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)
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)
234234

235235
debian-13-loongarch64-cpu-cross:
236236
runs-on: ubuntu-24.04

.github/workflows/close-issue.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
steps:
1818
- uses: actions/stale@v5
1919
with:
20-
exempt-issue-labels: "refactor,help wanted,good first issue,research,bug,roadmap"
20+
exempt-issue-labels: "refactoring,help wanted,good first issue,research,bug,roadmap"
2121
days-before-issue-stale: 30
2222
days-before-issue-close: 14
2323
stale-issue-label: "stale"

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
/ggml/src/ggml-cuda/mmvq.* @JohannesGaessler
1010
/ggml/src/ggml-opt.cpp @JohannesGaessler
1111
/ggml/src/gguf.cpp @JohannesGaessler
12+
/ggml/src/ggml-vulkan/ @0cc4m

common/arg.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1612,7 +1612,7 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
16121612
[](common_params & params, const std::string & value) {
16131613
params.antiprompt.emplace_back(value);
16141614
}
1615-
).set_examples({LLAMA_EXAMPLE_MAIN}));
1615+
).set_examples({LLAMA_EXAMPLE_MAIN, LLAMA_EXAMPLE_SERVER}));
16161616
add_opt(common_arg(
16171617
{"-sp", "--special"},
16181618
string_format("special tokens output enabled (default: %s)", params.special ? "true" : "false"),
@@ -2655,6 +2655,13 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
26552655
params.i_chunk = value;
26562656
}
26572657
).set_examples({LLAMA_EXAMPLE_IMATRIX}));
2658+
add_opt(common_arg(
2659+
{"--show-statistics"},
2660+
string_format("show imatrix statistics and then exit (default: %s)", params.show_statistics ? "true" : "false"),
2661+
[](common_params & params) {
2662+
params.show_statistics = true;
2663+
}
2664+
).set_examples({LLAMA_EXAMPLE_IMATRIX}));
26582665
add_opt(common_arg(
26592666
{"--parse-special"},
26602667
string_format("prase special tokens (chat, tool, etc) (default: %s)", params.parse_special ? "true" : "false"),

common/common.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,15 @@ void string_replace_all(std::string & s, const std::string & search, const std::
448448
bool string_ends_with(const std::string_view & str, const std::string_view & suffix) {
449449
return str.size() >= suffix.size() && str.compare(str.size()-suffix.size(), suffix.size(), suffix) == 0;
450450
}
451+
452+
bool string_remove_suffix(std::string & str, const std::string_view & suffix) {
453+
bool has_suffix = string_ends_with(str, suffix);
454+
if (has_suffix) {
455+
str = str.substr(0, str.size() - suffix.size());
456+
}
457+
return has_suffix;
458+
}
459+
451460
size_t string_find_partial_stop(const std::string_view & str, const std::string_view & stop) {
452461
if (!str.empty() && !stop.empty()) {
453462
const char text_last_char = str.back();

0 commit comments

Comments
 (0)