Team Ai
Datasetpublic

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.

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes3.1kdownloads
main.mjs389 linesDownload Raw Back to dist
1import { spawn as e, spawnSync as t } from "node:child_process";2import { cwd as n } from "node:process";3import { basename as r, delimiter as i, dirname as a, normalize as o, resolve as s } from "node:path";4import { pipeline as c } from "node:stream/promises";5import { PassThrough as l } from "node:stream";6import u from "node:readline";7import { closeSync as d, openSync as f, readSync as p, statSync as m } from "node:fs";8//#region src/env.ts9const h = /^path$/i;10const g = {11	key: "PATH",12	value: ""13};14function _(e) {15	for (const t in e) {16		if (!Object.prototype.hasOwnProperty.call(e, t) || !h.test(t)) continue;17		const n = e[t];18		if (!n) return g;19		return {20			key: t,21			value: n22		};23	}24	return g;25}26function v(e, t) {27	const n = t.value.split(i);28	const r = [];29	let o = e;30	let c;31	do {32		r.push(s(o, "node_modules", ".bin"));33		c = o;34		o = a(o);35	} while (o !== c);36	r.push(a(process.execPath));37	const l = r.concat(n).join(i);38	return {39		key: t.key,40		value: l41	};42}43function y(e, t, n = true) {44	const r = {45		...process.env,46		...t47	};48	if (!n) return r;49	const i = v(e, _(r));50	r[i.key] = i.value;51	return r;52}53//#endregion54//#region src/stream.ts55const b = (e) => {56	let t = e.length;57	const n = new l();58	const r = () => {59		if (--t === 0) n.end();60	};61	for (const t of e) c(t, n, { end: false }).then(r).catch(r);62	return n;63};64//#endregion65//#region src/normalize.ts66const x = /([()\][%!^"`<>&|;, *?])/g;67const S = /^#!\s*(.+)/;68const C = /\.(?:com|exe)$/i;69const w = /node_modules[\\/]\.bin[\\/][^\\/]+\.cmd$/i;70const T = process.platform === "win32";71const E = [72	".EXE",73	".CMD",74	".BAT",75	".COM"76];77/**78* Normalizes the command and arguments to work cross-platform.79* On Windows, this basically handles things like shebangs, calling80* `node_modules/.bin` commands, and escaping meta characters.81* On other platforms, it just returns the command and arguments as-is.82*/83function D(e, t = [], n = {}) {84	if (n.shell === true || !T) return {85		command: e,86		args: t,87		options: n88	};89	let i = O(e, n);90	let a = null;91	if (i !== null) {92		const e = 150;93		const t = Buffer.alloc(e);94		let n = null;95		try {96			n = f(i, "r");97			p(n, t, 0, e, 0);98		} catch {} finally {99			if (n !== null) d(n);100		}101		const o = t.toString().match(S);102		if (o !== null) {103			const e = o[1].trim();104			const t = e.indexOf(" ");105			const n = t !== -1 ? e.slice(0, t) : e;106			const i = t !== -1 ? e.slice(t + 1) : "";107			const s = r(n);108			a = s === "env" ? i || null : s;109		}110	}111	if (a !== null && i !== null) {112		t = [i, ...t];113		e = a;114		i = O(e, n);115	}116	if (i === null || !C.test(i)) {117		const r = i !== null && w.test(i);118		e = o(e);119		e = e.replace(x, "^$1");120		t = t.map((e) => {121			e = e.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");122			e = e.replace(/(?=(\\+?)?)\1$/, "$1$1");123			e = `"${e}"`;124			e = e.replace(x, "^$1");125			if (r) e = e.replace(x, "^$1");126			return e;127		});128		t = [129			"/d",130			"/s",131			"/c",132			`"${[e, ...t].join(" ")}"`133		];134		e = n.env?.comspec ?? "cmd.exe";135		n = {136			...n,137			windowsVerbatimArguments: true138		};139	}140	return {141		command: e,142		args: t,143		options: n144	};145}146/**147* Resolves the command to an absolute path if possible.148* Handles things like traversing PATH and adding extensions from PATHEXT149*/150function O(e, t) {151	const r = (t.cwd ?? n()).toString();152	const a = t.env ?? process.env;153	const o = _(a).value;154	const c = e.includes("/") || e.includes("\\") ? [""] : [r, ...o.split(i)];155	const l = a.PATHEXT ? a.PATHEXT.split(i) : E;156	if (e.includes(".") && l[0] !== "") l.unshift("");157	for (const t of c) {158		const n = s(r, t.startsWith("\"") && t.endsWith("\"") && t.length > 1 ? t.slice(1, -1) : t, e);159		for (const e of l) {160			const t = n + e;161			try {162				if (m(t).isFile()) return t;163			} catch {}164		}165	}166	return null;167}168//#endregion169//#region src/non-zero-exit-error.ts170var k = class extends Error {171	result;172	output;173	get exitCode() {174		if (this.result.exitCode !== null) return this.result.exitCode;175	}176	constructor(e, t) {177		super(`Process exited with non-zero status (${e.exitCode})`);178		this.result = e;179		this.output = t;180	}181};182//#endregion183//#region src/main.ts184const A = /\r?\n/;185const j = {186	timeout: void 0,187	persist: false188};189const M = { timeout: void 0 };190const N = { windowsHide: true };191function P(e) {192	const t = new AbortController();193	for (const n of e) {194		if (n.aborted) {195			t.abort();196			return n;197		}198		const e = () => {199			t.abort(n.reason);200		};201		n.addEventListener("abort", e, { signal: t.signal });202	}203	return t.signal;204}205async function F(e) {206	let t = "";207	try {208		for await (const n of e) t += n.toString();209	} catch {}210	return t;211}212var I = class {213	_process;214	_aborted = false;215	_options;216	_command;217	_args;218	_resolveClose;219	_processClosed;220	_thrownError;221	get process() {222		return this._process;223	}224	get pid() {225		return this._process?.pid;226	}227	get exitCode() {228		if (this._process && this._process.exitCode !== null) return this._process.exitCode;229	}230	constructor(e, t, n) {231		this._options = {232			...j,233			...n234		};235		this._command = e;236		this._args = t ?? [];237		this._processClosed = new Promise((e) => {238			this._resolveClose = e;239		});240	}241	kill(e) {242		return this._process?.kill(e) === true;243	}244	get aborted() {245		return this._aborted;246	}247	get killed() {248		return this._process?.killed === true;249	}250	pipe(e, t, n) {251		return z(e, t, {252			...n,253			stdin: this254		});255	}256	async *[Symbol.asyncIterator]() {257		const e = this._process;258		if (!e) return;259		const t = [];260		if (this._streamErr) t.push(this._streamErr);261		if (this._streamOut) t.push(this._streamOut);262		const n = b(t);263		const r = u.createInterface({ input: n });264		for await (const e of r) yield e.toString();265		await this._processClosed;266		e.removeAllListeners();267		if (this._thrownError) throw this._thrownError;268		if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new k(this);269	}270	async _waitForOutput() {271		const e = this._process;272		if (!e) throw new Error("No process was started");273		const [t, n] = await Promise.all([this._streamOut ? F(this._streamOut) : "", this._streamErr ? F(this._streamErr) : ""]);274		await this._processClosed;275		const { stdin: r } = this._options;276		if (r && typeof r !== "string") await r;277		e.removeAllListeners();278		if (this._thrownError) throw this._thrownError;279		const i = {280			stderr: n,281			stdout: t,282			exitCode: this.exitCode283		};284		if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new k(this, i);285		return i;286	}287	then(e, t) {288		return this._waitForOutput().then(e, t);289	}290	_streamOut;291	_streamErr;292	spawn() {293		const t = n();294		const r = this._options;295		const i = {296			...N,297			...r.nodeOptions298		};299		const a = [];300		this._resetState();301		if (r.timeout !== void 0) a.push(AbortSignal.timeout(r.timeout));302		if (r.signal !== void 0) a.push(r.signal);303		if (r.persist === true) i.detached = true;304		if (a.length > 0) i.signal = P(a);305		i.env = y(t, i.env, r.nodePath);306		const o = D(this._command, this._args, i);307		const s = e(o.command, o.args, o.options);308		if (s.stderr) this._streamErr = s.stderr;309		if (s.stdout) this._streamOut = s.stdout;310		this._process = s;311		s.once("error", this._onError);312		s.once("close", this._onClose);313		if (s.stdin) {314			const { stdin: e } = r;315			if (typeof e === "string") s.stdin.end(e);316			else e?.process?.stdout?.pipe(s.stdin);317		}318	}319	_resetState() {320		this._aborted = false;321		this._processClosed = new Promise((e) => {322			this._resolveClose = e;323		});324		this._thrownError = void 0;325	}326	_onError = (e) => {327		if (e.name === "AbortError" && (!(e.cause instanceof Error) || e.cause.name !== "TimeoutError")) {328			this._aborted = true;329			return;330		}331		this._thrownError = e;332	};333	_onClose = () => {334		if (this._resolveClose) this._resolveClose();335	};336};337function L(e, r, i) {338	const a = {339		...M,340		...i341	};342	const o = n();343	const s = {344		windowsHide: true,345		...a.nodeOptions346	};347	if (a.timeout !== void 0) s.timeout = a.timeout;348	s.env = y(o, s.env, a.nodePath);349	const c = D(e, r ?? [], s);350	const l = t(c.command, c.args, c.options);351	if (l.error) throw l.error;352	const u = l.stdout?.toString() ?? "";353	const d = l.stderr?.toString() ?? "";354	const f = l.status ?? void 0;355	const p = l.signal != null;356	const m = {357		stdout: u,358		stderr: d,359		get exitCode() {360			return f;361		},362		get pid() {363			return l.pid;364		},365		get killed() {366			return p;367		},368		*[Symbol.iterator]() {369			for (const e of [u, d]) {370				if (!e) continue;371				const t = e.split(A);372				if (t[t.length - 1] === "") t.pop();373				yield* t;374			}375		}376	};377	if (a.throwOnError && f !== 0 && f !== void 0) throw new k(m, m);378	return m;379}380const R = (e, t, n) => {381	const r = new I(e, t, n);382	r.spawn();383	return r;384};385const z = R;386const B = L;387//#endregion388export { I as ExecProcess, k as NonZeroExitError, z as exec, B as execSync, D as normalizeSpawnCommand, R as x, L as xSync };389 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai