Skip to content

Commit 26e9090

Browse files
committed
Merge branch 'upstream' into concedo_experimental
# Conflicts: # .devops/cann.Dockerfile # .devops/cpu.Dockerfile # .devops/cuda.Dockerfile # .devops/intel.Dockerfile # .devops/musa.Dockerfile # .devops/nix/package.nix # .devops/rocm.Dockerfile # .devops/vulkan.Dockerfile # .github/workflows/build.yml # .github/workflows/server.yml # CMakeLists.txt # build-xcframework.sh # ci/run.sh # common/CMakeLists.txt # common/download.cpp # docs/backend/CANN.md # docs/ops.md # docs/ops/SYCL.csv # ggml/src/CMakeLists.txt # ggml/src/ggml-cann/aclnn_ops.cpp # ggml/src/ggml-cann/aclnn_ops.h # ggml/src/ggml-cann/ggml-cann.cpp # ggml/src/ggml-cpu/CMakeLists.txt # ggml/src/ggml-cpu/kleidiai/kernels.cpp # ggml/src/ggml-cpu/kleidiai/kernels.h # ggml/src/ggml-cpu/kleidiai/kleidiai.cpp # ggml/src/ggml-sycl/ggml-sycl.cpp # scripts/sync_vendor.py # src/CMakeLists.txt # tests/test-backend-ops.cpp # tests/test-rope.cpp # tools/mtmd/CMakeLists.txt # tools/rpc/CMakeLists.txt # tools/server/CMakeLists.txt
2 parents 5751c30 + 97d5117 commit 26e9090

30 files changed

+10491
-10406
lines changed

.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

common/download.cpp

Lines changed: 46 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,7 @@ std::pair<long, std::vector<char>> common_remote_get_content(const std::string &
467467
return { res_code, std::move(res_buffer) };
468468
}
469469

470-
#else
471-
#ifdef LLAMA_USE_HTTPLIB
470+
#elif defined(LLAMA_USE_HTTPLIB)
472471

473472
static bool is_output_a_tty() {
474473
#if defined(_WIN32)
@@ -712,29 +711,10 @@ std::pair<long, std::vector<char>> common_remote_get_content(const std::string
712711
return { res->status, std::move(buf) };
713712
}
714713

715-
#else //no httplib
716-
717-
bool common_has_curl() {
718-
return false;
719-
}
720-
721-
static bool common_download_file_single_online(const std::string &, const std::string &, const std::string &) {
722-
LOG_ERR("error: built without CURL, cannot download model from internet\n");
723-
return false;
724-
}
725-
726-
std::pair<long, std::vector<char>> common_remote_get_content(const std::string & url, const common_remote_params &) {
727-
if (!url.empty()) {
728-
throw std::runtime_error("error: built without CURL, cannot download model from the internet");
729-
}
730-
731-
return {};
732-
}
733-
#endif
734-
735-
736714
#endif // LLAMA_USE_CURL
737715

716+
#if defined(LLAMA_USE_CURL) || defined(LLAMA_USE_HTTPLIB)
717+
738718
static bool common_download_file_single(const std::string & url,
739719
const std::string & path,
740720
const std::string & bearer_token,
@@ -929,33 +909,6 @@ common_hf_file_res common_get_hf_file(const std::string & hf_repo_with_tag, cons
929909
return { hf_repo, ggufFile, mmprojFile };
930910
}
931911

932-
std::vector<common_cached_model_info> common_list_cached_models() {
933-
std::vector<common_cached_model_info> models;
934-
const std::string cache_dir = fs_get_cache_directory();
935-
const std::vector<common_file_info> files = fs_list_files(cache_dir);
936-
for (const auto & file : files) {
937-
if (string_starts_with(file.name, "manifest=") && string_ends_with(file.name, ".json")) {
938-
common_cached_model_info model_info;
939-
model_info.manifest_path = file.path;
940-
std::string fname = file.name;
941-
string_replace_all(fname, ".json", ""); // remove extension
942-
auto parts = string_split<std::string>(fname, '=');
943-
if (parts.size() == 4) {
944-
// expect format: manifest=<user>=<model>=<tag>=<other>
945-
model_info.user = parts[1];
946-
model_info.model = parts[2];
947-
model_info.tag = parts[3];
948-
} else {
949-
// invalid format
950-
continue;
951-
}
952-
model_info.size = 0; // TODO: get GGUF size, not manifest size
953-
models.push_back(model_info);
954-
}
955-
}
956-
return models;
957-
}
958-
959912
//
960913
// Docker registry functions
961914
//
@@ -1074,3 +1027,46 @@ std::string common_docker_resolve_model(const std::string & docker) {
10741027
throw;
10751028
}
10761029
}
1030+
1031+
#else
1032+
1033+
common_hf_file_res common_get_hf_file(const std::string &, const std::string &, bool) {
1034+
throw std::runtime_error("download functionality is not enabled in this build");
1035+
}
1036+
1037+
bool common_download_model(const common_params_model &, const std::string &, bool) {
1038+
throw std::runtime_error("download functionality is not enabled in this build");
1039+
}
1040+
1041+
std::string common_docker_resolve_model(const std::string &) {
1042+
throw std::runtime_error("download functionality is not enabled in this build");
1043+
}
1044+
1045+
#endif // LLAMA_USE_CURL || LLAMA_USE_HTTPLIB
1046+
1047+
std::vector<common_cached_model_info> common_list_cached_models() {
1048+
std::vector<common_cached_model_info> models;
1049+
const std::string cache_dir = fs_get_cache_directory();
1050+
const std::vector<common_file_info> files = fs_list_files(cache_dir);
1051+
for (const auto & file : files) {
1052+
if (string_starts_with(file.name, "manifest=") && string_ends_with(file.name, ".json")) {
1053+
common_cached_model_info model_info;
1054+
model_info.manifest_path = file.path;
1055+
std::string fname = file.name;
1056+
string_replace_all(fname, ".json", ""); // remove extension
1057+
auto parts = string_split<std::string>(fname, '=');
1058+
if (parts.size() == 4) {
1059+
// expect format: manifest=<user>=<model>=<tag>=<other>
1060+
model_info.user = parts[1];
1061+
model_info.model = parts[2];
1062+
model_info.tag = parts[3];
1063+
} else {
1064+
// invalid format
1065+
continue;
1066+
}
1067+
model_info.size = 0; // TODO: get GGUF size, not manifest size
1068+
models.push_back(model_info);
1069+
}
1070+
}
1071+
return models;
1072+
}

convert_hf_to_gguf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7354,6 +7354,7 @@ def prepare_tensors(self):
73547354
@ModelBase.register("T5ForConditionalGeneration")
73557355
@ModelBase.register("MT5ForConditionalGeneration")
73567356
@ModelBase.register("UMT5ForConditionalGeneration")
7357+
@ModelBase.register("UMT5Model")
73577358
class T5Model(TextModel):
73587359
model_arch = gguf.MODEL_ARCH.T5
73597360

ggml/src/ggml-cpu/ggml-cpu.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4140,6 +4140,13 @@ void ggml_cpu_fp16_to_fp32(const ggml_fp16_t * x, float * y, int64_t n) {
41404140
__m128 y_vec = _mm_cvtph_ps(x_vec);
41414141
_mm_storeu_ps(y + i, y_vec);
41424142
}
4143+
#elif defined(__riscv_zvfh)
4144+
for (int vl; i < n; i += vl) {
4145+
vl = __riscv_vsetvl_e16m1(n - i);
4146+
vfloat16m1_t vx = __riscv_vle16_v_f16m1((_Float16 *)&x[i], vl);
4147+
vfloat32m2_t vy = __riscv_vfwcvt_f_f_v_f32m2(vx, vl);
4148+
__riscv_vse32_v_f32m2(&y[i], vy, vl);
4149+
}
41434150
#endif
41444151

41454152
for (; i < n; ++i) {

0 commit comments

Comments
 (0)