Skip to content

Commit 3fefb3b

Browse files
committed
Merge commit 'f0adb80bf7c2c0d80abb04f4533b5513622d9964' into concedo_experimental
# Conflicts: # docs/backend/CANN.md # docs/backend/SYCL.md # docs/docker.md # examples/sycl/run-llama2.sh # examples/sycl/win-run-llama2.bat # ggml/src/ggml-sycl/ggml-sycl.cpp # tools/llama-bench/README.md
2 parents c0edde6 + f0adb80 commit 3fefb3b

File tree

7 files changed

+212
-137
lines changed

7 files changed

+212
-137
lines changed

common/common.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,6 +1110,9 @@ struct llama_model_params common_model_params_to_llama(common_params & params) {
11101110
mparams.tensor_buft_overrides = params.tensor_buft_overrides.data();
11111111
}
11121112

1113+
mparams.progress_callback = params.load_progress_callback;
1114+
mparams.progress_callback_user_data = params.load_progress_callback_user_data;
1115+
11131116
return mparams;
11141117
}
11151118

common/common.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,11 @@ struct common_params {
424424

425425
// common params
426426
std::string out_file; // output filename for all example programs
427+
// optional callback for model loading progress and cancellation:
428+
// called with a progress value between 0.0 and 1.0.
429+
// return false from callback to abort model loading or true to continue
430+
llama_progress_callback load_progress_callback = NULL;
431+
void * load_progress_callback_user_data = NULL;
427432
};
428433

429434
// call once at the start of a program if it uses libcommon

examples/sycl/run-llama3.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
# MIT license
4+
# Copyright (C) 2025 Intel Corporation
5+
# SPDX-License-Identifier: MIT
6+
7+
# If you want more control, DPC++ Allows selecting a specific device through the
8+
# following environment variable
9+
#export ONEAPI_DEVICE_SELECTOR="level_zero:0"
10+
source /opt/intel/oneapi/setvars.sh
11+
12+
#export GGML_SYCL_DEBUG=1
13+
14+
#ZES_ENABLE_SYSMAN=1, Support to get free memory of GPU by sycl::aspect::ext_intel_free_memory. Recommended to use when --split-mode = layer.
15+
16+
INPUT_PROMPT="Building a website can be done in 10 simple steps:\nStep 1:"
17+
MODEL_FILE=models/Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf
18+
NGL=99 # Layers offloaded to the GPU. If the device runs out of memory, reduce this value according to the model you are using.
19+
CONTEXT=4096
20+
21+
if [ $# -gt 0 ]; then
22+
GGML_SYCL_DEVICE=$1
23+
echo "Using $GGML_SYCL_DEVICE as the main GPU"
24+
ZES_ENABLE_SYSMAN=1 ./build/bin/llama-cli -m ${MODEL_FILE} -p "${INPUT_PROMPT}" -n 400 -e -ngl ${NGL} -c ${CONTEXT} -mg $GGML_SYCL_DEVICE -sm none
25+
else
26+
#use multiple GPUs with same max compute units
27+
ZES_ENABLE_SYSMAN=1 ./build/bin/llama-cli -m ${MODEL_FILE} -p "${INPUT_PROMPT}" -n 400 -e -ngl ${NGL} -c ${CONTEXT}
28+
fi

examples/sycl/win-run-llama3.bat

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
:: MIT license
2+
:: Copyright (C) 2024 Intel Corporation
3+
:: SPDX-License-Identifier: MIT
4+
5+
set INPUT2="Building a website can be done in 10 simple steps:\nStep 1:"
6+
@call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64 --force
7+
8+
9+
.\build\bin\llama-cli.exe -m models\Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf -p %INPUT2% -n 400 -e -ngl 99

ggml/src/ggml-vulkan/ggml-vulkan.cpp

Lines changed: 118 additions & 108 deletions
Large diffs are not rendered by default.

gpttype_adapter.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1936,18 +1936,6 @@ ModelLoadResult gpttype_load_model(const load_model_inputs inputs, FileFormat in
19361936
clamped_max_context_length = 16384;
19371937
}
19381938

1939-
#if defined(GGML_USE_VULKAN)
1940-
if (isGguf && file_format_meta.model_architecture == GGUFArch::ARCH_GLM4 && kcpp_data->n_ubatch > 16) {
1941-
if(debugmode==1)
1942-
{
1943-
printf("GLM-4 is broken on larger batch sizes in Vulkan. Clamp ignored in debug.\n");
1944-
} else {
1945-
printf("GLM-4 is broken on larger batch sizes in Vulkan. Clamping ubatch size to 8.\n");
1946-
kcpp_data->n_ubatch = 8;
1947-
}
1948-
}
1949-
#endif
1950-
19511939
kcpp_data->n_ctx = clamped_max_context_length;
19521940
max_context_limit_at_load = clamped_max_context_length;
19531941
add_bos_token = !inputs.no_bos_token;

klite.embd

Lines changed: 49 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1879,6 +1879,23 @@ Current version indicated by LITEVER below.
18791879
{
18801880
background-color: #161616;
18811881
}
1882+
.corpoendeditbutton {
1883+
position: fixed;
1884+
top: 75px;
1885+
right: 25px;
1886+
width: 40px;
1887+
padding: 8px 6px;
1888+
background-color: #de5b5b;
1889+
color: white;
1890+
border-radius: 24px;
1891+
opacity: 0.65;
1892+
cursor: pointer;
1893+
box-shadow: 1 2px 8px rgba(0, 0, 0, 0.2);
1894+
}
1895+
1896+
.corpoendeditbutton:hover {
1897+
background-color: #f67676;
1898+
}
18821899
.corpoleftpanelitems
18831900
{
18841901
display: flex;
@@ -13383,6 +13400,11 @@ Current version indicated by LITEVER below.
1338313400
}
1338413401
render_gametext(false);
1338513402
}
13403+
function exit_editmode()
13404+
{
13405+
document.getElementById("allowediting").checked = false;
13406+
toggle_editable();
13407+
}
1338613408

1338713409
function toggle_hide_thinking(button) {
1338813410
// Get the parent div of the button
@@ -18714,40 +18736,43 @@ Current version indicated by LITEVER below.
1871418736
fulltxt = replaceAll(fulltxt, get_instruct_endtag(true), `%SpcEtg%`);
1871518737
if (localsettings.separate_end_tags) {
1871618738
if (get_instruct_endtag_end(true)) {
18739+
fulltxt = replaceAll(fulltxt, get_instruct_endtag_end(false), ``);
1871718740
fulltxt = replaceAll(fulltxt, get_instruct_endtag_end(true), ``);
1871818741
}
1871918742
if (get_instruct_starttag_end(true)) {
18743+
fulltxt = replaceAll(fulltxt, get_instruct_starttag_end(false), ``);
1872018744
fulltxt = replaceAll(fulltxt, get_instruct_starttag_end(true), ``);
1872118745
}
1872218746
}
1872318747

18724-
if(localsettings.instruct_has_markdown && synchro_pending_stream=="")
18725-
{
18726-
//if a list has a starttag on the same line, add a newline before it
18727-
fulltxt = fulltxt.replace(/(\n[-*] .+?)(%SpcStg%)/g, "$1\n$2");
18728-
let codeblockcount = (fulltxt.match(/```/g) || []).length;
18729-
if(codeblockcount>0 && codeblockcount%2!=0 )
18730-
{
18731-
fulltxt += "```"; //force end code block
18732-
}
18733-
fulltxt = simpleMarkdown(fulltxt,localsettings.instruct_has_latex);
18734-
}
18735-
1873618748
let instruct_turns = repack_instruct_turns(fulltxt, `%SpcStg%`,`%SpcEtg%`, true);
1873718749
fulltxt = "";
1873818750
for(let i=0;i<instruct_turns.length;++i)
1873918751
{
1874018752
let curr = instruct_turns[i];
18753+
let currmsg = curr.msg;
18754+
if(localsettings.instruct_has_markdown && (synchro_pending_stream==""||(i+1)<instruct_turns.length))
18755+
{
18756+
//if a list has a starttag on the same line, add a newline before it
18757+
currmsg = currmsg.replace(/(\n[-*] .+?)(%SpcStg%)/g, "$1\n$2");
18758+
let codeblockcount = (currmsg.match(/```/g) || []).length;
18759+
if(codeblockcount>0 && codeblockcount%2!=0 )
18760+
{
18761+
currmsg += "```"; //force end code block
18762+
}
18763+
currmsg = simpleMarkdown(currmsg,localsettings.instruct_has_latex);
18764+
}
18765+
1874118766
if(curr.myturn)
1874218767
{
18743-
fulltxt += `<hr style="margin-top: 12px; margin-bottom: 12px;"><span class="color_cyan"><img src="${human_square}" style="height:38px;width:auto;padding:3px 6px 3px 3px;border-radius: 8%;"/>${curr.msg}</span>`;
18768+
fulltxt += `<hr style="margin-top: 12px; margin-bottom: 12px;"><span class="color_cyan"><img src="${human_square}" style="height:38px;width:auto;padding:3px 6px 3px 3px;border-radius: 8%;"/>${currmsg}</span>`;
1874418769
}
1874518770
else
1874618771
{
1874718772
if (i == 0) {
18748-
fulltxt += `${curr.msg}`;
18773+
fulltxt += `${currmsg}`;
1874918774
} else {
18750-
fulltxt += `<hr style="margin-top: 12px; margin-bottom: 12px;"><img src="${niko_square}" style="height:38px;width:auto;padding:3px 6px 3px 3px;border-radius: 8%;"/>${curr.msg}</span>`;
18775+
fulltxt += `<hr style="margin-top: 12px; margin-bottom: 12px;"><img src="${niko_square}" style="height:38px;width:auto;padding:3px 6px 3px 3px;border-radius: 8%;"/>${currmsg}</span>`;
1875118776
}
1875218777
}
1875318778
}
@@ -19070,6 +19095,12 @@ Current version indicated by LITEVER below.
1907019095
document.getElementById("normalinterface").classList.remove("hidden");
1907119096
}
1907219097

19098+
if (inEditMode && isCorpoUiStyle) {
19099+
document.getElementById("corpoendedit").classList.remove("hidden");
19100+
} else {
19101+
document.getElementById("corpoendedit").classList.add("hidden");
19102+
}
19103+
1907319104
update_submit_button(true); //full update for submit button, otherwise just text when not generating
1907419105

1907519106
document.getElementById("btnautogenmem").disabled = document.getElementById("btnsend").disabled;
@@ -19803,7 +19834,7 @@ Current version indicated by LITEVER below.
1980319834

1980419835
function show_corpo_leftpanel(open)
1980519836
{
19806-
let panel = document.getElementById('corpo_leftpannel');
19837+
let panel = document.getElementById('corpo_leftpanel');
1980719838
if(open)
1980819839
{
1980919840
panel.classList.add('open');
@@ -21945,9 +21976,10 @@ Current version indicated by LITEVER below.
2194521976
</div>
2194621977
</div>
2194721978

21979+
<button title="Exit Edit Mode" id="corpoendedit" class="corpoendeditbutton hidden" onclick="exit_editmode()">X</button>
2194821980
<div id="corpointerface" class="hidden">
2194921981
<div class="corpostyle">
21950-
<div id="corpo_leftpannel" class="corpoleftpanel">
21982+
<div id="corpo_leftpanel" class="corpoleftpanel">
2195121983
<button title="Hide Corpo Side Panel" class="corpo_leftpanel_close mainnav" onclick="show_corpo_leftpanel(false)">&times;</button>
2195221984
<div id="corpoleftpanelitems" class="corpoleftpanelitems">
2195321985
<div class="corpoleftpanelitemstopper" id="corpoleftpanelitemstopper"></div>

0 commit comments

Comments
 (0)