Skip to content

Commit 905f6d9

Browse files
committed
Merge branch 'concedo_experimental' into esocrok
2 parents cb2cb40 + 26e9090 commit 905f6d9

Some content is hidden

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

72 files changed

+12442
-10866
lines changed

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,11 @@ end_of_line = unset
6060
charset = unset
6161
trim_trailing_whitespace = unset
6262
insert_final_newline = unset
63+
64+
[benches/**]
65+
indent_style = unset
66+
indent_size = unset
67+
end_of_line = unset
68+
charset = unset
69+
trim_trailing_whitespace = unset
70+
insert_final_newline = unset

.github/workflows/check-vendor.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Check vendor
2+
3+
on:
4+
workflow_dispatch: # allows manual triggering
5+
push:
6+
branches:
7+
- master
8+
paths: [
9+
'vendor/**',
10+
'scripts/sync_vendor.py'
11+
]
12+
13+
pull_request:
14+
types: [opened, synchronize, reopened]
15+
paths: [
16+
'vendor/**',
17+
'scripts/sync_vendor.py'
18+
]
19+
20+
jobs:
21+
check-vendor:
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Setup Python
31+
uses: actions/setup-python@v4
32+
with:
33+
python-version: '3.x'
34+
35+
- name: Run vendor sync
36+
run: |
37+
set -euo pipefail
38+
python3 scripts/sync_vendor.py
39+
40+
- name: Check for changes
41+
run: |
42+
set -euo pipefail
43+
# detect modified or untracked files
44+
changed=$(git status --porcelain --untracked-files=all || true)
45+
if [ -n "$changed" ]; then
46+
echo "Vendor sync modified files:"
47+
echo "$changed" | awk '{ print $2 }' | sed '/^$/d'
48+
echo "Failing because vendor files mismatch. Please update scripts/sync_vendor.py"
49+
exit 1
50+
else
51+
echo "Vendor files are up-to-date."
52+
fi

.github/workflows/kcpp-build-release-arm64.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
apt-get update && apt-get install -y build-essential && \
7272
apt-get update && apt-get install -y gcc-12 g++-12 && \
7373
export LD_LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/12:$LD_LIBRARY_PATH && \
74-
pip install customtkinter pyinstaller tk pdfplumber PyMuPdf tqdm && \
74+
pip install customtkinter pyinstaller tk jinja2 pdfplumber PyMuPdf tqdm && \
7575
cd /src && \
7676
pyinstaller --noconfirm --onefile --collect-all customtkinter --collect-all jinja2 --collect-all psutil --collect-all pdfplumber --collect-all PyMuPdf --collect-all tqdm \
7777
--add-data './koboldcpp_default.so:.' \

.github/workflows/kcpp-build-release-macos.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Dependencies
2929
id: depends
3030
run: |
31-
pip install customtkinter pyinstaller tk pdfplumber PyMuPdf tqdm
31+
pip install customtkinter pyinstaller tk jinja2 pdfplumber PyMuPdf tqdm
3232
3333
- name: Build
3434
id: make_build

.github/workflows/kcpp-build-release-win-olderpc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Install python dependencies
3434
run: |
3535
python -m pip install --upgrade pip
36-
pip install customtkinter==5.2.0 pyinstaller==5.12.0 psutil==5.9.5
36+
pip install customtkinter==5.2.0 pyinstaller==5.12.0 psutil==5.9.5 jinja2==3.1.6
3737
3838
- name: Display full Visual Studio info Before
3939
run: |

.github/workflows/kcpp-build-release-win-oldpc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Install python dependencies
3434
run: |
3535
python -m pip install --upgrade pip
36-
pip install customtkinter==5.2.0 pyinstaller==5.12.0 psutil==5.9.5 pdfplumber PyMuPdf tqdm
36+
pip install customtkinter==5.2.0 pyinstaller==5.12.0 psutil==5.9.5 jinja2==3.1.6 pdfplumber PyMuPdf tqdm
3737
3838
- name: Display full Visual Studio info Before
3939
run: |

.github/workflows/kcpp-build-release-win.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Install python dependencies
3434
run: |
3535
python -m pip install --upgrade pip
36-
pip install customtkinter==5.2.0 pyinstaller==5.12.0 psutil==5.9.5 pdfplumber PyMuPdf tqdm
36+
pip install customtkinter==5.2.0 pyinstaller==5.12.0 psutil==5.9.5 jinja2==3.1.6 pdfplumber PyMuPdf tqdm
3737
3838
- name: Display full Visual Studio info Before
3939
run: |

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ sampling.o: common/sampling.cpp common/common.h common/sampling.h common/log.h
715715
$(CXX) $(CXXFLAGS) -c $< -o $@
716716
console.o: common/console.cpp common/console.h
717717
$(CXX) $(CXXFLAGS) -c $< -o $@
718-
expose.o: expose.cpp expose.h
718+
expose.o: expose.cpp expose.h model_adapter.cpp
719719
$(CXX) $(CXXFLAGS) -c $< -o $@
720720

721721
# sd.cpp objects
@@ -730,6 +730,8 @@ sdcpp_vulkan.o: otherarch/sdcpp/sdtype_adapter.cpp otherarch/sdcpp/stable-diffus
730730
#whisper objects
731731
whispercpp_default.o: otherarch/whispercpp/whisper_adapter.cpp
732732
$(CXX) $(CXXFLAGS) -c $< -o $@
733+
whispercpp_vulkan.o: otherarch/whispercpp/whisper_adapter.cpp
734+
$(CXX) $(CXXFLAGS) $(VULKAN_FLAGS) -c $< -o $@
733735
whispercpp_cublas.o: otherarch/whispercpp/whisper_adapter.cpp
734736
$(CXX) $(CXXFLAGS) $(CUBLAS_FLAGS) $(HIPFLAGS) -c $< -o $@
735737

@@ -942,10 +944,10 @@ koboldcpp_hipblas:
942944
endif
943945

944946
ifdef VULKAN_BUILD
945-
koboldcpp_vulkan: ggml_v4_vulkan.o ggml-cpu.o ggml-ops.o ggml-vec.o ggml-binops.o ggml-unops.o ggml_v3.o ggml_v2.o ggml_v1.o expose.o gpttype_adapter_vulkan.o ggml-vulkan.o ggml-vulkan-shaders.o sdcpp_vulkan.o whispercpp_default.o tts_default.o embeddings_default.o llavaclip_vulkan.o llava.o ggml-backend_vulkan.o ggml-backend-reg_vulkan.o ggml-repack.o $(OBJS_FULL) $(OBJS)
947+
koboldcpp_vulkan: ggml_v4_vulkan.o ggml-cpu.o ggml-ops.o ggml-vec.o ggml-binops.o ggml-unops.o ggml_v3.o ggml_v2.o ggml_v1.o expose.o gpttype_adapter_vulkan.o ggml-vulkan.o ggml-vulkan-shaders.o sdcpp_vulkan.o whispercpp_vulkan.o tts_default.o embeddings_default.o llavaclip_vulkan.o llava.o ggml-backend_vulkan.o ggml-backend-reg_vulkan.o ggml-repack.o $(OBJS_FULL) $(OBJS)
946948
$(VULKAN_BUILD)
947949
ifdef NOAVX2_BUILD
948-
koboldcpp_vulkan_noavx2: ggml_v4_vulkan_noavx2.o ggml-cpu_v4_noavx2.o ggml-ops-noavx2.o ggml-vec-noavx2.o ggml-binops.o ggml-unops.o ggml_v3_noavx2.o ggml_v2_noavx2.o ggml_v1_failsafe.o expose.o gpttype_adapter_vulkan_noavx2.o ggml-vulkan-noext.o ggml-vulkan-shaders-noext.o sdcpp_vulkan.o whispercpp_default.o tts_default.o embeddings_default.o llavaclip_vulkan.o llava.o ggml-backend_vulkan.o ggml-backend-reg_vulkan.o ggml-repack.o $(OBJS_SIMPLE) $(OBJS)
950+
koboldcpp_vulkan_noavx2: ggml_v4_vulkan_noavx2.o ggml-cpu_v4_noavx2.o ggml-ops-noavx2.o ggml-vec-noavx2.o ggml-binops.o ggml-unops.o ggml_v3_noavx2.o ggml_v2_noavx2.o ggml_v1_failsafe.o expose.o gpttype_adapter_vulkan_noavx2.o ggml-vulkan-noext.o ggml-vulkan-shaders-noext.o sdcpp_vulkan.o whispercpp_vulkan.o tts_default.o embeddings_default.o llavaclip_vulkan.o llava.o ggml-backend_vulkan.o ggml-backend-reg_vulkan.o ggml-repack.o $(OBJS_SIMPLE) $(OBJS)
949951
$(VULKAN_BUILD)
950952
else
951953
koboldcpp_vulkan_noavx2:

common/arg.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,20 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
742742
exit(0);
743743
}
744744
));
745+
add_opt(common_arg(
746+
{"-cl", "--cache-list"},
747+
"show list of models in cache",
748+
[](common_params &) {
749+
printf("model cache directory: %s\n", fs_get_cache_directory().c_str());
750+
auto models = common_list_cached_models();
751+
printf("number of models in cache: %zu\n", models.size());
752+
for (size_t i = 0; i < models.size(); i++) {
753+
auto & model = models[i];
754+
printf("%4d. %s\n", (int) i + 1, model.to_string().c_str());
755+
}
756+
exit(0);
757+
}
758+
));
745759
add_opt(common_arg(
746760
{"--completion-bash"},
747761
"print source-able bash completion script for llama.cpp",
@@ -2241,6 +2255,13 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
22412255
params.is_pp_shared = true;
22422256
}
22432257
).set_examples({LLAMA_EXAMPLE_BENCH, LLAMA_EXAMPLE_PARALLEL}));
2258+
add_opt(common_arg(
2259+
{"-tgs"},
2260+
string_format("is the text generation separated across the different sequences (default: %s)", params.is_tg_separate ? "true" : "false"),
2261+
[](common_params & params) {
2262+
params.is_tg_separate = true;
2263+
}
2264+
).set_examples({LLAMA_EXAMPLE_BENCH, LLAMA_EXAMPLE_PARALLEL}));
22442265
add_opt(common_arg(
22452266
{"-npp"}, "n0,n1,...",
22462267
"number of prompt tokens",

common/common.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,39 @@ std::string fs_get_cache_file(const std::string & filename) {
916916
return cache_directory + filename;
917917
}
918918

919+
std::vector<common_file_info> fs_list_files(const std::string & path) {
920+
std::vector<common_file_info> files;
921+
if (path.empty()) return files;
922+
923+
std::filesystem::path dir(path);
924+
if (!std::filesystem::exists(dir) || !std::filesystem::is_directory(dir)) {
925+
return files;
926+
}
927+
928+
for (const auto & entry : std::filesystem::directory_iterator(dir)) {
929+
try {
930+
// Only include regular files (skip directories)
931+
const auto & p = entry.path();
932+
if (std::filesystem::is_regular_file(p)) {
933+
common_file_info info;
934+
info.path = p.string();
935+
info.name = p.filename().string();
936+
try {
937+
info.size = static_cast<size_t>(std::filesystem::file_size(p));
938+
} catch (const std::filesystem::filesystem_error &) {
939+
info.size = 0;
940+
}
941+
files.push_back(std::move(info));
942+
}
943+
} catch (const std::filesystem::filesystem_error &) {
944+
// skip entries we cannot inspect
945+
continue;
946+
}
947+
}
948+
949+
return files;
950+
}
951+
919952

920953
//
921954
// Model utils

0 commit comments

Comments
 (0)