Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1"use strict";2var __create = Object.create;3var __defProp = Object.defineProperty;4var __getOwnPropDesc = Object.getOwnPropertyDescriptor;5var __getOwnPropNames = Object.getOwnPropertyNames;6var __getProtoOf = Object.getPrototypeOf;7var __hasOwnProp = Object.prototype.hasOwnProperty;8var __export = (target, all) => {9 for (var name in all)10 __defProp(target, name, { get: all[name], enumerable: true });11};12var __copyProps = (to, from, except, desc) => {13 if (from && typeof from === "object" || typeof from === "function") {14 for (let key of __getOwnPropNames(from))15 if (!__hasOwnProp.call(to, key) && key !== except)16 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });17 }18 return to;19};20var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(21 // If the importer is in node compatibility mode or this is not an ESM22 // file that has been converted to a CommonJS file using a Babel-23 // compatible transform (i.e. "__esModule" has not been set), then set24 // "default" to the CommonJS "module.exports" for node compatibility.25 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,26 mod27));28var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);29var processLauncher_exports = {};30__export(processLauncher_exports, {31 envArrayToObject: () => envArrayToObject,32 gracefullyCloseAll: () => gracefullyCloseAll,33 gracefullyCloseSet: () => gracefullyCloseSet,34 gracefullyProcessExitDoNotHang: () => gracefullyProcessExitDoNotHang,35 launchProcess: () => launchProcess36});37module.exports = __toCommonJS(processLauncher_exports);38var childProcess = __toESM(require("child_process"));39var import_fs = __toESM(require("fs"));40var readline = __toESM(require("readline"));41var import_fileUtils = require("./fileUtils");42var import_utils = require("../../utils");43const gracefullyCloseSet = /* @__PURE__ */ new Set();44const killSet = /* @__PURE__ */ new Set();45async function gracefullyCloseAll() {46 await Promise.all(Array.from(gracefullyCloseSet).map((gracefullyClose) => gracefullyClose().catch((e) => {47 })));48}49function gracefullyProcessExitDoNotHang(code) {50 setTimeout(() => process.exit(code), 3e4);51 gracefullyCloseAll().then(() => {52 process.exit(code);53 });54}55function exitHandler() {56 for (const kill of killSet)57 kill();58}59let sigintHandlerCalled = false;60function sigintHandler() {61 const exitWithCode130 = () => {62 if ((0, import_utils.isUnderTest)()) {63 setTimeout(() => process.exit(130), 1e3);64 } else {65 process.exit(130);66 }67 };68 if (sigintHandlerCalled) {69 process.off("SIGINT", sigintHandler);70 for (const kill of killSet)71 kill();72 exitWithCode130();73 } else {74 sigintHandlerCalled = true;75 gracefullyCloseAll().then(() => exitWithCode130());76 }77}78function sigtermHandler() {79 gracefullyCloseAll();80}81function sighupHandler() {82 gracefullyCloseAll();83}84const installedHandlers = /* @__PURE__ */ new Set();85const processHandlers = {86 exit: exitHandler,87 SIGINT: sigintHandler,88 SIGTERM: sigtermHandler,89 SIGHUP: sighupHandler90};91function addProcessHandlerIfNeeded(name) {92 if (!installedHandlers.has(name)) {93 installedHandlers.add(name);94 process.on(name, processHandlers[name]);95 }96}97function removeProcessHandlersIfNeeded() {98 if (killSet.size)99 return;100 for (const handler of installedHandlers)101 process.off(handler, processHandlers[handler]);102 installedHandlers.clear();103}104async function launchProcess(options) {105 const stdio = options.stdio === "pipe" ? ["ignore", "pipe", "pipe", "pipe", "pipe"] : ["pipe", "pipe", "pipe"];106 options.log(`<launching> ${options.command} ${options.args ? options.args.join(" ") : ""}`);107 const spawnOptions = {108 // On non-windows platforms, `detached: true` makes child process a leader of a new109 // process group, making it possible to kill child process tree with `.kill(-pid)` command.110 // @see https://nodejs.org/api/child_process.html#child_process_options_detached111 detached: process.platform !== "win32",112 env: options.env,113 cwd: options.cwd,114 shell: options.shell,115 stdio116 };117 const spawnedProcess = childProcess.spawn(options.command, options.args || [], spawnOptions);118 const cleanup = async () => {119 options.log(`[pid=${spawnedProcess.pid || "N/A"}] starting temporary directories cleanup`);120 const errors = await (0, import_fileUtils.removeFolders)(options.tempDirectories);121 for (let i = 0; i < options.tempDirectories.length; ++i) {122 if (errors[i])123 options.log(`[pid=${spawnedProcess.pid || "N/A"}] exception while removing ${options.tempDirectories[i]}: ${errors[i]}`);124 }125 options.log(`[pid=${spawnedProcess.pid || "N/A"}] finished temporary directories cleanup`);126 };127 spawnedProcess.on("error", () => {128 });129 if (!spawnedProcess.pid) {130 let failed;131 const failedPromise = new Promise((f, r) => failed = f);132 spawnedProcess.once("error", (error) => {133 failed(new Error("Failed to launch: " + error));134 });135 return failedPromise.then(async (error) => {136 await cleanup();137 throw error;138 });139 }140 options.log(`<launched> pid=${spawnedProcess.pid}`);141 const stdout = readline.createInterface({ input: spawnedProcess.stdout });142 stdout.on("line", (data) => {143 options.log(`[pid=${spawnedProcess.pid}][out] ` + data);144 });145 const stderr = readline.createInterface({ input: spawnedProcess.stderr });146 stderr.on("line", (data) => {147 options.log(`[pid=${spawnedProcess.pid}][err] ` + data);148 });149 let processClosed = false;150 let fulfillCleanup = () => {151 };152 const waitForCleanup = new Promise((f) => fulfillCleanup = f);153 spawnedProcess.once("close", (exitCode, signal) => {154 options.log(`[pid=${spawnedProcess.pid}] <process did exit: exitCode=${exitCode}, signal=${signal}>`);155 processClosed = true;156 gracefullyCloseSet.delete(gracefullyClose);157 killSet.delete(killProcessAndCleanup);158 removeProcessHandlersIfNeeded();159 options.onExit(exitCode, signal);160 cleanup().then(fulfillCleanup);161 });162 addProcessHandlerIfNeeded("exit");163 if (options.handleSIGINT)164 addProcessHandlerIfNeeded("SIGINT");165 if (options.handleSIGTERM)166 addProcessHandlerIfNeeded("SIGTERM");167 if (options.handleSIGHUP)168 addProcessHandlerIfNeeded("SIGHUP");169 gracefullyCloseSet.add(gracefullyClose);170 killSet.add(killProcessAndCleanup);171 let gracefullyClosing = false;172 async function gracefullyClose() {173 if (gracefullyClosing) {174 options.log(`[pid=${spawnedProcess.pid}] <forcefully close>`);175 killProcess();176 await waitForCleanup;177 return;178 }179 gracefullyClosing = true;180 options.log(`[pid=${spawnedProcess.pid}] <gracefully close start>`);181 await options.attemptToGracefullyClose().catch(() => killProcess());182 await waitForCleanup;183 options.log(`[pid=${spawnedProcess.pid}] <gracefully close end>`);184 }185 function killProcess() {186 gracefullyCloseSet.delete(gracefullyClose);187 killSet.delete(killProcessAndCleanup);188 removeProcessHandlersIfNeeded();189 options.log(`[pid=${spawnedProcess.pid}] <kill>`);190 if (spawnedProcess.pid && !spawnedProcess.killed && !processClosed) {191 options.log(`[pid=${spawnedProcess.pid}] <will force kill>`);192 try {193 if (process.platform === "win32") {194 const taskkillProcess = childProcess.spawnSync(`taskkill /pid ${spawnedProcess.pid} /T /F`, { shell: true });195 const [stdout2, stderr2] = [taskkillProcess.stdout.toString(), taskkillProcess.stderr.toString()];196 if (stdout2)197 options.log(`[pid=${spawnedProcess.pid}] taskkill stdout: ${stdout2}`);198 if (stderr2)199 options.log(`[pid=${spawnedProcess.pid}] taskkill stderr: ${stderr2}`);200 } else {201 process.kill(-spawnedProcess.pid, "SIGKILL");202 }203 } catch (e) {204 options.log(`[pid=${spawnedProcess.pid}] exception while trying to kill process: ${e}`);205 }206 } else {207 options.log(`[pid=${spawnedProcess.pid}] <skipped force kill spawnedProcess.killed=${spawnedProcess.killed} processClosed=${processClosed}>`);208 }209 }210 function killProcessAndCleanup() {211 killProcess();212 options.log(`[pid=${spawnedProcess.pid || "N/A"}] starting temporary directories cleanup`);213 for (const dir of options.tempDirectories) {214 try {215 import_fs.default.rmSync(dir, { force: true, recursive: true, maxRetries: 5 });216 } catch (e) {217 options.log(`[pid=${spawnedProcess.pid || "N/A"}] exception while removing ${dir}: ${e}`);218 }219 }220 options.log(`[pid=${spawnedProcess.pid || "N/A"}] finished temporary directories cleanup`);221 }222 function killAndWait() {223 killProcess();224 return waitForCleanup;225 }226 return { launchedProcess: spawnedProcess, gracefullyClose, kill: killAndWait };227}228function envArrayToObject(env) {229 const result = {};230 for (const { name, value } of env)231 result[name] = value;232 return result;233}234// Annotate the CommonJS export names for ESM import in node:2350 && (module.exports = {236 envArrayToObject,237 gracefullyCloseAll,238 gracefullyCloseSet,239 gracefullyProcessExitDoNotHang,240 launchProcess241});242 