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
1import {dequal} from 'dequal'2 3/**4 * @type {Set<string>}5 */6const codesWarned = new Set()7 8class AssertionError extends Error {9 name = /** @type {const} */ ('Assertion')10 code = /** @type {const} */ ('ERR_ASSERTION')11 12 /**13 * Create an assertion error.14 *15 * @param {string} message16 * Message explaining error.17 * @param {unknown} actual18 * Value.19 * @param {unknown} expected20 * Baseline.21 * @param {string} operator22 * Name of equality operation.23 * @param {boolean} generated24 * Whether `message` is a custom message or not25 * @returns26 * Instance.27 */28 // eslint-disable-next-line max-params29 constructor(message, actual, expected, operator, generated) {30 super(message)31 32 if (Error.captureStackTrace) {33 Error.captureStackTrace(this, this.constructor)34 }35 36 /**37 * @type {unknown}38 */39 this.actual = actual40 41 /**42 * @type {unknown}43 */44 this.expected = expected45 46 /**47 * @type {boolean}48 */49 this.generated = generated50 51 /**52 * @type {string}53 */54 this.operator = operator55 }56}57 58class DeprecationError extends Error {59 name = /** @type {const} */ ('DeprecationWarning')60 61 /**62 * Create a deprecation message.63 *64 * @param {string} message65 * Message explaining deprecation.66 * @param {string | undefined} code67 * Deprecation identifier; deprecation messages will be generated only once per code.68 * @returns69 * Instance.70 */71 constructor(message, code) {72 super(message)73 74 /**75 * @type {string | undefined}76 */77 this.code = code78 }79}80 81/**82 * Wrap a function or class to show a deprecation message when first called.83 *84 * > 👉 **Important**: only shows a message when the `development` condition is85 * > used, does nothing in production.86 *87 * When the resulting wrapped `fn` is called, emits a warning once to88 * `console.error` (`stderr`).89 * If a code is given, one warning message will be emitted in total per code.90 *91 * @template {Function} T92 * Function or class kind.93 * @param {T} fn94 * Function or class.95 * @param {string} message96 * Message explaining deprecation.97 * @param {string | null | undefined} [code]98 * Deprecation identifier (optional); deprecation messages will be generated99 * only once per code.100 * @returns {T}101 * Wrapped `fn`.102 */103export function deprecate(fn, message, code) {104 let warned = false105 106 // The wrapper will keep the same prototype as fn to maintain prototype chain107 Object.setPrototypeOf(deprecated, fn)108 109 // @ts-expect-error: it’s perfect, typescript…110 return deprecated111 112 /**113 * @this {unknown}114 * @param {...Array<unknown>} args115 * @returns {unknown}116 */117 function deprecated(...args) {118 if (!warned) {119 warned = true120 121 if (typeof code === 'string' && codesWarned.has(code)) {122 // Empty.123 } else {124 console.error(new DeprecationError(message, code || undefined))125 126 if (typeof code === 'string') codesWarned.add(code)127 }128 }129 130 return new.target131 ? Reflect.construct(fn, args, new.target)132 : Reflect.apply(fn, this, args)133 }134}135 136/**137 * Assert deep strict equivalence.138 *139 * > 👉 **Important**: only asserts when the `development` condition is used,140 * > does nothing in production.141 *142 * @template {unknown} T143 * Expected kind.144 * @param {unknown} actual145 * Value.146 * @param {T} expected147 * Baseline.148 * @param {Error | string | null | undefined} [message]149 * Message for assertion error (default: `'Expected values to be deeply equal'`).150 * @returns {asserts actual is T}151 * Nothing; throws when `actual` is not deep strict equal to `expected`.152 * @throws {AssertionError}153 * Throws when `actual` is not deep strict equal to `expected`.154 */155export function equal(actual, expected, message) {156 assert(157 dequal(actual, expected),158 actual,159 expected,160 'equal',161 'Expected values to be deeply equal',162 message163 )164}165 166/**167 * Assert if `value` is truthy.168 *169 * > 👉 **Important**: only asserts when the `development` condition is used,170 * > does nothing in production.171 *172 * @param {unknown} value173 * Value to assert.174 * @param {Error | string | null | undefined} [message]175 * Message for assertion error (default: `'Expected value to be truthy'`).176 * @returns {asserts value}177 * Nothing; throws when `value` is falsey.178 * @throws {AssertionError}179 * Throws when `value` is falsey.180 */181export function ok(value, message) {182 assert(183 Boolean(value),184 false,185 true,186 'ok',187 'Expected value to be truthy',188 message189 )190}191 192/**193 * Assert that a code path never happens.194 *195 * > 👉 **Important**: only asserts when the `development` condition is used,196 * > does nothing in production.197 *198 * @param {Error | string | null | undefined} [message]199 * Message for assertion error (default: `'Unreachable'`).200 * @returns {never}201 * Nothing; always throws.202 * @throws {AssertionError}203 * Throws when `value` is falsey.204 */205export function unreachable(message) {206 assert(false, false, true, 'ok', 'Unreachable', message)207}208 209/**210 * @param {boolean} bool211 * Whether to skip this operation.212 * @param {unknown} actual213 * Actual value.214 * @param {unknown} expected215 * Expected value.216 * @param {string} operator217 * Operator.218 * @param {string} defaultMessage219 * Default message for operation.220 * @param {Error | string | null | undefined} userMessage221 * User-provided message.222 * @returns {asserts bool}223 * Nothing; throws when falsey.224 */225// eslint-disable-next-line max-params226function assert(bool, actual, expected, operator, defaultMessage, userMessage) {227 if (!bool) {228 throw userMessage instanceof Error229 ? userMessage230 : new AssertionError(231 userMessage || defaultMessage,232 actual,233 expected,234 operator,235 !userMessage236 )237 }238}239 