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// Store the references to globals in case someone tries to monkey patch these, causing the below2// to de-opt (this occurs often when using popular extensions).3export var is_array = Array.isArray;4export var index_of = Array.prototype.indexOf;5export var includes = Array.prototype.includes;6export var array_from = Array.from;7export var object_keys = Object.keys;8export var define_property = Object.defineProperty;9export var get_descriptor = Object.getOwnPropertyDescriptor;10export var get_descriptors = Object.getOwnPropertyDescriptors;11export var object_prototype = Object.prototype;12export var array_prototype = Array.prototype;13export var get_prototype_of = Object.getPrototypeOf;14export var is_extensible = Object.isExtensible;15export var has_own_property = Object.prototype.hasOwnProperty;16 17/**18 * @param {any} thing19 * @returns {thing is Function}20 */21export function is_function(thing) {22 return typeof thing === 'function';23}24 25export const noop = () => {};26 27// Adapted from https://github.com/then/is-promise/blob/master/index.js28// Distributed under MIT License https://github.com/then/is-promise/blob/master/LICENSE29 30/**31 * @template [T=any]32 * @param {any} value33 * @returns {value is PromiseLike<T>}34 */35export function is_promise(value) {36 return typeof value?.then === 'function';37}38 39/** @param {Function} fn */40export function run(fn) {41 return fn();42}43 44/** @param {Array<() => void>} arr */45export function run_all(arr) {46 for (var i = 0; i < arr.length; i++) {47 arr[i]();48 }49}50 51/**52 * TODO replace with Promise.withResolvers once supported widely enough53 * @template [T=void]54 */55export function deferred() {56 /** @type {(value: T) => void} */57 var resolve;58 59 /** @type {(reason: any) => void} */60 var reject;61 62 /** @type {Promise<T>} */63 var promise = new Promise((res, rej) => {64 resolve = res;65 reject = rej;66 });67 68 // @ts-expect-error69 return { promise, resolve, reject };70}71 72/**73 * @template V74 * @param {V} value75 * @param {V | (() => V)} fallback76 * @param {boolean} [lazy]77 * @returns {V}78 */79export function fallback(value, fallback, lazy = false) {80 return value === undefined81 ? lazy82 ? /** @type {() => V} */ (fallback)()83 : /** @type {V} */ (fallback)84 : value;85}86 87/**88 * When encountering a situation like `let [a, b, c] = $derived(blah())`,89 * we need to stash an intermediate value that `a`, `b`, and `c` derive90 * from, in case it's an iterable91 * @template T92 * @param {ArrayLike<T> | Iterable<T>} value93 * @param {number} [n]94 * @returns {Array<T>}95 */96export function to_array(value, n) {97 // return arrays unchanged98 if (Array.isArray(value)) {99 return value;100 }101 102 // if value is not iterable, or `n` is unspecified (indicates a rest103 // element, which means we're not concerned about unbounded iterables)104 // convert to an array with `Array.from`105 if (n === undefined || !(Symbol.iterator in value)) {106 return Array.from(value);107 }108 109 // otherwise, populate an array with `n` values110 111 /** @type {T[]} */112 const array = [];113 114 for (const element of value) {115 array.push(element);116 if (array.length === n) break;117 }118 119 return array;120}121 122/**123 * @param {Record<string | symbol, unknown>} obj124 * @param {Array<string | symbol>} keys125 * @returns {Record<string | symbol, unknown>}126 */127export function exclude_from_object(obj, keys) {128 /** @type {Record<string | symbol, unknown>} */129 var result = {};130 131 for (var key in obj) {132 if (!keys.includes(key)) {133 result[key] = obj[key];134 }135 }136 137 for (var symbol of Object.getOwnPropertySymbols(obj)) {138 if (Object.propertyIsEnumerable.call(obj, symbol) && !keys.includes(symbol)) {139 result[symbol] = obj[symbol];140 }141 }142 143 return result;144}145 