Skip to content

Commit de8ec13

Browse files
authored
Merge branch 'master' into cisc/test-tokenizers-remote
2 parents 8e1125a + b3a89c3 commit de8ec13

File tree

129 files changed

+6581
-4912
lines changed

Some content is hidden

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

129 files changed

+6581
-4912
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ charset = unset
4949
trim_trailing_whitespace = unset
5050
insert_final_newline = unset
5151

52-
[tools/mtmd/miniaudio.h]
52+
[vendor/miniaudio/miniaudio.h]
5353
trim_trailing_whitespace = unset
5454
insert_final_newline = unset

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ jobs:
2626
sudo apt-get install -y --no-install-recommends \
2727
build-essential \
2828
gcc-14-riscv64-linux-gnu \
29-
g++-14-riscv64-linux-gnu \
30-
libcurl4-openssl-dev:riscv64
29+
g++-14-riscv64-linux-gnu
3130
3231
- name: Build
3332
run: |
34-
cmake -B build -DCMAKE_BUILD_TYPE=Release \
33+
cmake -B build -DLLAMA_CURL=OFF \
34+
-DCMAKE_BUILD_TYPE=Release \
3535
-DGGML_OPENMP=OFF \
3636
-DLLAMA_BUILD_EXAMPLES=ON \
3737
-DLLAMA_BUILD_TOOLS=ON \
@@ -72,12 +72,12 @@ jobs:
7272
glslc \
7373
gcc-14-riscv64-linux-gnu \
7474
g++-14-riscv64-linux-gnu \
75-
libvulkan-dev:riscv64 \
76-
libcurl4-openssl-dev:riscv64
75+
libvulkan-dev:riscv64
7776
7877
- name: Build
7978
run: |
80-
cmake -B build -DCMAKE_BUILD_TYPE=Release \
79+
cmake -B build -DLLAMA_CURL=OFF \
80+
-DCMAKE_BUILD_TYPE=Release \
8181
-DGGML_VULKAN=ON \
8282
-DGGML_OPENMP=OFF \
8383
-DLLAMA_BUILD_EXAMPLES=ON \
@@ -118,12 +118,12 @@ jobs:
118118
build-essential \
119119
glslc \
120120
crossbuild-essential-arm64 \
121-
libvulkan-dev:arm64 \
122-
libcurl4-openssl-dev:arm64
121+
libvulkan-dev:arm64
123122
124123
- name: Build
125124
run: |
126-
cmake -B build -DCMAKE_BUILD_TYPE=Release \
125+
cmake -B build -DLLAMA_CURL=OFF \
126+
-DCMAKE_BUILD_TYPE=Release \
127127
-DGGML_VULKAN=ON \
128128
-DGGML_OPENMP=OFF \
129129
-DLLAMA_BUILD_EXAMPLES=ON \
@@ -163,12 +163,12 @@ jobs:
163163
sudo apt-get install -y --no-install-recommends \
164164
build-essential \
165165
gcc-14-powerpc64le-linux-gnu \
166-
g++-14-powerpc64le-linux-gnu \
167-
libcurl4-openssl-dev:ppc64el
166+
g++-14-powerpc64le-linux-gnu
168167
169168
- name: Build
170169
run: |
171-
cmake -B build -DCMAKE_BUILD_TYPE=Release \
170+
cmake -B build -DLLAMA_CURL=OFF \
171+
-DCMAKE_BUILD_TYPE=Release \
172172
-DGGML_OPENMP=OFF \
173173
-DLLAMA_BUILD_EXAMPLES=ON \
174174
-DLLAMA_BUILD_TOOLS=ON \
@@ -209,12 +209,12 @@ jobs:
209209
glslc \
210210
gcc-14-powerpc64le-linux-gnu \
211211
g++-14-powerpc64le-linux-gnu \
212-
libvulkan-dev:ppc64el \
213-
libcurl4-openssl-dev:ppc64el
212+
libvulkan-dev:ppc64el
214213
215214
- name: Build
216215
run: |
217-
cmake -B build -DCMAKE_BUILD_TYPE=Release \
216+
cmake -B build -DLLAMA_CURL=OFF \
217+
-DCMAKE_BUILD_TYPE=Release \
218218
-DGGML_VULKAN=ON \
219219
-DGGML_OPENMP=OFF \
220220
-DLLAMA_BUILD_EXAMPLES=ON \

common/CMakeLists.txt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,23 +58,20 @@ add_library(${TARGET} STATIC
5858
arg.cpp
5959
arg.h
6060
base64.hpp
61-
chat.cpp
62-
chat.h
6361
chat-parser.cpp
6462
chat-parser.h
63+
chat.cpp
64+
chat.h
6565
common.cpp
6666
common.h
6767
console.cpp
6868
console.h
69-
json-schema-to-grammar.cpp
70-
json.hpp
71-
json-partial.h
7269
json-partial.cpp
70+
json-partial.h
71+
json-schema-to-grammar.cpp
7372
llguidance.cpp
7473
log.cpp
7574
log.h
76-
minja/chat-template.hpp
77-
minja/minja.hpp
7875
ngram-cache.cpp
7976
ngram-cache.h
8077
regex-partial.cpp
@@ -147,7 +144,7 @@ if (LLAMA_LLGUIDANCE)
147144
set(LLAMA_COMMON_EXTRA_LIBS ${LLAMA_COMMON_EXTRA_LIBS} llguidance ${LLGUIDANCE_PLATFORM_LIBS})
148145
endif ()
149146

150-
target_include_directories(${TARGET} PUBLIC .)
147+
target_include_directories(${TARGET} PUBLIC . ../vendor)
151148
target_compile_features (${TARGET} PUBLIC cxx_std_17)
152149
target_link_libraries (${TARGET} PRIVATE ${LLAMA_COMMON_EXTRA_LIBS} PUBLIC llama Threads::Threads)
153150

common/arg.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
#include "gguf.h" // for reading GGUF splits
21
#include "arg.h"
32

3+
#include "chat.h"
44
#include "common.h"
5+
#include "gguf.h" // for reading GGUF splits
6+
#include "json-schema-to-grammar.h"
57
#include "log.h"
68
#include "sampling.h"
7-
#include "chat.h"
89

910
// fix problem with std::min and std::max
1011
#if defined(_WIN32)
@@ -15,6 +16,9 @@
1516
#include <windows.h>
1617
#endif
1718

19+
#define JSON_ASSERT GGML_ASSERT
20+
#include <nlohmann/json.hpp>
21+
1822
#include <algorithm>
1923
#include <climits>
2024
#include <cstdarg>
@@ -34,8 +38,6 @@
3438
#include <future>
3539
#endif
3640

37-
#include "json-schema-to-grammar.h"
38-
3941
using json = nlohmann::ordered_json;
4042

4143
std::initializer_list<enum llama_example> mmproj_examples = {

common/chat-parser.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,10 @@ bool common_chat_msg_parser::try_parse_reasoning(const std::string & start_think
154154
if (!rest.empty()) {
155155
handle_reasoning(rest, /* closed */ !is_partial());
156156
}
157-
if (!syntax_.thinking_forced_open) {
158-
throw common_chat_msg_partial_exception(end_think);
159-
}
157+
// Allow unclosed thinking tags, for now (https://github.com/ggml-org/llama.cpp/issues/13812, https://github.com/ggml-org/llama.cpp/issues/13877)
158+
// if (!syntax_.thinking_forced_open) {
159+
// throw common_chat_msg_partial_exception(end_think);
160+
// }
160161
return true;
161162
}
162163
}

common/chat-parser.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
#include "chat.h"
44
#include "json-partial.h"
5-
#include "json.hpp"
65
#include "regex-partial.h"
76

7+
#include <nlohmann/json.hpp>
8+
89
#include <optional>
910
#include <string>
1011
#include <vector>

common/chat.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
#include "chat.h"
22
#include "chat-parser.h"
33
#include "common.h"
4+
#include "json-partial.h"
45
#include "json-schema-to-grammar.h"
56
#include "log.h"
6-
#include "json-partial.h"
7-
#include "minja/chat-template.hpp"
8-
#include "minja/minja.hpp"
97
#include "regex-partial.h"
108

9+
#include <minja/chat-template.hpp>
10+
#include <minja/minja.hpp>
11+
1112
#include <cstdio>
1213
#include <exception>
1314
#include <iostream>
@@ -16,7 +17,6 @@
1617
#include <string>
1718
#include <vector>
1819

19-
2020
static std::string format_time(const std::chrono::system_clock::time_point & now, const std::string & format) {
2121
auto time = std::chrono::system_clock::to_time_t(now);
2222
auto local_time = *std::localtime(&time);

common/common.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -903,13 +903,16 @@ struct common_init_result common_init_from_params(common_params & params) {
903903
ok = false;
904904
}
905905

906-
if (llama_vocab_eos(vocab) == LLAMA_TOKEN_NULL) {
907-
LOG_WRN("%s: warning: vocab does not have an EOS token, reranking will not work\n", __func__);
908-
ok = false;
909-
}
906+
bool has_eos = llama_vocab_eos(vocab) != LLAMA_TOKEN_NULL;
907+
bool has_sep = llama_vocab_sep(vocab) != LLAMA_TOKEN_NULL;
910908

911-
if (llama_vocab_sep(vocab) == LLAMA_TOKEN_NULL) {
912-
LOG_WRN("%s: warning: vocab does not have a SEP token, reranking will not work\n", __func__);
909+
if (!has_eos && !has_sep) {
910+
LOG_WRN("%s: warning: vocab does not have an EOS token or SEP token, reranking will not work\n", __func__);
911+
ok = false;
912+
} else if (!has_eos) {
913+
LOG_WRN("%s: warning: vocab does not have an EOS token, using SEP token as fallback\n", __func__);
914+
} else if (!has_sep) {
915+
LOG_WRN("%s: warning: vocab does not have a SEP token, reranking will not work\n", __func__);
913916
ok = false;
914917
}
915918

common/json-partial.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
#include <json-partial.h>
2-
#include "ggml.h"
1+
#include "json-partial.h"
2+
33
#include "log.h"
4-
#include <string>
54

6-
#include <json.hpp>
5+
#include <nlohmann/json.hpp>
6+
7+
#include <string>
78

89
using json = nlohmann::ordered_json;
910

common/json-partial.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#pragma once
2-
#include <json.hpp>
2+
3+
#include <nlohmann/json.hpp>
34

45
// Healing marker (empty if the JSON was fully parsed / wasn't healed).
56
struct common_healing_marker {

0 commit comments

Comments
 (0)