Skip to content

Commit

Permalink
use highest power of 2 below system thread count
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsPi3141 committed Mar 25, 2023
1 parent 284e241 commit 8578609
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ ipcMain.on("reloadApp", () => {

// OS STATS
const osUtil = require("os-utils");
var threads;
var sysThreads = osUtil.cpuCount();
for (let i = 1; i < sysThreads - 1; i = i * 2) {
threads = i;
}
ipcMain.on("cpuUsage", () => {
osUtil.cpuUsage(function (v) {
win.webContents.send("cpuUsage", { data: v });
Expand Down Expand Up @@ -169,14 +174,14 @@ function initChat() {
});
}
});
runningShell.write(`[System.Console]::OutputEncoding=[System.Console]::InputEncoding=[System.Text.Encoding]::UTF8; ."${path.resolve(__dirname, "bin", "chat.exe")}" -m "${modelPath}" --temp 0.9 --top_k 420 --top_p 0.9 --threads 16 --repeat_last_n 99999\r`);
runningShell.write(`[System.Console]::OutputEncoding=[System.Console]::InputEncoding=[System.Text.Encoding]::UTF8; ."${path.resolve(__dirname, "bin", "chat.exe")}" -m "${modelPath}" --temp 0.9 --top_k 420 --top_p 0.9 --threads ${threads} --repeat_last_n 99999\r`);
}
ipcMain.on("startChat", () => {
initChat();
});

ipcMain.on("message", (_event, { data }) => {
console.log(`User says: ${data}`);
// console.log(`User says: ${data}`);
currentPrompt = data;
if (runningShell) {
runningShell.write(`${data}\r`);
Expand Down

0 comments on commit 8578609

Please sign in to comment.