From 813cf829b5bdbaab1d77cef51b3488fb215c4b27 Mon Sep 17 00:00:00 2001
From: Concedo <39025047+LostRuins@users.noreply.github.com>
Date: Thu, 6 Jun 2024 18:36:56 +0800
Subject: [PATCH] allow selecting multigpu on vulkan
---
expose.cpp | 8 +++---
klite.embd | 32 ++++++++++++++++++++++--
koboldcpp.py | 23 ++++++++++-------
otherarch/sdcpp/sdtype_adapter.cpp | 7 +++---
otherarch/whispercpp/whisper_adapter.cpp | 7 +++---
5 files changed, 53 insertions(+), 24 deletions(-)
diff --git a/expose.cpp b/expose.cpp
index 89089844f..7fec5cea9 100644
--- a/expose.cpp
+++ b/expose.cpp
@@ -68,14 +68,12 @@ extern "C"
vulkan_info_str += ",";
}
}
- if(vulkan_info_str=="")
+ if(vulkan_info_str!="")
{
- vulkan_info_str = "0";
+ vulkandeviceenv = "GGML_VK_VISIBLE_DEVICES="+vulkan_info_str;
+ putenv((char*)vulkandeviceenv.c_str());
}
- vulkandeviceenv = "GGML_VK_VISIBLE_DEVICES="+vulkan_info_str;
- putenv((char*)vulkandeviceenv.c_str());
-
executable_path = inputs.executable_path;
if(file_format==FileFormat::GPTJ_1 || file_format==FileFormat::GPTJ_2 || file_format==FileFormat::GPTJ_3 || file_format==FileFormat::GPTJ_4 || file_format==FileFormat::GPTJ_5)
diff --git a/klite.embd b/klite.embd
index 780260405..0a2d18092 100644
--- a/klite.embd
+++ b/klite.embd
@@ -9084,6 +9084,10 @@ Current version: 145
st = "<|eot_id|><|start_header_id|>user<|end_header_id|>\\n\\n";
et = "<|eot_id|><|start_header_id|>assistant<|end_header_id|>\\n\\n";
break;
+ case "10": // Phi-3 Mini
+ st = "<|end|><|user|>\\n";
+ et = "<|end|>\\n<|assistant|>";
+ break;
default:
break;
}
@@ -10212,6 +10216,8 @@ Current version: 145
}
}
+ var ptt_start_timestamp = performance.now();
+ var recent_voice_duration = 0;
function ptt_start()
{
if(voice_typing_mode>0)
@@ -10228,6 +10234,7 @@ Current version: 145
}
voice_is_recording = true;
update_submit_button(false);
+ ptt_start_timestamp = performance.now();
}
}
}
@@ -10248,13 +10255,25 @@ Current version: 145
preaudioblobs.push(new Blob([preaudiobuffers[i]], { type: 'audio/webm' }));
}
}
+ recent_voice_duration = performance.now() - ptt_start_timestamp;
if (voicerecorder.state !== "inactive") {
voicerecorder.stop();
}
voice_is_recording = false;
update_submit_button(false);
+ if(recent_voice_duration<500) //if too short, fall back to click behavior
+ {
+ if(is_aesthetic_ui())
+ {
+ chat_submit_generation();
+ }
+ else
+ {
+ submit_generation();
+ }
+ }
}
- }, 500); //prevent premature stopping
+ }, 280); //prevent premature stopping
}
}
function submit_generation_button(aesthetic_ui)
@@ -12750,6 +12769,12 @@ Current version: 145
let completeRecording = new Blob([e.data], { type: 'audio/webm' });
let audiodatareader = new window.FileReader();
+ if(recent_voice_duration<550)
+ {
+ console.log("Skip too short speech: " + recent_voice_duration);
+ return; //too short, don't process this
+ }
+
if(preaudioblobs.length<2)
{
audioBlobToDecodedAudioBuffer(completeRecording,(buffer)=>{
@@ -16016,6 +16041,7 @@ Current version: 145
+
Sys. Prompt ?A system pre-prompt sent at the very start to guide the AI behavior. Usually NOT needed.
@@ -16265,7 +16291,7 @@ Current version: 145
-
Speech Control ?Speech Ctrl. ?Requires KoboldCpp with Whisper model loaded. Enables Speech-To-Text voice input. Automatically listens for speech in 'On' mode (Voice Detection), or use Push-To-Talk (PTT).